it-parallel
Advanced tools
Comparing version 2.0.0 to 2.0.1
21
index.js
@@ -47,3 +47,2 @@ 'use strict' | ||
resultAvailable.resolve() | ||
resultAvailable = defer() | ||
}) | ||
@@ -55,2 +54,3 @@ | ||
if (ops.length === concurrency) { | ||
slotAvailable = defer() | ||
await slotAvailable.promise | ||
@@ -92,2 +92,10 @@ } | ||
function valuesAvailable () { | ||
if (ordered) { | ||
return Boolean(ops[0] && ops[0].done) | ||
} | ||
return Boolean(ops.find(op => op.done)) | ||
} | ||
function * yieldOrderedValues () { | ||
@@ -109,3 +117,2 @@ while (ops.length && ops[0].done) { | ||
slotAvailable.resolve() | ||
slotAvailable = defer() | ||
} | ||
@@ -115,6 +122,2 @@ } | ||
function * yieldUnOrderedValues () { | ||
function valuesAvailable () { | ||
return Boolean(ops.find(op => op.done)) | ||
} | ||
// more values can become available while we wait for `yield` | ||
@@ -139,3 +142,2 @@ // to return control to this function | ||
slotAvailable.resolve() | ||
slotAvailable = defer() | ||
} | ||
@@ -147,3 +149,6 @@ } | ||
while (true) { | ||
await resultAvailable.promise | ||
if (!valuesAvailable()) { | ||
resultAvailable = defer() | ||
await resultAvailable.promise | ||
} | ||
@@ -150,0 +155,0 @@ if (sourceErr) { |
{ | ||
"name": "it-parallel", | ||
"version": "2.0.0", | ||
"version": "2.0.1", | ||
"description": "Takes an (async) iterable that emits promise-returning functions, invokes them in parallel up to the concurrency limit and emits the results as they become available, optionally in the same order as the input", | ||
@@ -24,3 +24,3 @@ "main": "index.js", | ||
"delay": "^4.3.0", | ||
"it-all": "^1.0.5", | ||
"it-all": "^1.0.6", | ||
"nyc": "^15.1.0", | ||
@@ -41,3 +41,3 @@ "standard": "^16.0.3", | ||
}, | ||
"gitHead": "77529aac7ccee95deb23ca07e7cec59b3ef59948" | ||
"gitHead": "29126fa87dae108acef381693812f22ac8f9362b" | ||
} |
# it-parallel | ||
[![Build status](https://travis-ci.org/achingbrain/it.svg?branch=master)](https://travis-ci.org/achingbrain/it?branch=master) [![Coverage Status](https://coveralls.io/repos/github/achingbrain/it/badge.svg?branch=master)](https://coveralls.io/github/achingbrain/it?branch=master) [![Dependencies Status](https://david-dm.org/achingbrain/it/status.svg?path=packages/it-parallel)](https://david-dm.org/achingbrain/it?path=packages/it-parallel) | ||
[![Build status](https://github.com/achingbrain/it/actions/workflows/test.yml/badge.svg?branch=master)](https://github.com/achingbrain/it/actions/workflows/test.yml) [![Coverage Status](https://coveralls.io/repos/github/achingbrain/it/badge.svg?branch=master)](https://coveralls.io/github/achingbrain/it?branch=master) [![Dependencies Status](https://david-dm.org/achingbrain/it/status.svg?path=packages/it-parallel)](https://david-dm.org/achingbrain/it?path=packages/it-parallel) | ||
@@ -5,0 +5,0 @@ > Takes an (async) iterable that emits promise-returning functions, invokes them in parallel up to the concurrency limit and emits the results as they become available, optionally in the same order as the input |
Sorry, the diff of this file is not supported yet
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
12843
386