Security News
RubyGems.org Adds New Maintainer Role
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
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.
Check out our wiki for details over the differences between builds.
Modern builds perfect for newer browsers/environments:
Development &
Production
Compatibility builds for older environment support too:
Development &
Production
Underscore builds to use as a drop-in replacement:
Development &
Production
CDN copies are available on cdnjs & jsDelivr. For smaller file sizes, create custom builds with only the features needed.
Love modules? We’ve got you covered with lodash-amd, lodash-es6, lodash-node, & npm packages per method.
There’s plenty of documentation, unit tests, & benchmarks.
Check out DevDocs as a fast, organized, & searchable interface for our documentation.
The full changelog for this release is available on our wiki.
A list of upcoming features is available on our roadmap.
Date
& RegExp
objectsfromIndex
options
for more controlObject
cache
of memoized functionsA list of other community created podcasts, posts, & videos is available on our wiki.
Tested in Chrome 530, Firefox 225, IE 6-11, Opera 9.25~17, Safari 3-7, Node.js 0.6.8-0.10.21, Narwhal 0.3.2, PhantomJS 1.9.2, RingoJS 0.9, & Rhino 1.7RC5.
Special thanks to Sauce Labs for providing automated browser testing.
In browsers:
<script src="lodash.js"></script>
Using npm
:
npm i --save lodash
{sudo} npm i -g lodash
npm ln lodash
var _ = require('lodash');
// or as Underscore
var _ = require('lodash/dist/lodash.underscore');
Notes:
_
when in the REPLnpm ln lodash
in your project’s root directory before requiring itIn Rhino:
load('lodash.js');
In an AMD loader:
require({
'packages': [
{ 'name': 'lodash', 'location': 'path/to/lodash', 'main': 'lodash' }
]
},
['lodash'], function(_) {
console.log(_.VERSION);
});
John-David Dalton |
Blaine Bublitz | Kit Cambridge | Mathias Bynens |
FAQs
Lodash modular utilities.
The npm package lodash receives a total of 41,506,977 weekly downloads. As such, lodash popularity was classified as popular.
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
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.
Security News
Research
Socket's threat research team has detected five malicious npm packages targeting Roblox developers, deploying malware to steal credentials and personal data.