A javascript library for working with objects
Iterate over the values of multiple arrays
Param | Type | Default | Description |
---|---|---|---|
arrays | array |
||
callback | function |
Provides one item from each array. | |
[accrue] | boolean |
false |
If true then each successive array in arrays will start it's loop on the next index instead of 0. |
Example
import { nestedEach } from 'object-agent';
const output = [];
const save = (item1, item2) => output.push([item1, item2]);
nestedEach([[1, 2], ['a', 'b']], save);
console.log(output);
// => [[1, 'a'], [1, 'b'], [2, 'a'], [2, 'b']]