Socket
Socket
Sign inDemoInstall

lodash

Package Overview
Dependencies
0
Maintainers
1
Versions
114
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

lodash

A utility library delivering consistency, customization, performance, and extras.


Version published
Maintainers
1
Weekly downloads
41,326,711
decreased by-16.2%
Install size
948 kB

Weekly downloads

Package description

What is lodash?

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.

What are lodash's main functionalities?

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 } })

Other packages similar to lodash

Readme

Source

Lo-Dash v1.1.1

A utility library delivering consistency, customization, performance, & extras.

Download

Dive in

We’ve got API docs, benchmarks, and unit tests.

For a list of upcoming features, check out our roadmap.

Resources

For more information check out these articles, screencasts, and other videos over Lo-Dash:

  • Posts
  • Videos

Features

Support

Lo-Dash has been tested in at least Chrome 525, Firefox 219, IE 6-10, Opera 9.25-12, Safari 3-6, Node.js 0.4.8-0.10.1, Narwhal 0.3.2, PhantomJS 1.8.1, RingoJS 0.9, and Rhino 1.7RC5.

Installation and usage

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);
});

Release Notes

v1.1.1

  • Ensured the underscore build version of _.forEach accepts a thisArg argument
  • Updated vendor/tar to work with Node v0.10.x

v1.1.0

  • Added rhino -require support
  • Added _.createCallback, _findIndex, _.findKey, _.parseInt, _.runInContext, and _.support
  • Added support for callback and thisArg arguments to _.flatten
  • Added CommonJS/Node support to precompiled templates
  • Ensured the exports object is not a DOM element
  • Ensured _.isPlainObject returns false for objects without a [[Class]] of “Object”
  • Made _.cloneDeep’s callback support more closely follow its documentation
  • Made the template precompiler create nonexistent directories of --output paths
  • Made _.object an alias of _.zipObject
  • Optimized method chaining, object iteration, _.find, and _.pluck (an average of 18% overall better performance)
  • Updated backbone build Lo-Dash method dependencies

The full changelog is available here.

BestieJS

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.

Author

twitter/jdalton
John-David Dalton

Contributors

twitter/blainebublitztwitter/kitcambridgetwitter/mathias
Blaine BublitzKit CambridgeMathias Bynens

Keywords

FAQs

Last updated on 04 Sep 2013

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc