{"id":14686,"library":"lodash._pickbycallback","title":"Lodash Internal pickByCallback Module","description":"The `lodash._pickbycallback` package provides a modularized export of Lodash's internal `pickByCallback` utility function. This package, currently at version 3.0.0, represents an older strategy for consuming individual Lodash functions as standalone CommonJS modules. It was designed to address bundle size concerns in environments where importing the entire Lodash library was undesirable. However, this approach is now considered legacy. The main `lodash` package is currently at v4.18.1 and offers more efficient modularization methods like `lodash-es` for ESM environments or direct per-method imports (e.g., `require('lodash/pickBy')`) that support modern tree-shaking bundlers. This specific sub-package has not received updates since its initial v3.0.0 release, meaning it lacks bug fixes and security patches applied to the main Lodash library in its v4.x releases.","status":"deprecated","version":"3.0.0","language":"javascript","source_language":"en","source_url":"https://github.com/lodash/lodash","tags":["javascript"],"install":[{"cmd":"npm install lodash._pickbycallback","lang":"bash","label":"npm"},{"cmd":"yarn add lodash._pickbycallback","lang":"bash","label":"yarn"},{"cmd":"pnpm add lodash._pickbycallback","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"This package is CommonJS-only, typical for its v3.0.0 era. It does not support ES module `import` syntax.","symbol":"pickByCallback","correct":"var pickByCallback = require('lodash._pickbycallback');"},{"note":"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.","wrong":"import { pickByCallback } from 'lodash._pickbycallback';","symbol":"pickByCallback","correct":"import pickByCallback from 'lodash._pickbycallback';"}],"quickstart":{"code":"const pickByCallback = require('lodash._pickbycallback');\n\nconst users = {\n  'fred':    { 'user': 'fred',    'active': false },\n  'barney':  { 'user': 'barney',  'active': true  },\n  'pebbles': { 'user': 'pebbles', 'active': false }\n};\n\nconst activeUsers = pickByCallback(users, (value) => value.active);\n\nconsole.log(activeUsers);\n// Expected output: { barney: { user: 'barney', active: true } }\n\nconst numbers = {\n  'a': 1,\n  'b': 0,\n  'c': undefined\n};\n\n// Note: `pickByCallback` (equivalent to `_.pickBy`) by default treats 0, false, null, undefined as falsey and filters them.\nconst truthyNumbers = pickByCallback(numbers, (value) => !!value);\nconsole.log(truthyNumbers);\n// Expected output: { a: 1 }","lang":"javascript","description":"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."},"warnings":[{"fix":"Migrate 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.","message":"This `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.","severity":"breaking","affected_versions":">=3.0.0 (when used with Lodash v4+)"},{"fix":"Refactor your imports to use `const pickBy = require('lodash/pickBy');` for CommonJS or `import { pickBy } from 'lodash-es';` for ESM, leveraging actively maintained Lodash builds.","message":"This '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.","severity":"deprecated","affected_versions":">=3.0.0"},{"fix":"Upgrade 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.","message":"This 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.","severity":"gotcha","affected_versions":"3.0.0"}],"env_vars":null,"last_verified":"2026-04-19T00:00:00.000Z","next_check":"2026-07-18T00:00:00.000Z","problems":[{"fix":"Ensure you are using the CommonJS `require` syntax: `const pickByCallback = require('lodash._pickbycallback');`.","cause":"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`.","error":"TypeError: pickByCallback is not a function"},{"fix":"Change the import statement to a CommonJS `require` statement: `const pickByCallback = require('lodash._pickbycallback');`.","cause":"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.","error":"SyntaxError: Cannot use import statement outside a module"}],"ecosystem":"npm"}