Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

native-promise-only

Package Overview
Dependencies
Maintainers
1
Versions
49
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

native-promise-only - npm Package Compare versions

Comparing version 0.4.0-h to 0.4.1-a

18

lib/npo.src.js
/*! Native Promise Only
v0.4.0-h (c) Kyle Simpson
v0.4.1-a (c) Kyle Simpson
MIT License: http://getify.mit-license.org

@@ -198,9 +198,11 @@ */

for (var idx=0; idx<arr.length; idx++) {
Constructor.resolve(arr[idx])
.then(
function $resolver$(msg){
resolver(idx,msg);
},
rejecter
);
(function(idx){
Constructor.resolve(arr[idx])
.then(
function $resolver$(msg){
resolver(idx,msg);
},
rejecter
);
})(idx);
}

@@ -207,0 +209,0 @@ }

/*! Native Promise Only
v0.4.0-h (c) Kyle Simpson
v0.4.1-a (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(i,o){r=new t(i,o),e?e.next=r:n=r,e=r,r=void 0},drain:function(){for(;n;)n.fn.call(n.self),n=n.next;v=e=n}}}function n(t,n){y?(y=!1,t.call(n)):(g.add(t,n),v||(v=m(g.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,i(r,t,n);r.chain.length=0}function i(t,n,r){var i,o;try{n===!1?(y=!0,r.reject(t.msg)):(i=n===!0?t.msg:n.call(void 0,t.msg),y=!0,i===r.promise?r.reject(TypeError("Promise-chain cycle")):(o=e(i))?o.call(i,r.resolve,r.reject):r.resolve(i))}catch(c){y=!0,r.reject(c)}}function o(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 i,u,a=o(this);if(a!==!1)try{(i=e(t))?(u=new d(a),i.call(t,function(){c.apply(u,arguments)},function(){f.apply(u,arguments)})):(a.msg=t,a.state=1,n(r,a))}catch(s){f.call(u||new d(a),s)}}function f(t){var e=o(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 i=0;i<n.length;i++)t.resolve(n[i]).then(function(t){e(i,t)},r)}function s(t,n){return Array.isArray(n)?void 0:t.reject(TypeError("Not an array"))}function l(t,n){if("function"!=typeof t)throw TypeError("Not a function");if("function"!=typeof n)throw TypeError("Not a function")}function d(t){this.def=t,this.triggered=!1}function h(t){this.promise=t,this.state=0,this.triggered=!1,this.chain=[],this.msg=void 0}function p(t){if("function"!=typeof t)throw TypeError("Not a function");var e=this,i=new h(e);e.then=function(t,e){var o={success:"function"==typeof t?t:!0,failure:"function"==typeof e?e:!1};return o.promise=new p(function(t,n){l(t,n),o.resolve=t,o.reject=n}),i.chain.push(o),n(r,i),o.promise},e["catch"]=function(t){return i.promise.then(void 0,t)};try{t.call(void 0,function(t){return i.triggered?void(y=!1):(i.triggered=!0,void c.call(i,t))},function(t){return i.triggered?void(y=!1):(i.triggered=!0,void f.call(i,t))})}catch(o){f.call(i,o)}}var v,g,y=!1,m="undefined"!=typeof setImmediate?function(t){return setImmediate(t)}:setTimeout,w=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 g=t(),w(p,"prototype",{value:w({},"constructor",p)},!1),w(p,"resolve",function(t){var e=this;return"object"==typeof t&&t instanceof e?t:new e(function(e,r){l(e,r),n(function(){u(e,t)})})}),w(p,"reject",function(t){return new this(function(n,e){l(n,e),e(t)})}),w(p,"all",function(t){var n,e=this;return(n=s(e,t))?n:0===t.length?e.resolve([]):new e(function(n,r){l(n,r);var i=t.length,o=Array(i),c=0;a(e,t,function(t,e){o[t]=e,++c===i&&u(n,o)},r)})}),w(p,"race",function(t){var n,e=this;return(n=s(e,t))?n:new e(function(n,r){l(n,r),a(e,t,function(t,e){u(n,e)},r)})}),p});
!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(i,o){r=new t(i,o),e?e.next=r:n=r,e=r,r=void 0},drain:function(){for(;n;)n.fn.call(n.self),n=n.next;v=e=n}}}function n(t,n){y?(y=!1,t.call(n)):(g.add(t,n),v||(v=m(g.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,i(r,t,n);r.chain.length=0}function i(t,n,r){var i,o;try{n===!1?(y=!0,r.reject(t.msg)):(i=n===!0?t.msg:n.call(void 0,t.msg),y=!0,i===r.promise?r.reject(TypeError("Promise-chain cycle")):(o=e(i))?o.call(i,r.resolve,r.reject):r.resolve(i))}catch(c){y=!0,r.reject(c)}}function o(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 i,u,a=o(this);if(a!==!1)try{(i=e(t))?(u=new d(a),i.call(t,function(){c.apply(u,arguments)},function(){f.apply(u,arguments)})):(a.msg=t,a.state=1,n(r,a))}catch(s){f.call(u||new d(a),s)}}function f(t){var e=o(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 i=0;i<n.length;i++)!function(i){t.resolve(n[i]).then(function(t){e(i,t)},r)}(i)}function s(t,n){return Array.isArray(n)?void 0:t.reject(TypeError("Not an array"))}function l(t,n){if("function"!=typeof t)throw TypeError("Not a function");if("function"!=typeof n)throw TypeError("Not a function")}function d(t){this.def=t,this.triggered=!1}function h(t){this.promise=t,this.state=0,this.triggered=!1,this.chain=[],this.msg=void 0}function p(t){if("function"!=typeof t)throw TypeError("Not a function");var e=this,i=new h(e);e.then=function(t,e){var o={success:"function"==typeof t?t:!0,failure:"function"==typeof e?e:!1};return o.promise=new p(function(t,n){l(t,n),o.resolve=t,o.reject=n}),i.chain.push(o),n(r,i),o.promise},e["catch"]=function(t){return i.promise.then(void 0,t)};try{t.call(void 0,function(t){return i.triggered?void(y=!1):(i.triggered=!0,void c.call(i,t))},function(t){return i.triggered?void(y=!1):(i.triggered=!0,void f.call(i,t))})}catch(o){f.call(i,o)}}var v,g,y=!1,m="undefined"!=typeof setImmediate?function(t){return setImmediate(t)}:setTimeout,w=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 g=t(),w(p,"prototype",{value:w({},"constructor",p)},!1),w(p,"resolve",function(t){var e=this;return"object"==typeof t&&t instanceof e?t:new e(function(e,r){l(e,r),n(function(){u(e,t)})})}),w(p,"reject",function(t){return new this(function(n,e){l(n,e),e(t)})}),w(p,"all",function(t){var n,e=this;return(n=s(e,t))?n:0===t.length?e.resolve([]):new e(function(n,r){l(n,r);var i=t.length,o=Array(i),c=0;a(e,t,function(t,e){o[t]=e,++c===i&&u(n,o)},r)})}),w(p,"race",function(t){var n,e=this;return(n=s(e,t))?n:new e(function(n,r){l(n,r),a(e,t,function(t,e){u(n,e)},r)})}),p});
{
"name": "native-promise-only",
"version": "0.4.0-h",
"version": "0.4.1-a",
"description": "Native Promise Only: A polyfill for native ES6 Promises **only**, nothing else.",

@@ -5,0 +5,0 @@ "main": "./npo.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc