apr-for-each
Advanced tools
Comparing version 1.0.2 to 1.0.3
26
index.js
const each = require('apr-engine-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) | ||
* | ||
* @kind function | ||
* @name for-each | ||
* @param {Array|Object|Iterable} input | ||
* @param {Function} iteratee | ||
* @returns {Promise} | ||
* | ||
* @example | ||
* 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') | ||
* ); | ||
*/ | ||
module.exports = (input, fn, opts) => { | ||
@@ -4,0 +30,0 @@ return each({ |
const defaults = require('lodash.defaults'); | ||
const each = require('apr-engine-each'); | ||
/** | ||
* @kind function | ||
* @name limit | ||
* @memberof for-each | ||
* @param {Array|Object|Iterable} input | ||
* @param {Number} limit | ||
* @param {Function} iteratee | ||
* @returns {Promise} | ||
*/ | ||
module.exports = (input, limit, fn, opts) => { | ||
@@ -5,0 +14,0 @@ return each({ |
{ | ||
"name": "apr-for-each", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"homepage": "https://github.com/ramitos/apr/tree/master/packages/for-each", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
const limit = require('./limit'); | ||
/** | ||
* @kind function | ||
* @name series | ||
* @memberof for-each | ||
* @param {Array|Object|Iterable} input | ||
* @param {Function} iteratee | ||
* @returns {Promise} | ||
*/ | ||
module.exports = (input, fn, opts) => { | ||
return limit(input, 1, fn, opts); | ||
}; |
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Found 1 instance in 1 package
4405
5
68
1
52