Lodash Internal `arrayEach` Utility

3.0.0 · abandoned · verified Tue Apr 21

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.

Common errors

Warnings

Install

Imports

Quickstart

Demonstrates how to import and use the internal `arrayEach` function to iterate over an array.

const arrayEach = require('lodash._arrayeach');

const numbers = [10, 20, 30, 40, 50];
const doubledNumbers = [];

console.log('Original numbers:', numbers);

arrayEach(numbers, (value, index) => {
  doubledNumbers[index] = value * 2;
});

console.log('Doubled numbers:', doubledNumbers);

// Demonstrating the internal nature: it's not the public _.forEach
const sparseArray = [1, , 3]; // eslint-disable-line no-sparse-arrays
const resultSparse = [];
arrayEach(sparseArray, (value) => resultSparse.push(value === undefined ? 'undefined' : value));
console.log('ArrayEach on sparse array (handles undefined):', resultSparse);

view raw JSON →