Socket
Socket
Sign inDemoInstall

lodash

Package Overview
Dependencies
0
Maintainers
5
Versions
114
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

lodash

The modern build of lodash modular utilities.


Version published
Maintainers
5
Weekly downloads
48,476,522
decreased by-7.79%

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

lodash v3.3.0

The modern build of lodash exported as Node.js/io.js modules.

Generated using lodash-cli:

$ lodash modularize modern exports=node -o ./
$ lodash modern -d -o ./index.js

Installation

Using npm:

$ {sudo -H} npm i -g npm
$ npm i --save lodash

In Node.js/io.js:

// load the modern build
var _ = require('lodash');
// or a method category
var array = require('lodash/array');
// or a method (works great with browserify/webpack to create smaller builds)
var chunk = require('lodash/array/chunk');

See the package source for more details.

Note:
Don’t assign values to the special variable _ when in the REPL.
Install n_ for a REPL that includes lodash by default.

Module formats

lodash is also available in a variety of other builds & module formats.

Further Reading

Features not in Underscore

Support

Tested in Chrome 39-40, Firefox 34-35, IE 6-11, Opera 26-27, Safari 5-8, io.js 1.2.0, Node.js 0.8.28, 0.10.36, & 0.12.0, PhantomJS 1.9.8, RingoJS 0.11, & Rhino 1.7RC5.

Automated browser & CI test runs are available. Special thanks to Sauce Labs for providing automated browser testing.

Keywords

FAQs

Last updated on 20 Feb 2015

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