es6-promise
Advanced tools
Comparing version 4.2.2 to 4.2.3
# Master | ||
# 4.2.3 | ||
* Cleanup testem related build configuration | ||
* Use `prepublishOnly` instead of `prepublish` (thanks @rhysd) | ||
* Add Node.js 9, 8 to testing matrix | ||
* drop now unused s3 deployment files | ||
* internal cleanup (thanks to @bekzod, @mariusschulz) | ||
* Fixup Changelog | ||
# 4.2.2 | ||
* Ensure PROMISE_ID works correctly | ||
* internal cleanup (thanks yo @mariusschulz) | ||
# 4.2.1 | ||
* drop bower support | ||
# 4.2.0 | ||
* drop `dist` from git repo | ||
* add `Promise.prototype.finally` | ||
* update various build related dependencies | ||
* add CDN links | ||
# 4.1.0 | ||
@@ -4,0 +29,0 @@ |
@@ -6,3 +6,3 @@ /*! | ||
* See https://raw.githubusercontent.com/stefanpenner/es6-promise/master/LICENSE | ||
* @version v4.2.2+97478eb6 | ||
* @version v4.2.3+b33f4734 | ||
*/ | ||
@@ -231,3 +231,3 @@ | ||
var PROMISE_ID = Math.random().toString(36).substring(16); | ||
var PROMISE_ID = Math.random().toString(36).substring(2); | ||
@@ -240,3 +240,3 @@ function noop() {} | ||
var GET_THEN_ERROR = new ErrorObject(); | ||
var TRY_CATCH_ERROR = { error: null }; | ||
@@ -255,4 +255,4 @@ function selfFulfillment() { | ||
} catch (error) { | ||
GET_THEN_ERROR.error = error; | ||
return GET_THEN_ERROR; | ||
TRY_CATCH_ERROR.error = error; | ||
return TRY_CATCH_ERROR; | ||
} | ||
@@ -316,5 +316,5 @@ } | ||
} else { | ||
if (then$$1 === GET_THEN_ERROR) { | ||
reject(promise, GET_THEN_ERROR.error); | ||
GET_THEN_ERROR.error = null; | ||
if (then$$1 === TRY_CATCH_ERROR) { | ||
reject(promise, TRY_CATCH_ERROR.error); | ||
TRY_CATCH_ERROR.error = null; | ||
} else if (then$$1 === undefined) { | ||
@@ -413,8 +413,2 @@ fulfill(promise, maybeThenable); | ||
function ErrorObject() { | ||
this.error = null; | ||
} | ||
var TRY_CATCH_ERROR = new ErrorObject(); | ||
function tryCatch(callback, detail) { | ||
@@ -497,6 +491,2 @@ try { | ||
function validationError() { | ||
return new Error('Array Methods must be provided an Array'); | ||
} | ||
var Enumerator = function () { | ||
@@ -1155,32 +1145,32 @@ function Enumerator(Constructor, input) { | ||
function polyfill() { | ||
var local = void 0; | ||
var local = void 0; | ||
if (typeof global !== 'undefined') { | ||
local = global; | ||
} else if (typeof self !== 'undefined') { | ||
local = self; | ||
} else { | ||
try { | ||
local = Function('return this')(); | ||
} catch (e) { | ||
throw new Error('polyfill failed because global object is unavailable in this environment'); | ||
} | ||
if (typeof global !== 'undefined') { | ||
local = global; | ||
} else if (typeof self !== 'undefined') { | ||
local = self; | ||
} else { | ||
try { | ||
local = Function('return this')(); | ||
} catch (e) { | ||
throw new Error('polyfill failed because global object is unavailable in this environment'); | ||
} | ||
} | ||
var P = local.Promise; | ||
var P = local.Promise; | ||
if (P) { | ||
var promiseToString = null; | ||
try { | ||
promiseToString = Object.prototype.toString.call(P.resolve()); | ||
} catch (e) { | ||
// silently ignored | ||
} | ||
if (P) { | ||
var promiseToString = null; | ||
try { | ||
promiseToString = Object.prototype.toString.call(P.resolve()); | ||
} catch (e) { | ||
// silently ignored | ||
} | ||
if (promiseToString === '[object Promise]' && !P.cast) { | ||
return; | ||
} | ||
if (promiseToString === '[object Promise]' && !P.cast) { | ||
return; | ||
} | ||
} | ||
local.Promise = Promise$2; | ||
local.Promise = Promise$2; | ||
} | ||
@@ -1187,0 +1177,0 @@ |
@@ -1,1 +0,1 @@ | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.ES6Promise=e()}(this,function(){"use strict";function t(t){var e=typeof t;return null!==t&&("object"===e||"function"===e)}function e(t){return"function"==typeof t}function n(t){G=t}function r(t){H=t}function o(){return function(){return process.nextTick(a)}}function i(){return"undefined"!=typeof B?function(){B(a)}:c()}function s(){var t=0,e=new Q(a),n=document.createTextNode("");return e.observe(n,{characterData:!0}),function(){n.data=t=++t%2}}function u(){var t=new MessageChannel;return t.port1.onmessage=a,function(){return t.port2.postMessage(0)}}function c(){var t=setTimeout;return function(){return t(a,1)}}function a(){for(var t=0;t<z;t+=2){var e=X[t],n=X[t+1];e(n),X[t]=void 0,X[t+1]=void 0}z=0}function f(){try{var t=require,e=t("vertx");return B=e.runOnLoop||e.runOnContext,i()}catch(n){return c()}}function l(t,e){var n=this,r=new this.constructor(p);void 0===r[$]&&k(r);var o=n._state;if(o){var i=arguments[o-1];H(function(){return x(o,r,i,n._result)})}else E(n,r,t,e);return r}function h(t){var e=this;if(t&&"object"==typeof t&&t.constructor===e)return t;var n=new e(p);return g(n,t),n}function p(){}function v(){return new TypeError("You cannot resolve a promise with itself")}function d(){return new TypeError("A promises callback cannot return that same promise.")}function _(t){try{return t.then}catch(e){return rt.error=e,rt}}function y(t,e,n,r){try{t.call(e,n,r)}catch(o){return o}}function m(t,e,n){H(function(t){var r=!1,o=y(n,e,function(n){r||(r=!0,e!==n?g(t,n):S(t,n))},function(e){r||(r=!0,j(t,e))},"Settle: "+(t._label||" unknown promise"));!r&&o&&(r=!0,j(t,o))},t)}function b(t,e){e._state===et?S(t,e._result):e._state===nt?j(t,e._result):E(e,void 0,function(e){return g(t,e)},function(e){return j(t,e)})}function w(t,n,r){n.constructor===t.constructor&&r===l&&n.constructor.resolve===h?b(t,n):r===rt?(j(t,rt.error),rt.error=null):void 0===r?S(t,n):e(r)?m(t,n,r):S(t,n)}function g(e,n){e===n?j(e,v()):t(n)?w(e,n,_(n)):S(e,n)}function A(t){t._onerror&&t._onerror(t._result),M(t)}function S(t,e){t._state===tt&&(t._result=e,t._state=et,0!==t._subscribers.length&&H(M,t))}function j(t,e){t._state===tt&&(t._state=nt,t._result=e,H(A,t))}function E(t,e,n,r){var o=t._subscribers,i=o.length;t._onerror=null,o[i]=e,o[i+et]=n,o[i+nt]=r,0===i&&t._state&&H(M,t)}function M(t){var e=t._subscribers,n=t._state;if(0!==e.length){for(var r=void 0,o=void 0,i=t._result,s=0;s<e.length;s+=3)r=e[s],o=e[s+n],r?x(n,r,o,i):o(i);t._subscribers.length=0}}function T(){this.error=null}function P(t,e){try{return t(e)}catch(n){return ot.error=n,ot}}function x(t,n,r,o){var i=e(r),s=void 0,u=void 0,c=void 0,a=void 0;if(i){if(s=P(r,o),s===ot?(a=!0,u=s.error,s.error=null):c=!0,n===s)return void j(n,d())}else s=o,c=!0;n._state!==tt||(i&&c?g(n,s):a?j(n,u):t===et?S(n,s):t===nt&&j(n,s))}function C(t,e){try{e(function(e){g(t,e)},function(e){j(t,e)})}catch(n){j(t,n)}}function O(){return it++}function k(t){t[$]=it++,t._state=void 0,t._result=void 0,t._subscribers=[]}function Y(){return new Error("Array Methods must be provided an Array")}function Y(){return new Error("Array Methods must be provided an Array")}function q(t){return new st(this,t).promise}function F(t){var e=this;return new e(W(t)?function(n,r){for(var o=t.length,i=0;i<o;i++)e.resolve(t[i]).then(n,r)}:function(t,e){return e(new TypeError("You must pass an array to race."))})}function D(t){var e=this,n=new e(p);return j(n,t),n}function K(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}function L(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}function N(){var t=void 0;if("undefined"!=typeof global)t=global;else if("undefined"!=typeof self)t=self;else try{t=Function("return this")()}catch(e){throw new Error("polyfill failed because global object is unavailable in this environment")}var n=t.Promise;if(n){var r=null;try{r=Object.prototype.toString.call(n.resolve())}catch(e){}if("[object Promise]"===r&&!n.cast)return}t.Promise=ut}var U=void 0;U=Array.isArray?Array.isArray:function(t){return"[object Array]"===Object.prototype.toString.call(t)};var W=U,z=0,B=void 0,G=void 0,H=function(t,e){X[z]=t,X[z+1]=e,z+=2,2===z&&(G?G(a):Z())},I="undefined"!=typeof window?window:void 0,J=I||{},Q=J.MutationObserver||J.WebKitMutationObserver,R="undefined"==typeof self&&"undefined"!=typeof process&&"[object process]"==={}.toString.call(process),V="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel,X=new Array(1e3),Z=void 0;Z=R?o():Q?s():V?u():void 0===I&&"function"==typeof require?f():c();var $=Math.random().toString(36).substring(16),tt=void 0,et=1,nt=2,rt=new T,ot=new T,it=0,st=function(){function t(t,e){this._instanceConstructor=t,this.promise=new t(p),this.promise[$]||k(this.promise),W(e)?(this.length=e.length,this._remaining=e.length,this._result=new Array(this.length),0===this.length?S(this.promise,this._result):(this.length=this.length||0,this._enumerate(e),0===this._remaining&&S(this.promise,this._result))):j(this.promise,Y())}return t.prototype._enumerate=function(t){for(var e=0;this._state===tt&&e<t.length;e++)this._eachEntry(t[e],e)},t.prototype._eachEntry=function(t,e){var n=this._instanceConstructor,r=n.resolve;if(r===h){var o=_(t);if(o===l&&t._state!==tt)this._settledAt(t._state,e,t._result);else if("function"!=typeof o)this._remaining--,this._result[e]=t;else if(n===ut){var i=new n(p);w(i,t,o),this._willSettleAt(i,e)}else this._willSettleAt(new n(function(e){return e(t)}),e)}else this._willSettleAt(r(t),e)},t.prototype._settledAt=function(t,e,n){var r=this.promise;r._state===tt&&(this._remaining--,t===nt?j(r,n):this._result[e]=n),0===this._remaining&&S(r,this._result)},t.prototype._willSettleAt=function(t,e){var n=this;E(t,void 0,function(t){return n._settledAt(et,e,t)},function(t){return n._settledAt(nt,e,t)})},t}(),ut=function(){function t(e){this[$]=O(),this._result=this._state=void 0,this._subscribers=[],p!==e&&("function"!=typeof e&&K(),this instanceof t?C(this,e):L())}return t.prototype["catch"]=function(t){return this.then(null,t)},t.prototype["finally"]=function(t){var e=this,n=e.constructor;return e.then(function(e){return n.resolve(t()).then(function(){return e})},function(e){return n.resolve(t()).then(function(){throw e})})},t}();return ut.prototype.then=l,ut.all=q,ut.race=F,ut.resolve=h,ut.reject=D,ut._setScheduler=n,ut._setAsap=r,ut._asap=H,ut.polyfill=N,ut.Promise=ut,ut.polyfill(),ut}); | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.ES6Promise=e()}(this,function(){"use strict";function t(t){var e=typeof t;return null!==t&&("object"===e||"function"===e)}function e(t){return"function"==typeof t}function n(t){B=t}function r(t){G=t}function o(){return function(){return process.nextTick(a)}}function i(){return"undefined"!=typeof z?function(){z(a)}:c()}function s(){var t=0,e=new J(a),n=document.createTextNode("");return e.observe(n,{characterData:!0}),function(){n.data=t=++t%2}}function u(){var t=new MessageChannel;return t.port1.onmessage=a,function(){return t.port2.postMessage(0)}}function c(){var t=setTimeout;return function(){return t(a,1)}}function a(){for(var t=0;t<W;t+=2){var e=V[t],n=V[t+1];e(n),V[t]=void 0,V[t+1]=void 0}W=0}function f(){try{var t=require,e=t("vertx");return z=e.runOnLoop||e.runOnContext,i()}catch(n){return c()}}function l(t,e){var n=this,r=new this.constructor(p);void 0===r[Z]&&O(r);var o=n._state;if(o){var i=arguments[o-1];G(function(){return P(o,r,i,n._result)})}else E(n,r,t,e);return r}function h(t){var e=this;if(t&&"object"==typeof t&&t.constructor===e)return t;var n=new e(p);return g(n,t),n}function p(){}function v(){return new TypeError("You cannot resolve a promise with itself")}function d(){return new TypeError("A promises callback cannot return that same promise.")}function _(t){try{return t.then}catch(e){return nt.error=e,nt}}function y(t,e,n,r){try{t.call(e,n,r)}catch(o){return o}}function m(t,e,n){G(function(t){var r=!1,o=y(n,e,function(n){r||(r=!0,e!==n?g(t,n):S(t,n))},function(e){r||(r=!0,j(t,e))},"Settle: "+(t._label||" unknown promise"));!r&&o&&(r=!0,j(t,o))},t)}function b(t,e){e._state===tt?S(t,e._result):e._state===et?j(t,e._result):E(e,void 0,function(e){return g(t,e)},function(e){return j(t,e)})}function w(t,n,r){n.constructor===t.constructor&&r===l&&n.constructor.resolve===h?b(t,n):r===nt?(j(t,nt.error),nt.error=null):void 0===r?S(t,n):e(r)?m(t,n,r):S(t,n)}function g(e,n){e===n?j(e,v()):t(n)?w(e,n,_(n)):S(e,n)}function A(t){t._onerror&&t._onerror(t._result),T(t)}function S(t,e){t._state===$&&(t._result=e,t._state=tt,0!==t._subscribers.length&&G(T,t))}function j(t,e){t._state===$&&(t._state=et,t._result=e,G(A,t))}function E(t,e,n,r){var o=t._subscribers,i=o.length;t._onerror=null,o[i]=e,o[i+tt]=n,o[i+et]=r,0===i&&t._state&&G(T,t)}function T(t){var e=t._subscribers,n=t._state;if(0!==e.length){for(var r=void 0,o=void 0,i=t._result,s=0;s<e.length;s+=3)r=e[s],o=e[s+n],r?P(n,r,o,i):o(i);t._subscribers.length=0}}function M(t,e){try{return t(e)}catch(n){return nt.error=n,nt}}function P(t,n,r,o){var i=e(r),s=void 0,u=void 0,c=void 0,a=void 0;if(i){if(s=M(r,o),s===nt?(a=!0,u=s.error,s.error=null):c=!0,n===s)return void j(n,d())}else s=o,c=!0;n._state!==$||(i&&c?g(n,s):a?j(n,u):t===tt?S(n,s):t===et&&j(n,s))}function x(t,e){try{e(function(e){g(t,e)},function(e){j(t,e)})}catch(n){j(t,n)}}function C(){return rt++}function O(t){t[Z]=rt++,t._state=void 0,t._result=void 0,t._subscribers=[]}function k(){return new Error("Array Methods must be provided an Array")}function Y(t){return new ot(this,t).promise}function q(t){var e=this;return new e(U(t)?function(n,r){for(var o=t.length,i=0;i<o;i++)e.resolve(t[i]).then(n,r)}:function(t,e){return e(new TypeError("You must pass an array to race."))})}function F(t){var e=this,n=new e(p);return j(n,t),n}function D(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}function K(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}function L(){var t=void 0;if("undefined"!=typeof global)t=global;else if("undefined"!=typeof self)t=self;else try{t=Function("return this")()}catch(e){throw new Error("polyfill failed because global object is unavailable in this environment")}var n=t.Promise;if(n){var r=null;try{r=Object.prototype.toString.call(n.resolve())}catch(e){}if("[object Promise]"===r&&!n.cast)return}t.Promise=it}var N=void 0;N=Array.isArray?Array.isArray:function(t){return"[object Array]"===Object.prototype.toString.call(t)};var U=N,W=0,z=void 0,B=void 0,G=function(t,e){V[W]=t,V[W+1]=e,W+=2,2===W&&(B?B(a):X())},H="undefined"!=typeof window?window:void 0,I=H||{},J=I.MutationObserver||I.WebKitMutationObserver,Q="undefined"==typeof self&&"undefined"!=typeof process&&"[object process]"==={}.toString.call(process),R="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel,V=new Array(1e3),X=void 0;X=Q?o():J?s():R?u():void 0===H&&"function"==typeof require?f():c();var Z=Math.random().toString(36).substring(2),$=void 0,tt=1,et=2,nt={error:null},rt=0,ot=function(){function t(t,e){this._instanceConstructor=t,this.promise=new t(p),this.promise[Z]||O(this.promise),U(e)?(this.length=e.length,this._remaining=e.length,this._result=new Array(this.length),0===this.length?S(this.promise,this._result):(this.length=this.length||0,this._enumerate(e),0===this._remaining&&S(this.promise,this._result))):j(this.promise,k())}return t.prototype._enumerate=function(t){for(var e=0;this._state===$&&e<t.length;e++)this._eachEntry(t[e],e)},t.prototype._eachEntry=function(t,e){var n=this._instanceConstructor,r=n.resolve;if(r===h){var o=_(t);if(o===l&&t._state!==$)this._settledAt(t._state,e,t._result);else if("function"!=typeof o)this._remaining--,this._result[e]=t;else if(n===it){var i=new n(p);w(i,t,o),this._willSettleAt(i,e)}else this._willSettleAt(new n(function(e){return e(t)}),e)}else this._willSettleAt(r(t),e)},t.prototype._settledAt=function(t,e,n){var r=this.promise;r._state===$&&(this._remaining--,t===et?j(r,n):this._result[e]=n),0===this._remaining&&S(r,this._result)},t.prototype._willSettleAt=function(t,e){var n=this;E(t,void 0,function(t){return n._settledAt(tt,e,t)},function(t){return n._settledAt(et,e,t)})},t}(),it=function(){function t(e){this[Z]=C(),this._result=this._state=void 0,this._subscribers=[],p!==e&&("function"!=typeof e&&D(),this instanceof t?x(this,e):K())}return t.prototype["catch"]=function(t){return this.then(null,t)},t.prototype["finally"]=function(t){var e=this,n=e.constructor;return e.then(function(e){return n.resolve(t()).then(function(){return e})},function(e){return n.resolve(t()).then(function(){throw e})})},t}();return it.prototype.then=l,it.all=Y,it.race=q,it.resolve=h,it.reject=F,it._setScheduler=n,it._setAsap=r,it._asap=G,it.polyfill=L,it.Promise=it,it.polyfill(),it}); |
@@ -6,3 +6,3 @@ /*! | ||
* See https://raw.githubusercontent.com/stefanpenner/es6-promise/master/LICENSE | ||
* @version v4.2.2+97478eb6 | ||
* @version v4.2.3+b33f4734 | ||
*/ | ||
@@ -231,3 +231,3 @@ | ||
var PROMISE_ID = Math.random().toString(36).substring(16); | ||
var PROMISE_ID = Math.random().toString(36).substring(2); | ||
@@ -240,3 +240,3 @@ function noop() {} | ||
var GET_THEN_ERROR = new ErrorObject(); | ||
var TRY_CATCH_ERROR = { error: null }; | ||
@@ -255,4 +255,4 @@ function selfFulfillment() { | ||
} catch (error) { | ||
GET_THEN_ERROR.error = error; | ||
return GET_THEN_ERROR; | ||
TRY_CATCH_ERROR.error = error; | ||
return TRY_CATCH_ERROR; | ||
} | ||
@@ -316,5 +316,5 @@ } | ||
} else { | ||
if (then$$1 === GET_THEN_ERROR) { | ||
reject(promise, GET_THEN_ERROR.error); | ||
GET_THEN_ERROR.error = null; | ||
if (then$$1 === TRY_CATCH_ERROR) { | ||
reject(promise, TRY_CATCH_ERROR.error); | ||
TRY_CATCH_ERROR.error = null; | ||
} else if (then$$1 === undefined) { | ||
@@ -413,8 +413,2 @@ fulfill(promise, maybeThenable); | ||
function ErrorObject() { | ||
this.error = null; | ||
} | ||
var TRY_CATCH_ERROR = new ErrorObject(); | ||
function tryCatch(callback, detail) { | ||
@@ -497,6 +491,2 @@ try { | ||
function validationError() { | ||
return new Error('Array Methods must be provided an Array'); | ||
} | ||
var Enumerator = function () { | ||
@@ -1155,32 +1145,32 @@ function Enumerator(Constructor, input) { | ||
function polyfill() { | ||
var local = void 0; | ||
var local = void 0; | ||
if (typeof global !== 'undefined') { | ||
local = global; | ||
} else if (typeof self !== 'undefined') { | ||
local = self; | ||
} else { | ||
try { | ||
local = Function('return this')(); | ||
} catch (e) { | ||
throw new Error('polyfill failed because global object is unavailable in this environment'); | ||
} | ||
if (typeof global !== 'undefined') { | ||
local = global; | ||
} else if (typeof self !== 'undefined') { | ||
local = self; | ||
} else { | ||
try { | ||
local = Function('return this')(); | ||
} catch (e) { | ||
throw new Error('polyfill failed because global object is unavailable in this environment'); | ||
} | ||
} | ||
var P = local.Promise; | ||
var P = local.Promise; | ||
if (P) { | ||
var promiseToString = null; | ||
try { | ||
promiseToString = Object.prototype.toString.call(P.resolve()); | ||
} catch (e) { | ||
// silently ignored | ||
} | ||
if (P) { | ||
var promiseToString = null; | ||
try { | ||
promiseToString = Object.prototype.toString.call(P.resolve()); | ||
} catch (e) { | ||
// silently ignored | ||
} | ||
if (promiseToString === '[object Promise]' && !P.cast) { | ||
return; | ||
} | ||
if (promiseToString === '[object Promise]' && !P.cast) { | ||
return; | ||
} | ||
} | ||
local.Promise = Promise$1; | ||
local.Promise = Promise$1; | ||
} | ||
@@ -1187,0 +1177,0 @@ |
@@ -1,1 +0,1 @@ | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.ES6Promise=e()}(this,function(){"use strict";function t(t){var e=typeof t;return null!==t&&("object"===e||"function"===e)}function e(t){return"function"==typeof t}function n(t){G=t}function r(t){H=t}function o(){return function(){return process.nextTick(a)}}function i(){return"undefined"!=typeof B?function(){B(a)}:c()}function s(){var t=0,e=new Q(a),n=document.createTextNode("");return e.observe(n,{characterData:!0}),function(){n.data=t=++t%2}}function u(){var t=new MessageChannel;return t.port1.onmessage=a,function(){return t.port2.postMessage(0)}}function c(){var t=setTimeout;return function(){return t(a,1)}}function a(){for(var t=0;t<z;t+=2){var e=X[t],n=X[t+1];e(n),X[t]=void 0,X[t+1]=void 0}z=0}function f(){try{var t=require,e=t("vertx");return B=e.runOnLoop||e.runOnContext,i()}catch(n){return c()}}function l(t,e){var n=this,r=new this.constructor(p);void 0===r[$]&&k(r);var o=n._state;if(o){var i=arguments[o-1];H(function(){return x(o,r,i,n._result)})}else E(n,r,t,e);return r}function h(t){var e=this;if(t&&"object"==typeof t&&t.constructor===e)return t;var n=new e(p);return g(n,t),n}function p(){}function v(){return new TypeError("You cannot resolve a promise with itself")}function d(){return new TypeError("A promises callback cannot return that same promise.")}function _(t){try{return t.then}catch(e){return rt.error=e,rt}}function y(t,e,n,r){try{t.call(e,n,r)}catch(o){return o}}function m(t,e,n){H(function(t){var r=!1,o=y(n,e,function(n){r||(r=!0,e!==n?g(t,n):S(t,n))},function(e){r||(r=!0,j(t,e))},"Settle: "+(t._label||" unknown promise"));!r&&o&&(r=!0,j(t,o))},t)}function b(t,e){e._state===et?S(t,e._result):e._state===nt?j(t,e._result):E(e,void 0,function(e){return g(t,e)},function(e){return j(t,e)})}function w(t,n,r){n.constructor===t.constructor&&r===l&&n.constructor.resolve===h?b(t,n):r===rt?(j(t,rt.error),rt.error=null):void 0===r?S(t,n):e(r)?m(t,n,r):S(t,n)}function g(e,n){e===n?j(e,v()):t(n)?w(e,n,_(n)):S(e,n)}function A(t){t._onerror&&t._onerror(t._result),M(t)}function S(t,e){t._state===tt&&(t._result=e,t._state=et,0!==t._subscribers.length&&H(M,t))}function j(t,e){t._state===tt&&(t._state=nt,t._result=e,H(A,t))}function E(t,e,n,r){var o=t._subscribers,i=o.length;t._onerror=null,o[i]=e,o[i+et]=n,o[i+nt]=r,0===i&&t._state&&H(M,t)}function M(t){var e=t._subscribers,n=t._state;if(0!==e.length){for(var r=void 0,o=void 0,i=t._result,s=0;s<e.length;s+=3)r=e[s],o=e[s+n],r?x(n,r,o,i):o(i);t._subscribers.length=0}}function T(){this.error=null}function P(t,e){try{return t(e)}catch(n){return ot.error=n,ot}}function x(t,n,r,o){var i=e(r),s=void 0,u=void 0,c=void 0,a=void 0;if(i){if(s=P(r,o),s===ot?(a=!0,u=s.error,s.error=null):c=!0,n===s)return void j(n,d())}else s=o,c=!0;n._state!==tt||(i&&c?g(n,s):a?j(n,u):t===et?S(n,s):t===nt&&j(n,s))}function C(t,e){try{e(function(e){g(t,e)},function(e){j(t,e)})}catch(n){j(t,n)}}function O(){return it++}function k(t){t[$]=it++,t._state=void 0,t._result=void 0,t._subscribers=[]}function Y(){return new Error("Array Methods must be provided an Array")}function Y(){return new Error("Array Methods must be provided an Array")}function q(t){return new st(this,t).promise}function F(t){var e=this;return new e(W(t)?function(n,r){for(var o=t.length,i=0;i<o;i++)e.resolve(t[i]).then(n,r)}:function(t,e){return e(new TypeError("You must pass an array to race."))})}function D(t){var e=this,n=new e(p);return j(n,t),n}function K(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}function L(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}function N(){var t=void 0;if("undefined"!=typeof global)t=global;else if("undefined"!=typeof self)t=self;else try{t=Function("return this")()}catch(e){throw new Error("polyfill failed because global object is unavailable in this environment")}var n=t.Promise;if(n){var r=null;try{r=Object.prototype.toString.call(n.resolve())}catch(e){}if("[object Promise]"===r&&!n.cast)return}t.Promise=ut}var U=void 0;U=Array.isArray?Array.isArray:function(t){return"[object Array]"===Object.prototype.toString.call(t)};var W=U,z=0,B=void 0,G=void 0,H=function(t,e){X[z]=t,X[z+1]=e,z+=2,2===z&&(G?G(a):Z())},I="undefined"!=typeof window?window:void 0,J=I||{},Q=J.MutationObserver||J.WebKitMutationObserver,R="undefined"==typeof self&&"undefined"!=typeof process&&"[object process]"==={}.toString.call(process),V="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel,X=new Array(1e3),Z=void 0;Z=R?o():Q?s():V?u():void 0===I&&"function"==typeof require?f():c();var $=Math.random().toString(36).substring(16),tt=void 0,et=1,nt=2,rt=new T,ot=new T,it=0,st=function(){function t(t,e){this._instanceConstructor=t,this.promise=new t(p),this.promise[$]||k(this.promise),W(e)?(this.length=e.length,this._remaining=e.length,this._result=new Array(this.length),0===this.length?S(this.promise,this._result):(this.length=this.length||0,this._enumerate(e),0===this._remaining&&S(this.promise,this._result))):j(this.promise,Y())}return t.prototype._enumerate=function(t){for(var e=0;this._state===tt&&e<t.length;e++)this._eachEntry(t[e],e)},t.prototype._eachEntry=function(t,e){var n=this._instanceConstructor,r=n.resolve;if(r===h){var o=_(t);if(o===l&&t._state!==tt)this._settledAt(t._state,e,t._result);else if("function"!=typeof o)this._remaining--,this._result[e]=t;else if(n===ut){var i=new n(p);w(i,t,o),this._willSettleAt(i,e)}else this._willSettleAt(new n(function(e){return e(t)}),e)}else this._willSettleAt(r(t),e)},t.prototype._settledAt=function(t,e,n){var r=this.promise;r._state===tt&&(this._remaining--,t===nt?j(r,n):this._result[e]=n),0===this._remaining&&S(r,this._result)},t.prototype._willSettleAt=function(t,e){var n=this;E(t,void 0,function(t){return n._settledAt(et,e,t)},function(t){return n._settledAt(nt,e,t)})},t}(),ut=function(){function t(e){this[$]=O(),this._result=this._state=void 0,this._subscribers=[],p!==e&&("function"!=typeof e&&K(),this instanceof t?C(this,e):L())}return t.prototype["catch"]=function(t){return this.then(null,t)},t.prototype["finally"]=function(t){var e=this,n=e.constructor;return e.then(function(e){return n.resolve(t()).then(function(){return e})},function(e){return n.resolve(t()).then(function(){throw e})})},t}();return ut.prototype.then=l,ut.all=q,ut.race=F,ut.resolve=h,ut.reject=D,ut._setScheduler=n,ut._setAsap=r,ut._asap=H,ut.polyfill=N,ut.Promise=ut,ut}); | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.ES6Promise=e()}(this,function(){"use strict";function t(t){var e=typeof t;return null!==t&&("object"===e||"function"===e)}function e(t){return"function"==typeof t}function n(t){B=t}function r(t){G=t}function o(){return function(){return process.nextTick(a)}}function i(){return"undefined"!=typeof z?function(){z(a)}:c()}function s(){var t=0,e=new J(a),n=document.createTextNode("");return e.observe(n,{characterData:!0}),function(){n.data=t=++t%2}}function u(){var t=new MessageChannel;return t.port1.onmessage=a,function(){return t.port2.postMessage(0)}}function c(){var t=setTimeout;return function(){return t(a,1)}}function a(){for(var t=0;t<W;t+=2){var e=V[t],n=V[t+1];e(n),V[t]=void 0,V[t+1]=void 0}W=0}function f(){try{var t=require,e=t("vertx");return z=e.runOnLoop||e.runOnContext,i()}catch(n){return c()}}function l(t,e){var n=this,r=new this.constructor(p);void 0===r[Z]&&O(r);var o=n._state;if(o){var i=arguments[o-1];G(function(){return P(o,r,i,n._result)})}else E(n,r,t,e);return r}function h(t){var e=this;if(t&&"object"==typeof t&&t.constructor===e)return t;var n=new e(p);return g(n,t),n}function p(){}function v(){return new TypeError("You cannot resolve a promise with itself")}function d(){return new TypeError("A promises callback cannot return that same promise.")}function _(t){try{return t.then}catch(e){return nt.error=e,nt}}function y(t,e,n,r){try{t.call(e,n,r)}catch(o){return o}}function m(t,e,n){G(function(t){var r=!1,o=y(n,e,function(n){r||(r=!0,e!==n?g(t,n):S(t,n))},function(e){r||(r=!0,j(t,e))},"Settle: "+(t._label||" unknown promise"));!r&&o&&(r=!0,j(t,o))},t)}function b(t,e){e._state===tt?S(t,e._result):e._state===et?j(t,e._result):E(e,void 0,function(e){return g(t,e)},function(e){return j(t,e)})}function w(t,n,r){n.constructor===t.constructor&&r===l&&n.constructor.resolve===h?b(t,n):r===nt?(j(t,nt.error),nt.error=null):void 0===r?S(t,n):e(r)?m(t,n,r):S(t,n)}function g(e,n){e===n?j(e,v()):t(n)?w(e,n,_(n)):S(e,n)}function A(t){t._onerror&&t._onerror(t._result),T(t)}function S(t,e){t._state===$&&(t._result=e,t._state=tt,0!==t._subscribers.length&&G(T,t))}function j(t,e){t._state===$&&(t._state=et,t._result=e,G(A,t))}function E(t,e,n,r){var o=t._subscribers,i=o.length;t._onerror=null,o[i]=e,o[i+tt]=n,o[i+et]=r,0===i&&t._state&&G(T,t)}function T(t){var e=t._subscribers,n=t._state;if(0!==e.length){for(var r=void 0,o=void 0,i=t._result,s=0;s<e.length;s+=3)r=e[s],o=e[s+n],r?P(n,r,o,i):o(i);t._subscribers.length=0}}function M(t,e){try{return t(e)}catch(n){return nt.error=n,nt}}function P(t,n,r,o){var i=e(r),s=void 0,u=void 0,c=void 0,a=void 0;if(i){if(s=M(r,o),s===nt?(a=!0,u=s.error,s.error=null):c=!0,n===s)return void j(n,d())}else s=o,c=!0;n._state!==$||(i&&c?g(n,s):a?j(n,u):t===tt?S(n,s):t===et&&j(n,s))}function x(t,e){try{e(function(e){g(t,e)},function(e){j(t,e)})}catch(n){j(t,n)}}function C(){return rt++}function O(t){t[Z]=rt++,t._state=void 0,t._result=void 0,t._subscribers=[]}function k(){return new Error("Array Methods must be provided an Array")}function Y(t){return new ot(this,t).promise}function q(t){var e=this;return new e(U(t)?function(n,r){for(var o=t.length,i=0;i<o;i++)e.resolve(t[i]).then(n,r)}:function(t,e){return e(new TypeError("You must pass an array to race."))})}function F(t){var e=this,n=new e(p);return j(n,t),n}function D(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}function K(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}function L(){var t=void 0;if("undefined"!=typeof global)t=global;else if("undefined"!=typeof self)t=self;else try{t=Function("return this")()}catch(e){throw new Error("polyfill failed because global object is unavailable in this environment")}var n=t.Promise;if(n){var r=null;try{r=Object.prototype.toString.call(n.resolve())}catch(e){}if("[object Promise]"===r&&!n.cast)return}t.Promise=it}var N=void 0;N=Array.isArray?Array.isArray:function(t){return"[object Array]"===Object.prototype.toString.call(t)};var U=N,W=0,z=void 0,B=void 0,G=function(t,e){V[W]=t,V[W+1]=e,W+=2,2===W&&(B?B(a):X())},H="undefined"!=typeof window?window:void 0,I=H||{},J=I.MutationObserver||I.WebKitMutationObserver,Q="undefined"==typeof self&&"undefined"!=typeof process&&"[object process]"==={}.toString.call(process),R="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel,V=new Array(1e3),X=void 0;X=Q?o():J?s():R?u():void 0===H&&"function"==typeof require?f():c();var Z=Math.random().toString(36).substring(2),$=void 0,tt=1,et=2,nt={error:null},rt=0,ot=function(){function t(t,e){this._instanceConstructor=t,this.promise=new t(p),this.promise[Z]||O(this.promise),U(e)?(this.length=e.length,this._remaining=e.length,this._result=new Array(this.length),0===this.length?S(this.promise,this._result):(this.length=this.length||0,this._enumerate(e),0===this._remaining&&S(this.promise,this._result))):j(this.promise,k())}return t.prototype._enumerate=function(t){for(var e=0;this._state===$&&e<t.length;e++)this._eachEntry(t[e],e)},t.prototype._eachEntry=function(t,e){var n=this._instanceConstructor,r=n.resolve;if(r===h){var o=_(t);if(o===l&&t._state!==$)this._settledAt(t._state,e,t._result);else if("function"!=typeof o)this._remaining--,this._result[e]=t;else if(n===it){var i=new n(p);w(i,t,o),this._willSettleAt(i,e)}else this._willSettleAt(new n(function(e){return e(t)}),e)}else this._willSettleAt(r(t),e)},t.prototype._settledAt=function(t,e,n){var r=this.promise;r._state===$&&(this._remaining--,t===et?j(r,n):this._result[e]=n),0===this._remaining&&S(r,this._result)},t.prototype._willSettleAt=function(t,e){var n=this;E(t,void 0,function(t){return n._settledAt(tt,e,t)},function(t){return n._settledAt(et,e,t)})},t}(),it=function(){function t(e){this[Z]=C(),this._result=this._state=void 0,this._subscribers=[],p!==e&&("function"!=typeof e&&D(),this instanceof t?x(this,e):K())}return t.prototype["catch"]=function(t){return this.then(null,t)},t.prototype["finally"]=function(t){var e=this,n=e.constructor;return e.then(function(e){return n.resolve(t()).then(function(){return e})},function(e){return n.resolve(t()).then(function(){throw e})})},t}();return it.prototype.then=l,it.all=Y,it.race=q,it.resolve=h,it.reject=F,it._setScheduler=n,it._setAsap=r,it._asap=G,it.polyfill=L,it.Promise=it,it}); |
@@ -13,3 +13,3 @@ import { | ||
export const PROMISE_ID = Math.random().toString(36).substring(16); | ||
export const PROMISE_ID = Math.random().toString(36).substring(2); | ||
@@ -22,3 +22,3 @@ function noop() {} | ||
const GET_THEN_ERROR = new ErrorObject(); | ||
const TRY_CATCH_ERROR = { error: null }; | ||
@@ -37,4 +37,4 @@ function selfFulfillment() { | ||
} catch(error) { | ||
GET_THEN_ERROR.error = error; | ||
return GET_THEN_ERROR; | ||
TRY_CATCH_ERROR.error = error; | ||
return TRY_CATCH_ERROR; | ||
} | ||
@@ -93,5 +93,5 @@ } | ||
} else { | ||
if (then === GET_THEN_ERROR) { | ||
reject(promise, GET_THEN_ERROR.error); | ||
GET_THEN_ERROR.error = null; | ||
if (then === TRY_CATCH_ERROR) { | ||
reject(promise, TRY_CATCH_ERROR.error); | ||
TRY_CATCH_ERROR.error = null; | ||
} else if (then === undefined) { | ||
@@ -181,8 +181,3 @@ fulfill(promise, maybeThenable); | ||
function ErrorObject() { | ||
this.error = null; | ||
} | ||
const TRY_CATCH_ERROR = new ErrorObject(); | ||
function tryCatch(callback, detail) { | ||
@@ -189,0 +184,0 @@ try { |
@@ -5,3 +5,2 @@ import { | ||
} from './utils'; | ||
import { | ||
@@ -27,6 +26,2 @@ noop, | ||
return new Error('Array Methods must be provided an Array'); | ||
} | ||
function validationError() { | ||
return new Error('Array Methods must be provided an Array'); | ||
}; | ||
@@ -114,5 +109,8 @@ | ||
subscribe(promise, undefined, value => enumerator._settledAt(FULFILLED, i, value), | ||
reason => enumerator._settledAt(REJECTED, i, reason)); | ||
subscribe( | ||
promise, undefined, | ||
value => enumerator._settledAt(FULFILLED, i, value), | ||
reason => enumerator._settledAt(REJECTED, i, reason) | ||
); | ||
} | ||
} | ||
}; |
@@ -8,11 +8,11 @@ /*global self*/ | ||
if (typeof global !== 'undefined') { | ||
local = global; | ||
local = global; | ||
} else if (typeof self !== 'undefined') { | ||
local = self; | ||
local = self; | ||
} else { | ||
try { | ||
local = Function('return this')(); | ||
} catch (e) { | ||
throw new Error('polyfill failed because global object is unavailable in this environment'); | ||
} | ||
try { | ||
local = Function('return this')(); | ||
} catch (e) { | ||
throw new Error('polyfill failed because global object is unavailable in this environment'); | ||
} | ||
} | ||
@@ -25,9 +25,9 @@ | ||
try { | ||
promiseToString = Object.prototype.toString.call(P.resolve()); | ||
promiseToString = Object.prototype.toString.call(P.resolve()); | ||
} catch(e) { | ||
// silently ignored | ||
// silently ignored | ||
} | ||
if (promiseToString === '[object Promise]' && !P.cast){ | ||
return; | ||
return; | ||
} | ||
@@ -34,0 +34,0 @@ } |
import { | ||
isFunction | ||
} from './utils'; | ||
import { | ||
@@ -11,3 +10,2 @@ noop, | ||
} from './-internal'; | ||
import { | ||
@@ -14,0 +12,0 @@ asap, |
{ | ||
"name": "es6-promise", | ||
"namespace": "es6-promise", | ||
"version": "4.2.2", | ||
"version": "4.2.3", | ||
"description": "A lightweight library that provides tools for organizing asynchronous code", | ||
@@ -6,0 +6,0 @@ "main": "dist/es6-promise.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
316610
3113