https://github.com/lamansky/neach
[Node.js] It’s like forEach, but nested.
https://github.com/lamansky/neach
Last synced: 3 months ago
JSON representation
[Node.js] It’s like forEach, but nested.
- Host: GitHub
- URL: https://github.com/lamansky/neach
- Owner: lamansky
- License: mit
- Created: 2018-04-16T14:03:11.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2018-04-16T14:04:13.000Z (about 8 years ago)
- Last Synced: 2025-09-22T06:00:42.292Z (9 months ago)
- Language: JavaScript
- Size: 1.95 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: license.txt
Awesome Lists containing this project
README
# neach
It’s like `.forEach()`, but nested.
## Installation
Requires [Node.js](https://nodejs.org/) 6.0.0 or above.
```bash
npm i neach
```
## API
The module exports a single function.
### Parameters
1. Variadic: `...iterables` (one or more of: iterable): The levels of the nested each-loop.
2. `cb` (function): A callback which is given one argument for each iterable.
### Return Value
None.
## Example
### Before
```javascript
for (const message of ['Hello', 'Goodbye']) {
for (const whom of ['world', 'Dolly']) {
for (const punc of ['.', '!']) {
console.log(message + ', ' + whom + punc)
}
}
}
```
### After
```javascript
const neach = require('neach')
neach(['Hello', 'Goodbye'], ['world', 'Dolly'], ['.', '!'], (message, whom, punc) => {
console.log(message + ', ' + whom + punc)
})
```