A tiny, faster alternative to native
Array.prototype.forEach
@arr/foreach
does not support the optional thisArg
parameter!
$ npm install --save @arr/foreach
import forEach from '@arr/foreach';
forEach(['a', 'b', 'c'], val => {
console.log(val);
});
//=> a
//=> b
//=> c
Type: Array
The array to iterate upon.
Type: Function
Function to test for each element, taking three arguments:
- value (required) -- The current element being processed in the array.
- index (optional) -- The index of the current element being processed in the array.
- array (optional) -- The array
forEach
was called upon.
MIT © Luke Edwards