UNPKG

apr-for-each

Version:

Applies the function iteratee to each item in coll, in parallel.

52 lines (33 loc) 2.19 kB
<!-- Generated by documentation.js. Update this documentation by updating the source code. --> ## for-each <a id="for-each"></a> Applies the function `iteratee` to each item in `coll`, in parallel. [![](https://img.shields.io/npm/v/apr-for-each.svg?style=flat-square)](https://www.npmjs.com/package/apr-for-each) [![](https://img.shields.io/npm/l/apr-for-each.svg?style=flat-square)](https://www.npmjs.com/package/apr-for-each) **Parameters** - `input` **([Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array) \| [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object) | Iterable)** - `iteratee` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** **Examples** ```javascript import awaitify from 'apr-awaitify'; import forEach from 'apr-for-each'; const writeFile = awaitify(fs.writeFile); const files = [ '/home/.vimrc', '/home/.zshrc' ]; await forEach(files, async (file) => await writeFile(file, 'boom') ); ``` Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)** ### series **Parameters** - `input` **([Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array) \| [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object) | Iterable)** - `iteratee` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)** ### limit **Parameters** - `input` **([Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array) \| [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object) | Iterable)** - `limit` **[Number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** - `iteratee` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)**