es6-promise
Advanced tools
Comparing version 2.0.0 to 2.0.1
{ | ||
"name": "es6-promise", | ||
"namespace": "Promise", | ||
"version": "2.0.0", | ||
"version": "2.0.1", | ||
"description": "A polyfill for ES6-style Promises, tracking rsvp", | ||
@@ -19,3 +19,3 @@ "authors": [ | ||
"url": "https://github.com/jakearchibald/ES6-Promises/issues" | ||
} | ||
}, | ||
"license": "MIT", | ||
@@ -22,0 +22,0 @@ "ignore": [ |
@@ -6,3 +6,3 @@ /*! | ||
* See https://raw.githubusercontent.com/jakearchibald/es6-promise/master/LICENSE | ||
* @version 2.0.0 | ||
* @version 2.0.1 | ||
*/ | ||
@@ -638,9 +638,7 @@ | ||
@param {function} resolver | ||
@param {String} label optional string for labeling the promise. | ||
Useful for tooling. | ||
@constructor | ||
*/ | ||
function $$es6$promise$promise$$Promise(resolver, label) { | ||
function $$es6$promise$promise$$Promise(resolver) { | ||
this._id = $$es6$promise$promise$$counter++; | ||
this._label = label; | ||
this._state = undefined; | ||
@@ -861,7 +859,6 @@ this._result = undefined; | ||
@param {Function} onRejected | ||
@param {String} label optional string for labeling the promise. | ||
Useful for tooling. | ||
@return {Promise} | ||
*/ | ||
then: function(onFulfillment, onRejection, label) { | ||
then: function(onFulfillment, onRejection) { | ||
var parent = this; | ||
@@ -874,5 +871,3 @@ var state = parent._state; | ||
parent._onerror = null; | ||
var child = new this.constructor($$$internal$$noop, label); | ||
var child = new this.constructor($$$internal$$noop); | ||
var result = parent._result; | ||
@@ -916,8 +911,7 @@ | ||
@param {Function} onRejection | ||
@param {String} label optional string for labeling the promise. | ||
Useful for tooling. | ||
@return {Promise} | ||
*/ | ||
'catch': function(onRejection, label) { | ||
return this.then(null, onRejection, label); | ||
'catch': function(onRejection) { | ||
return this.then(null, onRejection); | ||
} | ||
@@ -959,4 +953,4 @@ }; | ||
var es6$promise$umd$$ES6Promise = { | ||
Promise: $$es6$promise$promise$$default, | ||
polyfill: $$es6$promise$polyfill$$default | ||
'Promise': $$es6$promise$promise$$default, | ||
'polyfill': $$es6$promise$polyfill$$default | ||
}; | ||
@@ -963,0 +957,0 @@ |
@@ -6,3 +6,3 @@ /*! | ||
* See https://raw.githubusercontent.com/jakearchibald/es6-promise/master/LICENSE | ||
* @version 2.0.0 | ||
* @version 2.0.1 | ||
*/ | ||
@@ -12,9 +12,9 @@ | ||
l=0}function p(){}function J(a,b,c,d){try{a.call(b,c,d)}catch(e){return e}}function K(a,b,c){r(function(a){var e=!1,f=J(c,b,function(c){e||(e=!0,b!==c?q(a,c):m(a,c))},function(b){e||(e=!0,g(a,b))});!e&&f&&(e=!0,g(a,f))},a)}function L(a,b){1===b.a?m(a,b.b):2===a.a?g(a,b.b):u(b,void 0,function(b){q(a,b)},function(b){g(a,b)})}function q(a,b){if(a===b)g(a,new TypeError("You cannot resolve a promise with itself"));else if("function"===typeof b||"object"===typeof b&&null!==b)if(b.constructor===a.constructor)L(a, | ||
b);else{var c;try{c=b.then}catch(d){v.error=d,c=v}c===v?g(a,v.error):void 0===c?m(a,b):s(c)?K(a,b,c):m(a,b)}else m(a,b)}function M(a){a.d&&a.d(a.b);x(a)}function m(a,b){void 0===a.a&&(a.b=b,a.a=1,0!==a.f.length&&r(x,a))}function g(a,b){void 0===a.a&&(a.a=2,a.b=b,r(M,a))}function u(a,b,c,d){var e=a.f,f=e.length;a.d=null;e[f]=b;e[f+1]=c;e[f+2]=d;0===f&&a.a&&r(x,a)}function x(a){var b=a.f,c=a.a;if(0!==b.length){for(var d,e,f=a.b,g=0;g<b.length;g+=3)d=b[g],e=b[g+c],d?C(c,d,e,f):e(f);a.f.length=0}}function D(){this.error= | ||
null}function C(a,b,c,d){var e=s(c),f,k,h,l;if(e){try{f=c(d)}catch(n){y.error=n,f=y}f===y?(l=!0,k=f.error,f=null):h=!0;if(b===f){g(b,new TypeError("A promises callback cannot return that same promise."));return}}else f=d,h=!0;void 0===b.a&&(e&&h?q(b,f):l?g(b,k):1===a?m(b,f):2===a&&g(b,f))}function N(a,b){try{b(function(b){q(a,b)},function(b){g(a,b)})}catch(c){g(a,c)}}function k(a,b,c,d){this.n=a;this.c=new a(p,d);this.i=c;this.o(b)?(this.m=b,this.e=this.length=b.length,this.l(),0===this.length?m(this.c, | ||
this.b):(this.length=this.length||0,this.k(),0===this.e&&m(this.c,this.b))):g(this.c,this.p())}function h(a){O++;this.b=this.a=void 0;this.f=[];if(p!==a){if(!s(a))throw new TypeError("You must pass a resolver function as the first argument to the promise constructor");if(!(this instanceof h))throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.");N(this,a)}}var E=Array.isArray?Array.isArray:function(a){return"[object Array]"=== | ||
b);else{var c;try{c=b.then}catch(d){v.error=d,c=v}c===v?g(a,v.error):void 0===c?m(a,b):s(c)?K(a,b,c):m(a,b)}else m(a,b)}function M(a){a.f&&a.f(a.b);x(a)}function m(a,b){void 0===a.a&&(a.b=b,a.a=1,0!==a.e.length&&r(x,a))}function g(a,b){void 0===a.a&&(a.a=2,a.b=b,r(M,a))}function u(a,b,c,d){var e=a.e,f=e.length;a.f=null;e[f]=b;e[f+1]=c;e[f+2]=d;0===f&&a.a&&r(x,a)}function x(a){var b=a.e,c=a.a;if(0!==b.length){for(var d,e,f=a.b,g=0;g<b.length;g+=3)d=b[g],e=b[g+c],d?C(c,d,e,f):e(f);a.e.length=0}}function D(){this.error= | ||
null}function C(a,b,c,d){var e=s(c),f,k,h,l;if(e){try{f=c(d)}catch(n){y.error=n,f=y}f===y?(l=!0,k=f.error,f=null):h=!0;if(b===f){g(b,new TypeError("A promises callback cannot return that same promise."));return}}else f=d,h=!0;void 0===b.a&&(e&&h?q(b,f):l?g(b,k):1===a?m(b,f):2===a&&g(b,f))}function N(a,b){try{b(function(b){q(a,b)},function(b){g(a,b)})}catch(c){g(a,c)}}function k(a,b,c,d){this.n=a;this.c=new a(p,d);this.i=c;this.o(b)?(this.m=b,this.d=this.length=b.length,this.l(),0===this.length?m(this.c, | ||
this.b):(this.length=this.length||0,this.k(),0===this.d&&m(this.c,this.b))):g(this.c,this.p())}function h(a){O++;this.b=this.a=void 0;this.e=[];if(p!==a){if(!s(a))throw new TypeError("You must pass a resolver function as the first argument to the promise constructor");if(!(this instanceof h))throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.");N(this,a)}}var E=Array.isArray?Array.isArray:function(a){return"[object Array]"=== | ||
Object.prototype.toString.call(a)},l=0,w="undefined"!==typeof window?window:{},B=w.MutationObserver||w.WebKitMutationObserver,w="undefined"!==typeof Uint8ClampedArray&&"undefined"!==typeof importScripts&&"undefined"!==typeof MessageChannel,n=Array(1E3),A;A="undefined"!==typeof process&&"[object process]"==={}.toString.call(process)?F():B?G():w?H():I();var v=new D,y=new D;k.prototype.o=function(a){return E(a)};k.prototype.p=function(){return Error("Array Methods must be provided an Array")};k.prototype.l= | ||
function(){this.b=Array(this.length)};k.prototype.k=function(){for(var a=this.length,b=this.c,c=this.m,d=0;void 0===b.a&&d<a;d++)this.j(c[d],d)};k.prototype.j=function(a,b){var c=this.n;"object"===typeof a&&null!==a?a.constructor===c&&void 0!==a.a?(a.d=null,this.g(a.a,b,a.b)):this.q(c.resolve(a),b):(this.e--,this.b[b]=this.h(a))};k.prototype.g=function(a,b,c){var d=this.c;void 0===d.a&&(this.e--,this.i&&2===a?g(d,c):this.b[b]=this.h(c));0===this.e&&m(d,this.b)};k.prototype.h=function(a){return a}; | ||
function(){this.b=Array(this.length)};k.prototype.k=function(){for(var a=this.length,b=this.c,c=this.m,d=0;void 0===b.a&&d<a;d++)this.j(c[d],d)};k.prototype.j=function(a,b){var c=this.n;"object"===typeof a&&null!==a?a.constructor===c&&void 0!==a.a?(a.f=null,this.g(a.a,b,a.b)):this.q(c.resolve(a),b):(this.d--,this.b[b]=this.h(a))};k.prototype.g=function(a,b,c){var d=this.c;void 0===d.a&&(this.d--,this.i&&2===a?g(d,c):this.b[b]=this.h(c));0===this.d&&m(d,this.b)};k.prototype.h=function(a){return a}; | ||
k.prototype.q=function(a,b){var c=this;u(a,void 0,function(a){c.g(1,b,a)},function(a){c.g(2,b,a)})};var O=0;h.all=function(a,b){return(new k(this,a,!0,b)).c};h.race=function(a,b){function c(a){q(e,a)}function d(a){g(e,a)}var e=new this(p,b);if(!E(a))return (g(e,new TypeError("You must pass an array to race.")), e);for(var f=a.length,h=0;void 0===e.a&&h<f;h++)u(this.resolve(a[h]),void 0,c,d);return e};h.resolve=function(a,b){if(a&&"object"===typeof a&&a.constructor===this)return a;var c=new this(p,b); | ||
q(c,a);return c};h.reject=function(a,b){var c=new this(p,b);g(c,a);return c};h.prototype={constructor:h,then:function(a,b,c){var d=this.a;if(1===d&&!a||2===d&&!b)return this;this.d=null;var e=new this.constructor(p,c),f=this.b;if(d){var g=arguments[d-1];r(function(){C(d,e,g,f)})}else u(this,e,a,b);return e},"catch":function(a,b){return this.then(null,a,b)}};var z={Promise:h,r:function(){var a;a="undefined"!==typeof global?global:"undefined"!==typeof window&&window.document?window:self;"Promise"in | ||
a&&"resolve"in a.Promise&&"reject"in a.Promise&&"all"in a.Promise&&"race"in a.Promise&&function(){var b;new a.Promise(function(a){b=a});return s(b)}()||(a.Promise=h)}};"function"===typeof define&&define.amd?define(function(){return z}):"undefined"!==typeof module&&module.exports?module.exports=z:"undefined"!==typeof this&&(this.ES6Promise=z)}).call(this); | ||
q(c,a);return c};h.reject=function(a,b){var c=new this(p,b);g(c,a);return c};h.prototype={constructor:h,then:function(a,b){var c=this.a;if(1===c&&!a||2===c&&!b)return this;var d=new this.constructor(p),e=this.b;if(c){var f=arguments[c-1];r(function(){C(c,d,f,e)})}else u(this,d,a,b);return d},"catch":function(a){return this.then(null,a)}};var z={Promise:h,polyfill:function(){var a;a="undefined"!==typeof global?global:"undefined"!==typeof window&&window.document?window:self;"Promise"in a&&"resolve"in | ||
a.Promise&&"reject"in a.Promise&&"all"in a.Promise&&"race"in a.Promise&&function(){var b;new a.Promise(function(a){b=a});return s(b)}()||(a.Promise=h)}};"function"===typeof define&&define.amd?define(function(){return z}):"undefined"!==typeof module&&module.exports?module.exports=z:"undefined"!==typeof this&&(this.ES6Promise=z)}).call(this); |
@@ -5,4 +5,4 @@ import Promise from './es6-promise/promise'; | ||
var ES6Promise = { | ||
Promise: Promise, | ||
polyfill: polyfill | ||
'Promise': Promise, | ||
'polyfill': polyfill | ||
}; | ||
@@ -9,0 +9,0 @@ |
@@ -133,9 +133,7 @@ import { | ||
@param {function} resolver | ||
@param {String} label optional string for labeling the promise. | ||
Useful for tooling. | ||
@constructor | ||
*/ | ||
function Promise(resolver, label) { | ||
function Promise(resolver) { | ||
this._id = counter++; | ||
this._label = label; | ||
this._state = undefined; | ||
@@ -356,7 +354,6 @@ this._result = undefined; | ||
@param {Function} onRejected | ||
@param {String} label optional string for labeling the promise. | ||
Useful for tooling. | ||
@return {Promise} | ||
*/ | ||
then: function(onFulfillment, onRejection, label) { | ||
then: function(onFulfillment, onRejection) { | ||
var parent = this; | ||
@@ -369,5 +366,3 @@ var state = parent._state; | ||
parent._onerror = null; | ||
var child = new this.constructor(noop, label); | ||
var child = new this.constructor(noop); | ||
var result = parent._result; | ||
@@ -411,9 +406,8 @@ | ||
@param {Function} onRejection | ||
@param {String} label optional string for labeling the promise. | ||
Useful for tooling. | ||
@return {Promise} | ||
*/ | ||
'catch': function(onRejection, label) { | ||
return this.then(null, onRejection, label); | ||
'catch': function(onRejection) { | ||
return this.then(null, onRejection); | ||
} | ||
}; |
{ | ||
"name": "es6-promise", | ||
"namespace": "es6-promise", | ||
"version": "2.0.0", | ||
"version": "2.0.1", | ||
"description": "A lightweight library that provides tools for organizing asynchronous code", | ||
@@ -6,0 +6,0 @@ "main": "dist/es6-promise.js", |
@@ -9,4 +9,4 @@ # ES6-Promise (subset of [rsvp.js](https://github.com/tildeio/rsvp.js)) | ||
* [es6-promise](https://es6-promises.s3.amazonaws.com/es6-promise-2.0.0.js) | ||
* [es6-promise-min](https://es6-promises.s3.amazonaws.com/es6-promise-2.0.0.min.js) (~2.2k gzipped) | ||
* [es6-promise](https://es6-promises.s3.amazonaws.com/es6-promise-2.0.1.js) | ||
* [es6-promise-min](https://es6-promises.s3.amazonaws.com/es6-promise-2.0.1.min.js) (~2.2k gzipped) | ||
@@ -29,4 +29,6 @@ ## Node.js | ||
`catch` is a reserved word in IE<9, meaning `promise.catch(func)` throws a syntax error. To work around this, use a string to access the property: | ||
`catch` is a reserved word in IE<9, meaning `promise.catch(func)` throws a syntax error. To work around this, you can use a string to access the property as shown in the following example. | ||
However, please remember that such technique is already provided by most common minifiers, making the resulting code safe for old browsers and production: | ||
```js | ||
@@ -33,0 +35,0 @@ promise['catch'](function(err) { |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
59
0
73686
2023