feat(async-each): add basic JsDoc typing

This commit is contained in:
Julien Fontanet 2022-07-04 17:37:52 +02:00
parent a6fee2946a
commit dfce56cee8

View File

@ -9,6 +9,12 @@ class AggregateError extends Error {
}
}
/**
* @template Item
* @param {Iterable<Item>} iterable
* @param {(item: Item, index: number, iterable: Iterable<Item>) => Promise<void>} iteratee
* @returns {Promise<void>}
*/
exports.asyncEach = function asyncEach(iterable, iteratee, { concurrency = 1, signal, stopOnError = true } = {}) {
if (concurrency === 0) {
concurrency = Infinity