{"id":14679,"library":"lodash._arrayfilter","title":"Lodash Internal Array Filter","description":"This package, `lodash._arrayfilter`, provides a modularized, internal implementation of `arrayFilter` originally part of the Lodash v3 ecosystem. Released around 2014-2015, this version (`3.0.0`) predates the significant breaking changes and API refinements introduced with Lodash v4 (currently at `4.18.1`). While the main `lodash` library continues active development with a steady release cadence, `lodash._arrayfilter` as a standalone module is no longer actively maintained. Its original purpose was to allow granular imports of internal Lodash utilities for specific environments, a need largely superseded by modern JavaScript bundlers offering robust tree-shaking capabilities for the complete `lodash` package. It is a CommonJS-only module and is primarily compatible with other Lodash v3 components, making it largely unsuitable for contemporary projects using `lodash` v4+ or ES modules. Key differentiators at its time included extreme modularity for internal functions, but this approach is now considered legacy.","status":"abandoned","version":"3.0.0","language":"javascript","source_language":"en","source_url":"https://github.com/lodash/lodash","tags":["javascript"],"install":[{"cmd":"npm install lodash._arrayfilter","lang":"bash","label":"npm"},{"cmd":"yarn add lodash._arrayfilter","lang":"bash","label":"yarn"},{"cmd":"pnpm add lodash._arrayfilter","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"This package is a CommonJS module from Lodash v3 and does not support ES module import syntax.","wrong":"import arrayFilter from 'lodash._arrayfilter';","symbol":"arrayFilter","correct":"const arrayFilter = require('lodash._arrayfilter');"},{"note":"This is a CommonJS module that exports a single function as its default. It does not use named exports.","wrong":"import { arrayFilter } from 'lodash._arrayfilter';","symbol":"arrayFilter (named)","correct":"const arrayFilter = require('lodash._arrayfilter');"}],"quickstart":{"code":"const arrayFilter = require('lodash._arrayfilter');\n\nconst users = [\n  { 'user': 'barney', 'age': 36, 'active': true },\n  { 'user': 'fred',   'age': 40, 'active': false },\n  { 'user': 'pebbles', 'age': 1, 'active': true }\n];\n\n// This is an internal utility and might have specific expectations.\n// For general use, prefer Array.prototype.filter or the main lodash `_.filter` (v4+).\nconst activeUsers = arrayFilter(users, (user) => user.active);\n\nconsole.log(activeUsers);\n// Expected output:\n// [ { user: 'barney', age: 36, active: true }, { user: 'pebbles', age: 1, active: true } ]","lang":"javascript","description":"Demonstrates how to import and use the internal `arrayFilter` function from this legacy Lodash v3 module using CommonJS."},"warnings":[{"fix":"For modern applications, use the standard `_.filter` function from the main `lodash` package (v4+) or `Array.prototype.filter` for basic array filtering. Do not mix Lodash v3 internal modules with v4+ builds.","message":"This package is a Lodash v3 internal utility. It is not compatible with Lodash v4+ APIs, which introduced significant breaking changes. Using it with a modern Lodash environment or expecting v4 behavior will likely lead to errors.","severity":"breaking","affected_versions":"<4.0.0"},{"fix":"Migrate to using `lodash` (the main package) and rely on your bundler's tree-shaking for optimized builds. Alternatively, use native JavaScript methods like `Array.prototype.filter`.","message":"This package represents a specific, older modular build strategy for Lodash internals. It is effectively abandoned as a standalone module in favor of using the main `lodash` package, which offers robust tree-shaking capabilities in modern bundlers, making granular imports unnecessary.","severity":"deprecated","affected_versions":">=3.0.0"},{"fix":"Always use `require('lodash._arrayfilter')` for this package.","message":"This module is a CommonJS-only package. Attempting to use ES module `import` syntax will result in a runtime error or build failure.","severity":"gotcha","affected_versions":">=3.0.0"},{"fix":"Refer to the Lodash v3 source code for precise usage if absolutely necessary, but it is strongly recommended to use the public `_.filter` API from the appropriate Lodash version instead.","message":"As an internal utility, `lodash._arrayfilter` may have specific assumptions about its execution context or arguments that differ from the public `_.filter` API, especially across major Lodash versions. Direct usage might not yield expected results without deep knowledge of Lodash v3 internals.","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 `const arrayFilter = require('lodash._arrayfilter');` and then correctly invoking `arrayFilter(collection, predicate)`.","cause":"Attempting to call the imported module directly when it might be an object or undefined, or using wrong import syntax that doesn't resolve to the function.","error":"TypeError: lodash._arrayfilter is not a function"},{"fix":"Change your import statement to `const arrayFilter = require('lodash._arrayfilter');`.","cause":"Using ES module `import` syntax (`import arrayFilter from 'lodash._arrayfilter';`) in a CommonJS environment or for a CommonJS-only package.","error":"SyntaxError: Cannot use import statement outside a module"}],"ecosystem":"npm"}