Open In App
Related Articles

Lodash Util Complete Reference

Improve
Improve
Improve
Like Article
Like
Save Article
Save
Report issue
Report

Lodash is a JavaScript library that works on the top of underscore.js. Lodash helps in working with arrays, strings, objects, numbers, etc. It provides us with various inbuilt functions and uses a functional programming approach which makes coding in JavaScript easier to understand because instead of writing repetitive functions, tasks can be accomplished with a single line of code.

Methods

Description

_.attempt()It attempts to invoke ‘func’ and return either result or caught error object.
_.bindAll()It is used to bind the number of methods on the object.
_.cond()It creates a function that iterates over pairs and invokes the corresponding function of the first predicate.
_.conforms()It calls the predicate properties of the source with the analogous property values of a stated object.
_.constant()It creates a function that returns value.
_.defaultTo()It checks the given value and determine if a default value should be restored in its place.
_.flow()It creates a new composite function that invokes the provided functions.
_.flowRight()It creates a new composite function that invokes the provided functions from right to left
_.identity()It returns the first argument it receives.
_.iteratee()It creates a function that invokes func with the arguments of the created function.
_.matches()It performs a partial deep comparison between a given object and source.
_.matchesProperty()It performs a partial deep comparison between the value at path of a given object to srcValue.
_.method()It creates a function that invokes the method at the path of a given object.
_.methodOf()It creates a function that invokes the method at a given path of the object.
_.mixin()It adds all own enumerable string keyed function properties of a source object to the destination object.
_.noConflict()It reverts the variable to its former value.
_.noop()It returns “undefined” irrespective of the arguments passed to it.
_.nthArg()It creates a function that gets the argument at index n.
_.over()It creates a function that invokes iteratee with the arguments it receives.
_.overEvery()It checks if all the predicates return truth when invoked with the received arguments.
_.overSome()It checks if any of the predicates return truthy when invoked with the received arguments.
_.property()It returns a function that will return the specified property of any passed-in object.
_.propertyOf()It takes an object as an argument and returns a function that will return the value of a provided property.
_.range()It creates an array of numbers progressing from the given start value up to given, but not including end value.
_.rangeRight()It creates an array of numbers progressing from the given start value to the given, but not including end value.
_.runInContext()It creates a new lodash function using the given context object.
_.stubArray()It is used to create a new empty array.
_.stubFalse()It is used to always return a false value.
_.stubObject()It is used to create and return an empty object.
_.stubString()It returns an empty string.
_.stubTrue()It is used to return a true value.
_.times()It invokes the iteratee n times, returning an array of the results of each invocation.
_.toPath()It converts the given value to a property path array.
_.uniqueId()It creates an unique id for some element each time.

Last Updated : 27 Jul, 2023
Like Article
Save Article
Share your thoughts in the comments
Similar Reads