1.1.2 • Published 5 years ago

array-all-x v1.1.2

Weekly downloads
776
License
MIT
Repository
github
Last release
5 years ago

array-all-x

Like Array.forEach but does not skip holes.

module.exports

This method executes a provided function once for each array element.

Kind: Exported member
Throws:

  • TypeError If array is null or undefined.
  • TypeError If callBack is not a function.
ParamTypeDescription
arrayarrayThe array to iterate over.
callBackfunctionFunction to execute for each element.
thisArg*Value to use as this when executing callback.

Example

import all from 'array-all-x';

const items = ['item1', 'item2', 'item3'];
const copy = [];

all(items, function(item) {
  copy.push(item);
});

console.log(copy); // ['item1', 'item2', 'item3']