Registry / serialization / lodash

lodash

JSON →
library4.18.1jsnpm✓ verified 32d ago

lodash is a JavaScript utility library providing consistent, cross-environment, performance-optimized, and modular utilities for common programming tasks. It simplifies working with arrays, objects, numbers, strings, and functions, offering a wide range of helpers for iteration, manipulation, and type checking. The current stable version is 4.18.1, with frequent updates for bug fixes and security patches, typically released as minor or patch versions.

npm install lodash
INSTALL
IMPORT
SIG · LODASH
L
lodash
serializationjavascriptv4.18.1
Install
900ms avg
Import
13ms
Disk
5MB
Pass rate
6/ 6
Env Coverage6 / 6
glibc
18–22
musl
18–22
Install & Compatibility
Where this runs
tested against v4.18.1 · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18–223 runs
installs and imports cleanly · install 0.0s · import 0.017s · 4.9MB
glibc
node 18–223 runs
installs and imports cleanly · install 0.9s · import 0.010s · 5MB
5MB installed
● package 5MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

_
✓ import _ from 'lodash';
✗ const _ = require('lodash');
The 'lodash' package supports both CommonJS and ESM imports. For optimal tree-shaking in modern bundlers, consider using 'lodash-es'.

Demonstrates importing the full lodash library and using the `_.filter` method to process an array of objects.

import _ from 'lodash'; const users = [ { 'user': 'barney', 'age': 36, 'active': true }, { 'user': 'fred', 'age': 40, 'active': false } ]; const activeUsers = _.filter(users, function(o) { return o.active; }); console.log(activeUsers); // Expected output: [ { user: 'barney', age: 36, active: true } ]
Debug
Known issues
breakinglodash v4.0.0 introduced significant back-compatible breaking changes to align with semantic versioning practices.
fix
Consult the [v4.0.0 Changelog](https://github.com/lodash/lodash/wiki/Changelog#v400) for migration details.
affects: >=4.0.0
breakinglodash v3.0.0 included several back-compatible breaking changes as part of a major cleanup and refactoring.
fix
Consult the [v3.0.0 release notes](https://github.com/lodash/lodash/tree/3.0.0) for migration details.
affects: >=3.0.0
gotchaA prototype pollution vulnerability via `_.unset` and `_.omit` path traversal was fixed.
fix
Upgrade to `lodash@4.18.0` or higher to address security vulnerability GHSA-f23m-r3pf-42rh.
affects: <4.18.0
gotchaA `ReferenceError` could occur when using `_.template` or `_.fromPairs` from modular builds due to internal dependency issues.
fix
Upgrade to `lodash@4.18.1` or higher to resolve this `ReferenceError`.
affects: 4.18.0
gotchaLodash functionality in the Node.js REPL may be inconsistent or require a polyfill for Node.js versions prior to 6.
fix
Install `n_` (`npm i -g n_`) for Node.js < 6 REPL support, or use Node.js v6 or higher.
affects: Node.js < 6
Errors
Common errors & fixes
ReferenceError: <variable name> is not defined
Internal dependency mapping issue in `_.template` or `_.fromPairs` functions when imported individually or from modular builds in versions prior to 4.18.1.
fix
Upgrade `lodash` to version `4.18.1` or higher.
TypeError: require is not a function
Attempting to use CommonJS `require` syntax within an ES Module (ESM) file context.
fix
Refactor `const _ = require('lodash');` to `import _ from 'lodash';` for ESM compatibility.
SyntaxError: Cannot use import statement outside a module
Attempting to use ES Module `import` syntax within a CommonJS (CJS) file context or a project not configured for ESM.
fix
Refactor `import _ from 'lodash';` to `const _ = require('lodash');` for CJS compatibility, or configure your project to use ES Modules (e.g., by setting `"type": "module"` in `package.json`).
Upgrade
Version history
4.18.1latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
46 hits · last 30 days
node
42
Resources
lodash — npm install lodash · libregistry