Open In App

Lodash Util Complete Reference

Last Updated : 20 Aug, 2024
Comments
Improve
Suggest changes
Like Article
Like
Report

Lodash is a JavaScript utility library built on top of Underscore.js. It simplifies working with arrays, strings, objects, numbers, and more by providing a wide range of built-in functions. Lodash follows a functional programming approach, making JavaScript code more readable and concise. Instead of writing repetitive functions, you can perform common tasks with just a single line of code, enhancing productivity and reducing errors.

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.

Next Article

Similar Reads

  翻译: