+3
-3
@@ -27,7 +27,7 @@ export type LimitFunction = { | ||
| /** | ||
| Process an array of inputs with limited concurrency. | ||
| Process an iterable of inputs with limited concurrency. | ||
| The mapper function receives the item value and its index. | ||
| @param array - An array containing an argument for the given function. | ||
| @param iterable - An iterable containing an argument for the given function. | ||
| @param mapperFunction - Promise-returning/async function. | ||
@@ -37,3 +37,3 @@ @returns A Promise that returns an array of results. | ||
| map: <Input, ReturnType> ( | ||
| array: readonly Input[], | ||
| iterable: Iterable<Input>, | ||
| mapperFunction: (input: Input, index: number) => PromiseLike<ReturnType> | ReturnType | ||
@@ -40,0 +40,0 @@ ) => Promise<ReturnType[]>; |
+2
-2
@@ -85,4 +85,4 @@ import Queue from 'yocto-queue'; | ||
| map: { | ||
| async value(array, function_) { | ||
| const promises = array.map((value, index) => this(function_, value, index)); | ||
| async value(iterable, function_) { | ||
| const promises = Array.from(iterable, (value, index) => this(function_, value, index)); | ||
| return Promise.all(promises); | ||
@@ -89,0 +89,0 @@ }, |
+1
-2
| { | ||
| "name": "p-limit", | ||
| "version": "7.1.1", | ||
| "version": "7.2.0", | ||
| "description": "Run multiple promise-returning & async functions with limited concurrency", | ||
@@ -52,3 +52,2 @@ "license": "MIT", | ||
| "ava": "^6.4.1", | ||
| "delay": "^6.0.0", | ||
| "in-range": "^3.0.0", | ||
@@ -55,0 +54,0 @@ "random-int": "^3.0.0", |
+3
-3
@@ -60,9 +60,9 @@ # p-limit | ||
| ### limit.map(array, mapperFunction) | ||
| ### limit.map(iterable, mapperFunction) | ||
| Process an array of inputs with limited concurrency. | ||
| Process an iterable of inputs with limited concurrency. | ||
| The mapper function receives the item value and its index. | ||
| Returns a promise equivalent to `Promise.all(array.map((item, index) => limit(mapperFunction, item, index)))`. | ||
| Returns a promise equivalent to `Promise.all(Array.from(iterable, (item, index) => limit(mapperFunction, item, index)))`. | ||
@@ -69,0 +69,0 @@ This is a convenience function for processing inputs that arrive in batches. For more complex use cases, see [p-map](https://github.com/sindresorhus/p-map). |
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
11734
0.18%6
-14.29%