Lodash Util Methods

Beginner
6 min read
Updated: Nov 2026
34 method guides
Method index

About This Index

This page is the Lodash Util index for the tutorial track. Each row links to a full guide with syntax, examples, and FAQs.

Learn strings and collections on /lodash/string and /lodash/collection. Use this page for glue helpers such as _.identity(), _.flow(), or _.times().

Beginner path.

Start with _.identity(), then _.flow(), _.times(), and _.uniqueId()—then browse iteratee and stub helpers.

How to Call a Util Method

Call utilities on _ like any other Lodash helper:

Lodash
import _ from "lodash";

_.identity(5);              // 5
_.constant("ok")();         // "ok"
_.defaultTo(null, 42);      // 42

const double = function (n) { return n * 2; };
const square = function (n) { return n * n; };
_.flow([double, square])(3); // 36

_.times(3, function (i) { return i * 2; }); // [0, 2, 4]
_.range(1, 5);              // [1, 2, 3, 4]
_.uniqueId("user_");        // "user_1"

_.attempt(function () { return JSON.parse("{bad"); });
// returns a SyntaxError instead of throwing

Lodash Util Methods Table

All util method guides in this Lodash tutorial series (34 tutorials).

Getting Started

5 methods

Identity defaults, constants, no-ops, defaults, and safe attempts.

MethodDescriptionTutorial
_.identity()Return the first argument unchanged—the default iteratee in many Lodash APIs.Try it
_.constant()Return a function that always yields the same value.Try it
_.noop()Empty function that does nothing—placeholder callback or default iteratee.Try it
_.defaultTo()Return a default value only when the input is null or undefined.Try it
_.attempt()Invoke a function in try/catch; return the result or the caught error object.Try it

Compose & Cond

6 methods

Wire functions together with flow, cond, and over helpers.

MethodDescriptionTutorial
_.flow()Compose functions left to right; each step receives the previous return value.Try it
_.flowRight()Compose functions right to left (mathematical compose).Try it
_.cond()Build a conditional function from ordered [predicate, handler] pairs.Try it
_.over()Map the same input through multiple functions; return an array of results.Try it
_.overEvery()AND-combine predicates: true only when every predicate passes.Try it
_.overSome()OR-combine predicates: true when at least one predicate passes.Try it

Iteratee & Match

9 methods

Build callbacks, matchers, property getters, and method invokers.

MethodDescriptionTutorial
_.iteratee()Convert property shorthands, matchers, and objects into a callback function.Try it
_.matches()Deep partial-match predicate: does the value contain the spec shape?Try it
_.matchesProperty()Predicate that checks whether a value at path equals an expected value.Try it
_.conforms()Return a predicate that checks whether an object matches a shape of predicates.Try it
_.property()Return a getter function for a path (shorthand for partial _.get).Try it
_.propertyOf()Like property, but the object is fixed when the getter is created.Try it
_.method()Return a function that invokes a named method on the first argument object.Try it
_.methodOf()Like method, but the object is the second argument to the returned function.Try it
_.nthArg()Return a function that picks the nth argument from the outer call.Try it

Generate

5 methods

Repeat work, build ranges, mint ids, and parse paths.

MethodDescriptionTutorial
_.times()Invoke an iteratee n times with indices 0…n−1; collect return values.Try it
_.range()Build a numeric array from start/end/step (end exclusive).Try it
_.rangeRight()Like range but produces values from right to left.Try it
_.uniqueId()Generate an incrementing string id with an optional prefix.Try it
_.toPath()Convert a dot/bracket path string into an array of key segments.Try it

Stubs

5 methods

Always-empty or always-boolean placeholder factories.

MethodDescriptionTutorial
_.stubArray()Return a function that always yields a new empty array.Try it
_.stubObject()Return a function that always yields a new empty object.Try it
_.stubString()Return a function that always yields an empty string.Try it
_.stubTrue()Return a function that always yields true.Try it
_.stubFalse()Return a function that always yields false.Try it

Extend Lodash

4 methods

Mixin custom methods, reclaim _, bind methods, and isolate context.

MethodDescriptionTutorial
_.mixin()Add custom functions onto Lodash (extend Lodash itself).Try it
_.noConflict()Restore the previous global _ variable and return the Lodash instance.Try it
_.bindAll()Bind own method names on an object so this stays fixed for callbacks.Try it
_.runInContext()Create an isolated Lodash instance with a fresh internal state.Try it

Frequently Asked Questions

They are general-purpose helpers: identity defaults (_.identity, _.constant, _.noop), composition (_.flow, _.cond), iteratee factories (_.iteratee, _.matches, _.property), generators (_.times, _.range, _.uniqueId), stubs, and library glue (_.mixin, _.noConflict).
_.flow runs functions left to right (first function first). _.flowRight runs right to left—the same direction as mathematical function composition.
Collection APIs accept iteratee shorthands. Helpers like _.iteratee, _.matches, and _.property turn those shorthands into real functions—or build predicates for filter, find, and cond.
Prefer per-method imports: import flow from 'lodash/flow' or import { flow } from 'lodash-es'. You can also use const _ = require('lodash') and call _.flow().
Start with _.identity(), then _.flow(), _.times(), and _.uniqueId() from the table below.

Start with _.identity()

Open the identity guide—syntax, examples, and FAQs.

_.identity() tutorial →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

12 people found this page helpful