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
muslnode 18–226 runs
build_error
glibcnode 18–226 runs
build_error
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
pickByCallback
✓ var pickByCallback = require('lodash._pickbycallback');
This package is CommonJS-only, typical for its v3.0.0 era. It does not support ES module `import` syntax.
pickByCallback
✓ import pickByCallback from 'lodash._pickbycallback';
✗ import { pickByCallback } from 'lodash._pickbycallback';
While this package is CommonJS, some bundlers might attempt to 'shim' a default import. Named imports like `import { pickByCallback }` are incorrect as this package does not use named exports.
This code demonstrates how to import and use the `pickByCallback` function from the `lodash._pickbycallback` package in a CommonJS Node.js environment, filtering active users from an object.
const pickByCallback = require('lodash._pickbycallback');
const users = {
'fred': { 'user': 'fred', 'active': false },
'barney': { 'user': 'barney', 'active': true },
'pebbles': { 'user': 'pebbles', 'active': false }
};
const activeUsers = pickByCallback(users, (value) => value.active);
console.log(activeUsers);
// Expected output: { barney: { user: 'barney', active: true } }
const numbers = {
'a': 1,
'b': 0,
'c': undefined
};
// Note: `pickByCallback` (equivalent to `_.pickBy`) by default treats 0, false, null, undefined as falsey and filters them.
const truthyNumbers = pickByCallback(numbers, (value) => !!value);
console.log(truthyNumbers);
// Expected output: { a: 1 }
Debug
Known issues
breakingThis `lodash._pickbycallback` package is based on Lodash v3.x. The main Lodash library introduced significant breaking changes in v4.0.0, including changes to how `pick` and `pickBy` predicates receive arguments (initially not passing the key). Using this v3 package in a v4+ Lodash environment can lead to unexpected behavior or API mismatches.fixMigrate to modern Lodash usage by importing `pickBy` directly from the main `lodash` package (e.g., `require('lodash/pickBy')`) or `lodash-es` for ESM, ensuring compatibility with Lodash v4+ APIs. affects: >=3.0.0 (when used with Lodash v4+)
deprecatedThis 'per-method' package (`lodash._pickbycallback`) represents an outdated modularization strategy for Lodash. Its use is discouraged, and these packages are slated for removal in Lodash v5. Modern applications should prefer importing specific functions directly from the main `lodash` package or using `lodash-es` for better tree-shaking and maintainability.fixRefactor your imports to use `const pickBy = require('lodash/pickBy');` for CommonJS or `import { pickBy } from 'lodash-es';` for ESM, leveraging actively maintained Lodash builds. affects: >=3.0.0
gotchaThis package, being stuck at v3.0.0, does not include security patches or bug fixes released in later versions of the main Lodash library. For example, critical prototype pollution vulnerabilities fixed in `lodash@4.18.0` via `_.unset` and `_.omit` are not addressed in this package. Using outdated dependencies can expose your application to known security flaws.fixUpgrade to the actively maintained `lodash` package (v4.x or newer) and import `pickBy` from there. If specific legacy behavior is required, carefully audit the code for vulnerabilities or consider vendoring the function after applying necessary patches.
affects: 3.0.0
Errors
Common errors & fixes
TypeError: pickByCallback is not a function
The `lodash._pickbycallback` package is a CommonJS module. This error often occurs when attempting to use ES module `import` syntax or incorrect destructuring (e.g., `import { pickByCallback } from '...'`) which results in `undefined`.
fixEnsure you are using the CommonJS `require` syntax: `const pickByCallback = require('lodash._pickbycallback');`. SyntaxError: Cannot use import statement outside a module
You are trying to `import` this package in a CommonJS context (e.g., a `.js` file without `"type": "module"` in `package.json` or a `.cjs` file). This package is natively CommonJS.
fixChange the import statement to a CommonJS `require` statement: `const pickByCallback = require('lodash._pickbycallback');`. Audit
Dependencies
No dependency data recorded yet.