Like Array.forEach but does not skip holes.
npm install array-all-x href="https://travis-ci.org/Xotic750/array-all-x"
title="Travis status"> src="https://travis-ci.org/Xotic750/array-all-x.svg?branch=master"
alt="Travis status" height="18">
href="https://david-dm.org/Xotic750/array-all-x"
title="Dependency status"> alt="Dependency status" height="18"/>
href="https://david-dm.org/Xotic750/array-all-x?type=dev"
title="devDependency status"> alt="devDependency status" height="18"/>
href="https://badge.fury.io/js/array-all-x"
title="npm version"> alt="npm version" height="18">
href="https://www.jsdelivr.com/package/npm/array-all-x"
title="jsDelivr hits"> alt="jsDelivr hits" height="18">
href="https://bettercodehub.com/results/Xotic750/array-all-x"
title="bettercodehub score"> alt="bettercodehub score" height="18">
href="https://coveralls.io/github/Xotic750/array-all-x?branch=master"
title="Coverage Status"> alt="Coverage Status" height="18">
Like Array.forEach but does not skip holes.
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.
| Param | Type | Description |
| --------- | --------------------- | --------------------------------------------- |
| array | array | The array to iterate over. |
| callBack | function | Function to execute for each element. |
| [thisArg] | \* | Value to use as this when executing callback. |
Example
``js
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']
``