promise-polyfill
Advanced tools
Comparing version 1.1.3 to 1.1.5
{ | ||
"name": "promise-polyfill", | ||
"version": "1.1.3", | ||
"version": "1.1.4", | ||
"homepage": "https://github.com/taylorhakes/promise-polyfill", | ||
@@ -5,0 +5,0 @@ "authors": [ |
{ | ||
"name": "promise-polyfill", | ||
"version": "1.1.3", | ||
"version": "1.1.5", | ||
"description": "Light weight promise polyfill. A+ compliant", | ||
@@ -24,3 +24,4 @@ "main": "Promise.js", | ||
}, | ||
"keywords": ["promise", "promise-polyfill", "ES6", "promises-aplus"], | ||
"dependencies": {} | ||
} |
@@ -1,10 +0,18 @@ | ||
(function(global) { | ||
if(typeof module !== 'undefined' && module.exports) { | ||
module.exports = global.Promise ? global.Promise : Promise; | ||
} else if (!global.Promise) { | ||
global.Promise = Promise; | ||
(function() { | ||
var root; | ||
if (typeof window === 'object' && window) { | ||
root = window; | ||
} else { | ||
root = global; | ||
} | ||
if (typeof module !== 'undefined' && module.exports) { | ||
module.exports = root.Promise ? root.Promise : Promise; | ||
} else if (!root.Promise) { | ||
root.Promise = Promise; | ||
} | ||
// Use polyfill for setImmediate for performance gains | ||
var asap = global.setImmediate || function(fn) { setTimeout(fn, 1); }; | ||
var asap = root.setImmediate || function(fn) { setTimeout(fn, 1); }; | ||
@@ -178,2 +186,2 @@ // Polyfill for Function.prototype.bind | ||
}; | ||
})(this || window); | ||
})(); |
@@ -1,2 +0,2 @@ | ||
/*! promise-polyfill 1.1.2 */ | ||
!function(a){function b(a,b){return function(){a.apply(b,arguments)}}function c(a){if("object"!=typeof this)throw new TypeError("Promises must be constructed via new");if("function"!=typeof a)throw new TypeError("not a function");this._state=null,this._value=null,this._deferreds=[],i(a,b(e,this),b(f,this))}function d(a){var b=this;return null===this._state?void this._deferreds.push(a):void j(function(){var c=b._state?a.onFulfilled:a.onRejected;if(null===c)return void(b._state?a.resolve:a.reject)(b._value);var d;try{d=c(b._value)}catch(e){return void a.reject(e)}a.resolve(d)})}function e(a){try{if(a===this)throw new TypeError("A promise cannot be resolved with itself.");if(a&&("object"==typeof a||"function"==typeof a)){var c=a.then;if("function"==typeof c)return void i(b(c,a),b(e,this),b(f,this))}this._state=!0,this._value=a,g.call(this)}catch(d){f.call(this,d)}}function f(a){this._state=!1,this._value=a,g.call(this)}function g(){for(var a=0,b=this._deferreds.length;b>a;a++)d.call(this,this._deferreds[a]);this._deferreds=null}function h(a,b,c,d){this.onFulfilled="function"==typeof a?a:null,this.onRejected="function"==typeof b?b:null,this.resolve=c,this.reject=d}function i(a,b,c){var d=!1;try{a(function(a){d||(d=!0,b(a))},function(a){d||(d=!0,c(a))})}catch(e){if(d)return;d=!0,c(e)}}"undefined"!=typeof module&&module.exports?module.exports=a.Promise?a.Promise:c:a.Promise||(a.Promise=c);var j=a.setImmediate||function(a){setTimeout(a,1)},k=Array.isArray||function(a){return"[object Array]"===Object.prototype.toString.call(a)};c.prototype["catch"]=function(a){return this.then(null,a)},c.prototype.then=function(a,b){var e=this;return new c(function(c,f){d.call(e,new h(a,b,c,f))})},c.all=function(){var a=Array.prototype.slice.call(1===arguments.length&&k(arguments[0])?arguments[0]:arguments);return new c(function(b,c){function d(f,g){try{if(g&&("object"==typeof g||"function"==typeof g)){var h=g.then;if("function"==typeof h)return void h.call(g,function(a){d(f,a)},c)}a[f]=g,0===--e&&b(a)}catch(i){c(i)}}if(0===a.length)return b([]);for(var e=a.length,f=0;f<a.length;f++)d(f,a[f])})},c.resolve=function(a){return a&&"object"==typeof a&&a.constructor===c?a:new c(function(b){b(a)})},c.reject=function(a){return new c(function(b,c){c(a)})},c.race=function(a){return new c(function(b,c){for(var d=0,e=a.length;e>d;d++)a[d].then(b,c)})}}(this||window); | ||
/*! promise-polyfill 1.1.4 */ | ||
!function(){function a(a,b){return function(){a.apply(b,arguments)}}function b(b){if("object"!=typeof this)throw new TypeError("Promises must be constructed via new");if("function"!=typeof b)throw new TypeError("not a function");this._state=null,this._value=null,this._deferreds=[],h(b,a(d,this),a(e,this))}function c(a){var b=this;return null===this._state?void this._deferreds.push(a):void j(function(){var c=b._state?a.onFulfilled:a.onRejected;if(null===c)return void(b._state?a.resolve:a.reject)(b._value);var d;try{d=c(b._value)}catch(e){return void a.reject(e)}a.resolve(d)})}function d(b){try{if(b===this)throw new TypeError("A promise cannot be resolved with itself.");if(b&&("object"==typeof b||"function"==typeof b)){var c=b.then;if("function"==typeof c)return void h(a(c,b),a(d,this),a(e,this))}this._state=!0,this._value=b,f.call(this)}catch(g){e.call(this,g)}}function e(a){this._state=!1,this._value=a,f.call(this)}function f(){for(var a=0,b=this._deferreds.length;b>a;a++)c.call(this,this._deferreds[a]);this._deferreds=null}function g(a,b,c,d){this.onFulfilled="function"==typeof a?a:null,this.onRejected="function"==typeof b?b:null,this.resolve=c,this.reject=d}function h(a,b,c){var d=!1;try{a(function(a){d||(d=!0,b(a))},function(a){d||(d=!0,c(a))})}catch(e){if(d)return;d=!0,c(e)}}var i;i="object"==typeof window&&window?window:global,"undefined"!=typeof module&&module.exports?module.exports=i.Promise?i.Promise:b:i.Promise||(i.Promise=b);var j=i.setImmediate||function(a){setTimeout(a,1)},k=Array.isArray||function(a){return"[object Array]"===Object.prototype.toString.call(a)};b.prototype["catch"]=function(a){return this.then(null,a)},b.prototype.then=function(a,d){var e=this;return new b(function(b,f){c.call(e,new g(a,d,b,f))})},b.all=function(){var a=Array.prototype.slice.call(1===arguments.length&&k(arguments[0])?arguments[0]:arguments);return new b(function(b,c){function d(f,g){try{if(g&&("object"==typeof g||"function"==typeof g)){var h=g.then;if("function"==typeof h)return void h.call(g,function(a){d(f,a)},c)}a[f]=g,0===--e&&b(a)}catch(i){c(i)}}if(0===a.length)return b([]);for(var e=a.length,f=0;f<a.length;f++)d(f,a[f])})},b.resolve=function(a){return a&&"object"==typeof a&&a.constructor===b?a:new b(function(b){b(a)})},b.reject=function(a){return new b(function(b,c){c(a)})},b.race=function(a){return new b(function(b,c){for(var d=0,e=a.length;e>d;d++)a[d].then(b,c)})}}(); |
@@ -5,3 +5,3 @@ <a href="http://promises-aplus.github.com/promises-spec"> | ||
</a> | ||
Promise [![Build Status](https://travis-ci.org/taylorhakes/promise-polyfill.png?branch=master)](https://travis-ci.org/taylorhakes/promise-polyfill) ![https://david-dm.org/taylorhakes/promise-polyfill/dev-status.png](https://david-dm.org/taylorhakes/promise-polyfill/dev-status.png) | ||
Promise [![Build Status](https://travis-ci.org/taylorhakes/promise-polyfill.png?branch=master)](https://travis-ci.org/taylorhakes/promise-polyfill) | ||
============= | ||
@@ -8,0 +8,0 @@ |
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
12094
223