promise.allsettled
Advanced tools
Comparing version 1.0.0 to 1.0.1
@@ -0,3 +1,7 @@ | ||
v1.0.1 / 2019-05-06 | ||
================= | ||
* [Fix] when a promise has a poisoned `.then` method, reject the overarching promise (#1) | ||
v1.0.0 / 2019-03-27 | ||
================= | ||
* Initial release. |
@@ -12,2 +12,3 @@ 'use strict'; | ||
var all = bind.call(Function.call, getIntrinsic('%Promise_all%')); | ||
var reject = bind.call(Function.call, getIntrinsic('%Promise_reject%')); | ||
@@ -27,4 +28,8 @@ module.exports = function allSettled(iterable) { | ||
var itemPromise = ES.PromiseResolve(C, item); | ||
return itemPromise.then(onFulfill, onReject); | ||
try { | ||
return itemPromise.then(onFulfill, onReject); | ||
} catch (e) { | ||
return reject(C, e); | ||
} | ||
})); | ||
}; |
{ | ||
"name": "promise.allsettled", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"author": "Jordan Harband", | ||
@@ -63,3 +63,3 @@ "contributors": [ | ||
"es6-shim": "^0.35.5", | ||
"eslint": "^5.15.3", | ||
"eslint": "^5.16.0", | ||
"safe-publish-latest": "^1.1.2", | ||
@@ -66,0 +66,0 @@ "tape": "^4.10.1" |
@@ -84,2 +84,13 @@ 'use strict'; | ||
t.test('poisoned .then', function (st) { | ||
st.plan(1); | ||
var promise = new Promise(function () {}); | ||
promise.then = function () { throw new EvalError(); }; | ||
allSettled([promise]).then(function () { | ||
st.fail('should not reach here'); | ||
}, function (reason) { | ||
st.equal(reason instanceof EvalError, true, 'expected error was thrown'); | ||
}); | ||
}); | ||
var Subclass = (function () { | ||
@@ -86,0 +97,0 @@ try { |
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
246
21694