{"id":15453,"library":"lodash._arrayeach","title":"Lodash Internal `arrayEach` Utility","description":"This package exports the internal `arrayEach` utility function from the Lodash library, specifically corresponding to `lodash` version 3.0.0, released around 2015. `arrayEach` is a foundational, optimized internal method for iterating over arrays. It differs from the public `_.forEach` in that it is strictly for arrays and doesn't handle objects or other collections. As an internal module, its primary purpose was to be consumed by other Lodash functions. While the main `lodash` library continues active development, this specific `lodash._arrayeach` module is considered a snapshot from the v3 era and has not received independent updates since its initial v3 release. Users seeking modern, maintained iteration utilities should rely on the comprehensive `lodash` package (currently v4.x) or `lodash-es` for tree-shakable builds.","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._arrayeach","lang":"bash","label":"npm"},{"cmd":"yarn add lodash._arrayeach","lang":"bash","label":"yarn"},{"cmd":"pnpm add lodash._arrayeach","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"This package is a CommonJS module from Lodash v3. It does not support ES module imports directly. Attempting to use named imports will result in a TypeError.","wrong":"import { arrayEach } from 'lodash._arrayeach';","symbol":"arrayEach","correct":"const arrayEach = require('lodash._arrayeach');"}],"quickstart":{"code":"const arrayEach = require('lodash._arrayeach');\n\nconst numbers = [10, 20, 30, 40, 50];\nconst doubledNumbers = [];\n\nconsole.log('Original numbers:', numbers);\n\narrayEach(numbers, (value, index) => {\n  doubledNumbers[index] = value * 2;\n});\n\nconsole.log('Doubled numbers:', doubledNumbers);\n\n// Demonstrating the internal nature: it's not the public _.forEach\nconst sparseArray = [1, , 3]; // eslint-disable-line no-sparse-arrays\nconst resultSparse = [];\narrayEach(sparseArray, (value) => resultSparse.push(value === undefined ? 'undefined' : value));\nconsole.log('ArrayEach on sparse array (handles undefined):', resultSparse);","lang":"javascript","description":"Demonstrates how to import and use the internal `arrayEach` function to iterate over an array."},"warnings":[{"fix":"Migrate to `_.forEach` from a current `lodash` package (v4.x) or `lodash-es` for tree-shakable builds. Avoid direct usage of internal modules like `lodash._arrayeach`.","message":"This `lodash._arrayeach` package is based on Lodash v3.0.0. The main `lodash` library moved to v4.0.0 in 2015, which introduced significant backward-incompatible changes across the entire library. Using this v3 internal module alongside a modern v4+ `lodash` installation may lead to inconsistent behavior or conflicts due to differing internal implementations.","severity":"breaking","affected_versions":">=3.0.0 (in context of Lodash v4+ projects)"},{"fix":"Refactor code to use `_.forEach` directly from the main `lodash` package or `lodash-es`. For example: `import { forEach } from 'lodash'; forEach(array, callback);`","message":"This package is an abandoned internal module from Lodash v3.0.0 and has not received updates since its initial release. Modern Lodash (v4.x) provides similar or improved functionality through its public API (e.g., `_.forEach` for array iteration) and `lodash-es` for modular, tree-shakable builds, which are actively maintained.","severity":"deprecated","affected_versions":">=3.0.0"},{"fix":"Always use public API functions provided by the main `lodash` package. For array iteration, `_.forEach` is the robust and supported choice.","message":"Relying on internal modules like `lodash._arrayeach` is discouraged as they are not part of Lodash's stable public API. Their behavior, existence, and compatibility can change without warning across major versions of the main `lodash` library, leading to unexpected issues during upgrades.","severity":"gotcha","affected_versions":">=3.0.0"},{"fix":"Upgrade to the latest stable version of the main `lodash` package (v4.x) to benefit from continuous security maintenance and bug fixes. Avoid using outdated internal modules.","message":"Using older versions of any library, including `lodash` and its internal modules from v3, means foregoing security patches and bug fixes. For example, `lodash` v4.18.0 fixed prototype pollution vulnerabilities in `_.unset` and `_.omit` (GHSA-f23m-r3pf-42rh) which would not be present in a v3 codebase.","severity":"gotcha","affected_versions":">=3.0.0 (all 3.x versions)"}],"env_vars":null,"last_verified":"2026-04-21T00:00:00.000Z","next_check":"2026-07-20T00:00:00.000Z","problems":[{"fix":"Ensure the first argument passed to `arrayEach` is always an array. Example: `arrayEach([], callback);`","cause":"Attempting to call `arrayEach` with a non-array or null/undefined `collection` argument.","error":"TypeError: Cannot read properties of undefined (reading 'call') at Function.arrayEach"},{"fix":"Use the correct CommonJS `require` syntax: `const arrayEach = require('lodash._arrayeach');`","cause":"Incorrectly trying to import `arrayEach` using ES module syntax or destructuring from the CommonJS package.","error":"TypeError: arrayEach is not a function"},{"fix":"Install the package via npm: `npm install --save lodash._arrayeach`","cause":"The package `lodash._arrayeach` has not been installed or is not resolvable in the current environment.","error":"Error: Cannot find module 'lodash._arrayeach'"}],"ecosystem":"npm"}