streamiterator
Advanced tools
Comparing version 1.0.17 to 1.1.0
@@ -73,2 +73,14 @@ "use strict"; | ||
function afterCurrentResolvers(callback) { | ||
if (resolvers.length === 0) { | ||
callback(); | ||
} else { | ||
var last = resolvers.pop(); | ||
resolvers.push(function (value) { | ||
last(value); | ||
callback(); | ||
}); | ||
} | ||
} | ||
stream // | ||
@@ -84,18 +96,17 @@ .on("data", onData).on("error", onError).on("end", onEnd).pause(); | ||
}); | ||
}), _defineProperty(_result, "throw", function _throw(error) { | ||
return new Promise(function (resolve) { | ||
afterCurrentResolvers(function () { | ||
stream.emit("error", error); | ||
}); | ||
resolvers.push(resolve); | ||
copyResults(); | ||
}); | ||
}), _defineProperty(_result, "return", function _return(value) { | ||
return new Promise(function (resolve) { | ||
if (resolvers.length === 0) { | ||
finish(); | ||
} else { | ||
var last = resolvers.pop(); | ||
resolvers.push(function (value) { | ||
last(value); | ||
finish(); | ||
}); | ||
} | ||
function finish() { | ||
afterCurrentResolvers(function () { | ||
outputClosed = true; | ||
resolve({ value: value, done: true }); | ||
close(); | ||
} | ||
}); | ||
}); | ||
@@ -102,0 +113,0 @@ }), _result); |
{ | ||
"name": "streamiterator", | ||
"version": "1.0.17", | ||
"version": "1.1.0", | ||
"description": "converts ReadableStream into AsyncIterator", | ||
@@ -5,0 +5,0 @@ "main": "distr/streamiterator.js", |
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
113319
120