Socket
Socket
Sign inDemoInstall

lodash

Package Overview
Dependencies
0
Maintainers
3
Versions
114
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

lodash

Lodash modular utilities.


Version published
Maintainers
3
Weekly downloads
47,619,606
decreased by-9.25%

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 v4.1.0

The lodash library exported as Node.js modules.

Installation

Using npm:

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

In Node.js:

// load the full build
var _ = require('lodash');
// load the core build
var _ = require('lodash/core');
// load the fp build for immutable auto-curried iteratee-first data-last methods
var _ = require('lodash/fp');

// or a method category
var array = require('lodash/array');
var object = require('lodash/fp/object');

// or method for smaller builds with browserify/rollup/webpack
var chunk = require('lodash/chunk');
var extend = require('lodash/fp/extend');

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

Support

Tested in Chrome 46-47, Firefox 42-43, IE 9-11, Edge 13, Safari 8-9, Node.js 0.10, 0.12, 4, & 5, & PhantomJS 1.9.8. Automated browser & CI test runs are available. Special thanks to Sauce Labs for providing automated browser testing.

Keywords

FAQs

Last updated on 29 Jan 2016

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