Skip to content
This repository has been archived by the owner on Apr 1, 2023. It is now read-only.

Latest commit

 

History

History
52 lines (41 loc) · 2.13 KB

nestedEach.md

File metadata and controls

52 lines (41 loc) · 2.13 KB

Object Agent

A javascript library for working with objects

npm build coverage deps size vulnerabilities license


nestedEach(arrays, callback, [accrue]) ⇒ array

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']]