Registry / serialization / lodash.pairs

lodash.pairs

JSON →
library3.0.1jsnpmunverified

This package provides the `_.pairs` function from the Lodash utility library, specifically from the Lodash v3 era, as a standalone Node.js module. The `_.pairs` function converts an object into an array of `[key, value]` pairs. While originally part of a strategy for modularizing Lodash functions, this `lodash.pairs` package is at version 3.0.1 and was last published over a decade ago. It is considered deprecated in favor of direct imports from the main `lodash` package (which is currently at v4.18.1 and actively maintained) or, preferably, `lodash-es` for modern, tree-shakable ES Module environments. Relying on this older, single-function module can lead to outdated behavior, missed bug fixes, and potential security vulnerabilities present in the main Lodash library that have since been addressed in v4.x. Modern applications should use `lodash-es` or specific imports from `lodash` itself for optimized bundle sizes and access to the latest features and patches.

npm install lodash.pairs
INSTALL
IMPORT
SIG · LODASH.PAIRS
L
lodash.pairs
serializationjavascriptv3.0.1
Install
—
Import
—
Disk
—
Pass rate
0/ 6
Env Coverage0 / 6
glibc
18–22
musl
18–22
Install & Compatibility
Where this runs
tested against v? · 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–226 runs
build_error
glibc
node 18–226 runs
build_error
Code
Verified usage

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

pairs
✓ import { pairs } from 'lodash-es';
✗ var pairs = require('lodash.pairs');
For modern ES Module environments and tree-shaking, import directly from 'lodash-es'. This is the recommended approach for Lodash v4+.
pairs
✓ import pairs from 'lodash/pairs';
✗ import { pairs } from 'lodash';
For smaller CommonJS bundles without full Lodash, import the specific function directly from 'lodash/pairs'. Note that 'lodash' itself is primarily CommonJS but can be imported this way for cherry-picking.
pairs
✓ var pairs = require('lodash.pairs');
✗ import { pairs } from 'lodash.pairs';
This specific package (`lodash.pairs@3.0.1`) is a CommonJS module and must be imported using `require()`.

Demonstrates how to convert an object into an array of key-value pairs using `_.pairs` from `lodash-es`.

import { pairs } from 'lodash-es'; const myObject = { firstName: 'Alice', lastName: 'Smith', age: 30, city: 'New York' }; const keyValuePairs = pairs(myObject); console.log(keyValuePairs); // Expected output: [['firstName', 'Alice'], ['lastName', 'Smith'], ['age', 30], ['city', 'New York']] // For older Node.js environments or if explicitly using the deprecated lodash.pairs package: // var oldPairs = require('lodash.pairs'); // const oldKeyValuePairs = oldPairs(myObject); // console.log(oldKeyValuePairs);
Debug
Known issues
breakingThis `lodash.pairs` package is stuck at version 3.0.1 (published 11 years ago) and does not receive updates, bug fixes, or security patches from the main Lodash library, which is currently at v4.x. Its behavior might differ from `_.pairs` in Lodash v4.x due to breaking changes between Lodash v3 and v4.
fix
Migrate to `lodash` v4+ and import `pairs` directly from `lodash-es` (for ESM) or `lodash/pairs` (for CJS) to benefit from active maintenance, bug fixes, and security updates.
affects: >=3.0.1
deprecatedThe pattern of using individual `lodash.<function>` modular packages like `lodash.pairs` is generally deprecated. Modern Lodash (v4+) favors `lodash-es` for tree-shakable ES module imports or direct cherry-picking from `lodash/functionName` paths for optimized bundle sizes.
fix
Replace `require('lodash.pairs')` with `import { pairs } from 'lodash-es';` in ESM projects or `import pairs from 'lodash/pairs';` in CJS projects to leverage modern tooling and Lodash v4+ features.
affects: >=3.0.1
gotchaUsing this outdated `lodash.pairs` package means your application will not benefit from critical security advisories and patches released for the main `lodash` library, such as prototype pollution fixes in v4.18.0 (GHSA-f23m-r3pf-42rh). Although `_.pairs` itself might not be directly vulnerable, relying on an unmaintained module introduces unnecessary risk.
fix
Immediately update your dependencies to use the actively maintained `lodash` or `lodash-es` package and ensure you are on the latest versions to receive all security updates.
affects: >=3.0.1
Errors
Common errors & fixes
TypeError: pairs is not a function
Attempting to use `_.pairs` from a partial or incorrect `lodash` import, or trying to use the CommonJS `lodash.pairs` module with an ES module import syntax.
fix
Ensure you are importing `pairs` correctly for your module system. For ES Modules: `import { pairs } from 'lodash-es';`. For CommonJS using the main `lodash` package: `const { pairs } = require('lodash');` (if using Lodash v4+ with a bundler that can cherry-pick) or `const pairs = require('lodash/pairs');`. For this specific `lodash.pairs` module (deprecated): `const pairs = require('lodash.pairs');`.
ReferenceError: require is not defined
Attempting to use `require('lodash.pairs')` within an ES Module (ESM) file context in Node.js, where `require` is not globally available.
fix
If your project uses ESM, you must use `import` statements. Replace `require('lodash.pairs')` with `import { pairs } from 'lodash-es';` or `import pairs from 'lodash/pairs';` (after installing `lodash` or `lodash-es`). Alternatively, if you must use the old `lodash.pairs` package, convert your file to CommonJS or use an interop solution.
Upgrade
Version history
3.0.1latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
4 hits · last 30 days
node
4
Resources
lodash.pairs — npm install lodash.pairs · libregistry