it-parallel-batch
Advanced tools
Comparing version 1.0.0 to 1.0.1
@@ -6,2 +6,6 @@ 'use strict' | ||
async function * parallelBatch (source, size) { | ||
if (isNaN(size)) { | ||
size = 1 | ||
} | ||
for await (const things of batch(source, size)) { | ||
@@ -8,0 +12,0 @@ const results = [] |
{ | ||
"name": "it-parallel-batch", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "Takes an async iterator that emits promise-returning functions, invokes them in parallel and emits the results in the same order as the input", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
19
test.js
@@ -116,1 +116,20 @@ 'use strict' | ||
}) | ||
test('Should work without size parameter', async (t) => { | ||
const input = [ | ||
async () => { | ||
await delay(200) | ||
return 1 | ||
}, | ||
async () => { | ||
await delay(100) | ||
return 2 | ||
} | ||
] | ||
const res = await all(parallelBatch(input)) | ||
t.deepEqual(res, [1, 2]) | ||
}) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
5667
5
151