Security News
The Unpaid Backbone of Open Source: Solo Maintainers Face Increasing Security Demands
Solo open source maintainers face burnout and security challenges, with 60% unpaid and 60% considering quitting.
A utility library delivering consistency, customization, performance, and extras.
Lodash is a JavaScript library that provides utility functions for common programming tasks using a functional programming paradigm. It includes functions for manipulating and traversing arrays, objects, and strings, as well as utilities for functions, language, math, number, object, sequence, and utility methods.
Array Manipulation
Lodash provides a rich set of array manipulation functions such as map, filter, find, and sort. The code sample demonstrates sorting an array in ascending order using a custom comparator.
[3, 2, 1].sort(_.compareWith(function(a, b) { return a - b; }))
Object Manipulation
Lodash allows for easy manipulation and traversal of objects. The code sample shows how to assign properties from source objects to a destination object.
_.assign({ 'a': 1 }, { 'b': 2 }, { 'c': 3 })
String Manipulation
Lodash includes functions to manipulate strings, such as converting to different cases, trimming, padding, etc. The code sample demonstrates converting a string to kebab-case.
_.kebabCase('Foo Bar')
Function Utilities
Lodash provides function utilities like debounce and throttle to control function invocation. The code sample shows a debounced function that will only be invoked after 250 milliseconds have passed without it being called again.
_.debounce(function() { console.log('Debounced'); }, 250)
Language Utilities
Lodash includes utilities for deep cloning, merging, and comparing objects. The code sample demonstrates deep cloning an object to ensure nested objects are cloned as well.
_.cloneDeep({ 'a': 1, 'b': { 'c': 2 } })
Underscore is a utility library with similar functionality to Lodash, offering a range of functions for manipulating arrays, objects, and functions. It is generally considered to be the predecessor to Lodash, which provides a superset of Underscore's features with additional performance optimizations.
Ramda is a functional programming library that emphasizes a more functional and composable approach compared to Lodash. It provides similar utilities but focuses on immutability and side-effect free functions, which can lead to a different programming style.
Immutable.js offers a different take on data manipulation by providing persistent immutable data structures. Unlike Lodash, which works with standard JavaScript objects and arrays, Immutable.js uses its own data structures, which can lead to better performance and easier reasoning about state changes in certain applications.
A utility library delivering consistency, customization, performance, & extras.
Lo-Dash builds (for modern environments):
Development and
Production
Lo-Dash compatibility builds (for legacy and modern environments):
Development and
Production
Underscore compatibility builds:
Development and
Production
CDN copies of ≤ v1.2.1’s builds are available on cdnjs thanks to CloudFlare:
Lo-Dash dev,
Lo-Dash prod,
Lo-Dash compat-dev,
Lo-Dash compat-prod,
Underscore compat-dev, and
Underscore compat-prod
For optimal file size, create a custom build with only the features you need
We’ve got API docs, benchmarks, and unit tests.
For a list of upcoming features, check out our roadmap.
For more information check out these articles, screencasts, and other videos over Lo-Dash:
fromIndex
argumentoptions
argument for more controlObject
constructorthis
bindingcallback
and thisArg
argumentscallback
shorthandsLo-Dash has been tested in at least Chrome 526, Firefox 220, IE 6-10, Opera 9.25~12, Safari 3-6, Node.js 0.4.8-0.10.5, Narwhal 0.3.2, PhantomJS 1.9.0, RingoJS 0.9, and Rhino 1.7RC5.
In browsers:
<script src="lodash.js"></script>
Using npm
:
npm install lodash
npm install -g lodash
npm link lodash
To avoid potential issues, update npm
before installing Lo-Dash:
npm install npm -g
In Node.js and RingoJS ≥ v0.8.0:
var _ = require('lodash');
// or as a drop-in replacement for Underscore
var _ = require('lodash/dist/lodash.underscore');
Note: If Lo-Dash is installed globally, run npm link lodash
in your project’s root directory before requiring it.
In RingoJS ≤ v0.7.0:
var _ = require('lodash')._;
In Rhino:
load('lodash.js');
In an AMD loader like RequireJS:
require({
'paths': {
'underscore': 'path/to/lodash'
}
},
['underscore'], function(_) {
console.log(_.VERSION);
});
_.isPlainObject
works with objects created by Object.create(null)
false
for subclassed valuesleading
and trailing
calls enabled,The full changelog is available here.
Lo-Dash is part of the BestieJS “Best in Class” module collection. This means we promote solid browser/environment support, ES5+ precedents, unit testing, and plenty of documentation.
John-David Dalton |
Blaine Bublitz | Kit Cambridge | Mathias Bynens |
FAQs
Lodash modular utilities.
We found that lodash demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Solo open source maintainers face burnout and security challenges, with 60% unpaid and 60% considering quitting.
Security News
License exceptions modify the terms of open source licenses, impacting how software can be used, modified, and distributed. Developers should be aware of the legal implications of these exceptions.
Security News
A developer is accusing Tencent of violating the GPL by modifying a Python utility and changing its license to BSD, highlighting the importance of copyleft compliance.