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.7.4-a to 0.7.5-a

10

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

@@ -226,3 +226,3 @@ */

self.then = function then(success,failure) {
builtInProp(self,"then",function then(success,failure) {
var o = {

@@ -250,7 +250,7 @@ success: typeof success == "function" ? success : true,

return o.promise;
};
},false);
// `catch` not allowed as identifier in older JS engines
self["catch"] = function $catch$(failure) {
builtInProp(self,"catch",function $catch$(failure) {
return this.then(void 0,failure);
};
},false);

@@ -257,0 +257,0 @@ try {

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