native-promise-only
Advanced tools
Comparing version 0.4.1-e to 0.4.1-f
/*! Native Promise Only | ||
v0.4.1-e (c) Kyle Simpson | ||
v0.4.1-f (c) Kyle Simpson | ||
MIT License: http://getify.mit-license.org | ||
@@ -56,7 +56,9 @@ */ | ||
drain: function drain(self) { | ||
while (first) { | ||
first.fn.call(first.self); | ||
first = first.next; | ||
var f = first; | ||
first = last = cycle = null; | ||
while (f) { | ||
f.fn.call(f.self); | ||
f = f.next; | ||
} | ||
cycle = last = first; | ||
} | ||
@@ -63,0 +65,0 @@ }; |
/*! Native Promise Only | ||
v0.4.1-e (c) Kyle Simpson | ||
v0.4.1-f (c) Kyle Simpson | ||
MIT License: http://getify.mit-license.org | ||
*/ | ||
!function(t,n,e){n[t]=n[t]||e(),"undefined"!=typeof module&&module.exports?module.exports=n[t]:"function"==typeof define&&define.amd&&define(function(){return n[t]})}("Promise","undefined"!=typeof global?global:this,function(){"use strict";function t(){function t(t,n){this.fn=t,this.self=n,this.next=void 0}var n,e,r;return{add:function(o,i){r=new t(o,i),e?e.next=r:n=r,e=r,r=void 0},drain:function(){for(;n;)n.fn.call(n.self),n=n.next;d=e=n}}}function n(t,n){y?(y=!1,t.call(n)):(p.add(t,n),d||(d=g(p.drain)))}function e(t){var n,e=typeof t;return null===t||"object"!==e&&"function"!==e||(n=t.then),"function"==typeof n?n:!1}function r(){var t,n,e,r=this;if(0===r.state)return y=!1;for(e=0;e<r.chain.length;e++)n=r.chain[e],t=1===r.state?n.success:n.failure,o(r,t,n);r.chain.length=0}function o(t,n,r){var o,i;try{n===!1?(y=!0,r.reject(t.msg)):(o=n===!0?t.msg:n.call(void 0,t.msg),y=!0,o===r.promise?r.reject(TypeError("Promise-chain cycle")):(i=e(o))?i.call(o,r.resolve,r.reject):r.resolve(o))}catch(c){y=!0,r.reject(c)}}function i(t){if(t.def){if(t.triggered)return y=!1;t.triggered=!0,t=t.def}return 0!==t.state?y=!1:t}function c(t){var o,u,a=i(this);if(a!==!1)try{(o=e(t))?(u=new s(a),o.call(t,function(){c.apply(u,arguments)},function(){f.apply(u,arguments)})):(a.msg=t,a.state=1,n(r,a))}catch(l){f.call(u||new s(a),l)}}function f(t){var e=i(this);e!==!1&&(e.msg=t,e.state=2,n(r,e))}function u(t,n){y=!0,t(n)}function a(t,n,e,r){for(var o=0;o<n.length;o++)!function(o){t.resolve(n[o]).then(function(t){e(o,t)},r)}(o)}function s(t){this.def=t,this.triggered=!1}function l(t){this.promise=t,this.state=0,this.triggered=!1,this.chain=[],this.msg=void 0}function h(t){if("function"!=typeof t)throw TypeError("Not a function");var e=this,o=new l(e);e.then=function(t,e){var i={success:"function"==typeof t?t:!0,failure:"function"==typeof e?e:!1};return i.promise=new this.constructor(function(t,n){if("function"!=typeof(t&&n))throw TypeError("Not a function");i.resolve=t,i.reject=n}),o.chain.push(i),n(r,o),i.promise},e["catch"]=function(t){return o.promise.then.call(this,void 0,t)};try{t.call(void 0,function(t){return o.triggered?void(y=!1):(o.triggered=!0,void c.call(o,t))},function(t){return o.triggered?void(y=!1):(o.triggered=!0,void f.call(o,t))})}catch(i){f.call(o,i)}}var d,p,y=!1,g="undefined"!=typeof setImmediate?function(t){return setImmediate(t)}:setTimeout,v=Object.defineProperty?function(t,n,e,r){return Object.defineProperty(t,n,{value:e,writable:!0,configurable:r!==!1})}:function(t,n,e){return t[n]=e,t};return p=t(),v(h,"prototype",v({},"constructor",h),!1),v(h,"resolve",function(t){var e=this;return"object"==typeof t&&t instanceof e?t:new e(function(e,r){if("function"!=typeof(e&&r))throw TypeError("Not a function");n(function(){u(e,t)})})}),v(h,"reject",function(t){return new this(function(n,e){if("function"!=typeof(n&&e))throw TypeError("Not a function");e(t)})}),v(h,"all",function(t){var n=this;return Array.isArray(t)?0===t.length?n.resolve([]):new n(function(e,r){if("function"!=typeof(e&&r))throw TypeError("Not a function");var o=t.length,i=Array(o),c=0;a(n,t,function(t,n){i[t]=n,++c===o&&u(e,i)},r)}):n.reject(TypeError("Not an array"))}),v(h,"race",function(t){var n=this;return Array.isArray(t)?new n(function(e,r){if("function"!=typeof(e&&r))throw TypeError("Not a function");a(n,t,function(t,n){u(e,n)},r)}):n.reject(TypeError("Not an array"))}),h}); | ||
!function(t,n,e){n[t]=n[t]||e(),"undefined"!=typeof module&&module.exports?module.exports=n[t]:"function"==typeof define&&define.amd&&define(function(){return n[t]})}("Promise","undefined"!=typeof global?global:this,function(){"use strict";function t(){function t(t,n){this.fn=t,this.self=n,this.next=void 0}var n,e,r;return{add:function(o,i){r=new t(o,i),e?e.next=r:n=r,e=r,r=void 0},drain:function(){var t=n;for(n=e=d=null;t;)t.fn.call(t.self),t=t.next}}}function n(t,n){y?(y=!1,t.call(n)):(p.add(t,n),d||(d=g(p.drain)))}function e(t){var n,e=typeof t;return null===t||"object"!==e&&"function"!==e||(n=t.then),"function"==typeof n?n:!1}function r(){var t,n,e,r=this;if(0===r.state)return y=!1;for(e=0;e<r.chain.length;e++)n=r.chain[e],t=1===r.state?n.success:n.failure,o(r,t,n);r.chain.length=0}function o(t,n,r){var o,i;try{n===!1?(y=!0,r.reject(t.msg)):(o=n===!0?t.msg:n.call(void 0,t.msg),y=!0,o===r.promise?r.reject(TypeError("Promise-chain cycle")):(i=e(o))?i.call(o,r.resolve,r.reject):r.resolve(o))}catch(c){y=!0,r.reject(c)}}function i(t){if(t.def){if(t.triggered)return y=!1;t.triggered=!0,t=t.def}return 0!==t.state?y=!1:t}function c(t){var o,u,a=i(this);if(a!==!1)try{(o=e(t))?(u=new s(a),o.call(t,function(){c.apply(u,arguments)},function(){f.apply(u,arguments)})):(a.msg=t,a.state=1,n(r,a))}catch(l){f.call(u||new s(a),l)}}function f(t){var e=i(this);e!==!1&&(e.msg=t,e.state=2,n(r,e))}function u(t,n){y=!0,t(n)}function a(t,n,e,r){for(var o=0;o<n.length;o++)!function(o){t.resolve(n[o]).then(function(t){e(o,t)},r)}(o)}function s(t){this.def=t,this.triggered=!1}function l(t){this.promise=t,this.state=0,this.triggered=!1,this.chain=[],this.msg=void 0}function h(t){if("function"!=typeof t)throw TypeError("Not a function");var e=this,o=new l(e);e.then=function(t,e){var i={success:"function"==typeof t?t:!0,failure:"function"==typeof e?e:!1};return i.promise=new this.constructor(function(t,n){if("function"!=typeof(t&&n))throw TypeError("Not a function");i.resolve=t,i.reject=n}),o.chain.push(i),n(r,o),i.promise},e["catch"]=function(t){return o.promise.then.call(this,void 0,t)};try{t.call(void 0,function(t){return o.triggered?void(y=!1):(o.triggered=!0,void c.call(o,t))},function(t){return o.triggered?void(y=!1):(o.triggered=!0,void f.call(o,t))})}catch(i){f.call(o,i)}}var d,p,y=!1,g="undefined"!=typeof setImmediate?function(t){return setImmediate(t)}:setTimeout,v=Object.defineProperty?function(t,n,e,r){return Object.defineProperty(t,n,{value:e,writable:!0,configurable:r!==!1})}:function(t,n,e){return t[n]=e,t};return p=t(),v(h,"prototype",v({},"constructor",h),!1),v(h,"resolve",function(t){var e=this;return"object"==typeof t&&t instanceof e?t:new e(function(e,r){if("function"!=typeof(e&&r))throw TypeError("Not a function");n(function(){u(e,t)})})}),v(h,"reject",function(t){return new this(function(n,e){if("function"!=typeof(n&&e))throw TypeError("Not a function");e(t)})}),v(h,"all",function(t){var n=this;return Array.isArray(t)?0===t.length?n.resolve([]):new n(function(e,r){if("function"!=typeof(e&&r))throw TypeError("Not a function");var o=t.length,i=Array(o),c=0;a(n,t,function(t,n){i[t]=n,++c===o&&u(e,i)},r)}):n.reject(TypeError("Not an array"))}),v(h,"race",function(t){var n=this;return Array.isArray(t)?new n(function(e,r){if("function"!=typeof(e&&r))throw TypeError("Not a function");a(n,t,function(t,n){u(e,n)},r)}):n.reject(TypeError("Not an array"))}),h}); |
{ | ||
"name": "native-promise-only", | ||
"version": "0.4.1-e", | ||
"version": "0.4.1-f", | ||
"description": "Native Promise Only: A polyfill for native ES6 Promises **only**, nothing else.", | ||
@@ -5,0 +5,0 @@ "main": "./npo.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
21187
375