1.0.0 • Published 6 years ago
neach v1.0.0
neach
It’s like .forEach()
, but nested.
Installation
Requires Node.js 6.0.0 or above.
npm i neach
API
The module exports a single function.
Parameters
- Variadic:
...iterables
(one or more of: iterable): The levels of the nested each-loop. cb
(function): A callback which is given one argument for each iterable.
Return Value
None.
Example
Before
for (const message of ['Hello', 'Goodbye']) {
for (const whom of ['world', 'Dolly']) {
for (const punc of ['.', '!']) {
console.log(message + ', ' + whom + punc)
}
}
}
After
const neach = require('neach')
neach(['Hello', 'Goodbye'], ['world', 'Dolly'], ['.', '!'], (message, whom, punc) => {
console.log(message + ', ' + whom + punc)
})
1.0.0
6 years ago