New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

p-promise

Package Overview
Dependencies
Maintainers
1
Versions
41
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

p-promise - npm Package Compare versions

Comparing version 0.1.1 to 0.1.2

61

p.js

@@ -77,4 +77,4 @@ ;(function( factory ){

if ( ot(typeof process) && process && ft(typeof process.nextTick) ) {
//requestTick = process.nextTick;
runLater = process.nextTick;
requestTick = process.nextTick;
//runLater = process.nextTick;

@@ -136,2 +136,12 @@ } else if ( wow && ft(typeof wow.setImmediate) ) {

function T( cb, tt ) {
var t = tt.t;
return function( a, b, c ) {
if ( t === tt.t ) {
++tt.t;
cb( a, b, c );
}
};
}
isArray = Array.isArray || function( val ) {

@@ -173,2 +183,3 @@ return !!val && toStr.call( val ) === "[object Array]";

var pending = [],
tt = {t: 0},
fulfilled = false,

@@ -186,2 +197,3 @@ value;

var res = func( value );
} catch ( ex ) {

@@ -218,2 +230,3 @@ def ? def.reject( ex ) : reportError( ex );

if ( pending ) {
if ( alt === ALT ) { // settle

@@ -224,28 +237,26 @@ fulfilled = !!ok;

pending = null;
return;
}
if ( x instanceof Promise ) {
} else if ( x instanceof Promise ) {
x.then( fulfill, reject, ALT, true );
return;
}
var then, type = typeof x;
} else if ( x === Object(x) ) {
runLater(function() {
try {
var then = x.then;
if ( type === "object" && x !== null || type === "function" ) {
try {
then = x.then;
if ( typeof then === "function" ) {
then.call( x, T(resolve, tt), T(reject, tt) );
if ( typeof then === "function" ) {
then.call( x, resolve, reject );
return;
} else {
fulfill( x );
}
} catch ( ex ) {
reject( ex );
}
});
} catch ( ex ) {
reject( ex );
return;
}
} else {
fulfill( x );
}
fulfill( x );
}

@@ -264,4 +275,4 @@ }

promise: new Promise( then ),
resolve: resolve,
reject: reject
resolve: T(resolve, tt),
reject: T(reject, tt)
};

@@ -280,4 +291,6 @@ }

Promise.prototype.spread = function( cb, eb ) {
return this.then(cb && function( values ) {
return cb.apply( void 0, values );
return this.then(cb && function( array ) {
return all( array ).then(function( values ) {
return cb.apply( void 0, values );
});
}, eb);

@@ -284,0 +297,0 @@ };

@@ -1,1 +0,1 @@

(function(e){if(typeof module!=="undefined"&&module&&module.exports){module.exports=e()}else if(typeof define==="function"&&define.amd){define(e)}else{P=e()}})(function(){"use strict";var e={f:null,w:false,n:null},n=e,t=true,r=0,o=0,i,f,u=v(typeof window)&&window||v(typeof worker)&&worker,c=e.toString,s,a={};function l(){--r;if(e.n){if(!r&&e.n.n){++r;f(l,0)}do{e=e.n;if(e.w){--o}var n=e.f;e.f=null;n()}while(e.n)}t=true}var p=function(e,i){if(t&&++o>r){++r;f(l,0)}n=n.n={f:e,w:t,n:null};t=i===true};function v(e){return e==="object"||e==="function"}function m(e){return e==="function"}if(v(typeof process)&&process&&m(typeof process.nextTick)){p=process.nextTick}else if(u&&m(typeof u.setImmediate)){f=function(e){u.setImmediate(e)}}else if(m(typeof MessageChannel)){i=new MessageChannel;i.port1.onmessage=l;f=function(){i.port2.postMessage(0)}}else{f=setTimeout;if(u&&v(typeof Image)&&Image){(function(){var e=0;var n=function(e){var n=new Image;n.onerror=e;n.src="data:image/png,"};try{n(function(){if(--e===0){f=n}});++e}catch(t){}e&&setTimeout(function(){e=0},0)})()}}function y(e){p(function(){if(w.onerror){w.onerror(e)}else{throw e}},true)}s=Array.isArray||function(e){return!!e&&c.call(e)==="[object Array]"};function d(e,n){for(var t=0,r=e.length;t<r;++t){if(t in e){n(e[t],t)}}}function h(e,n){if(s(e)){d(e,n);return}for(var t in e){n(e[t],t)}}function w(e){if(e instanceof T){return e}var n=g();n.resolve(e);return n.promise}w.defer=g;function g(){var e=[],n=false,t;function r(r,o,i,f){var u=i===a?void 0:g();function c(){var e=n?r:o;if(typeof e==="function"){try{var i=e(t)}catch(f){u?u.reject(f):y(f);return}u&&u.resolve(i)}else if(u){u.resolve(t,a,n)}else if(!n){y(t)}}if(e){e.push(c)}else if(!u&&f){c()}else{p(c)}return u&&u.promise}function o(r,u,c){if(e){if(u===a){n=!!c;t=r;d(e,p);e=null;return}if(r instanceof T){r.then(i,f,a,true);return}var s,l=typeof r;if(l==="object"&&r!==null||l==="function"){try{s=r.then;if(typeof s==="function"){s.call(r,o,f);return}}catch(v){f(v);return}}i(r)}}function i(e){o(e,a,true)}function f(e){o(e,a,false)}return{promise:new T(r),resolve:o,reject:f}}function T(e){this.then=e}T.prototype.done=function(e,n){this.then(e,n,a)};T.prototype.spread=function(e,n){return this.then(e&&function(n){return e.apply(void 0,n)},n)};T.prototype.timeout=function(e){var n=g();var t=setTimeout(function(){n.reject(new Error("Timed out after "+e+" ms"))},e);this.then(function(e){clearTimeout(t);n.resolve(e)},function(e){clearTimeout(t);n.reject(e)},a,true);return n.promise};T.prototype.delay=function(e){var n=this;var t=g();setTimeout(function(){t.resolve(n)},e);return t.promise};w.all=j;function j(e){var n=0;var t=g();h(e,function(r,o){++n;w(r).then(function(r){e[o]=r;if(--n===0){t.resolve(e)}},t.reject,a)});if(n===0){t.resolve(e)}return t.promise}w.onerror=null;w.prototype=T.prototype;w.nextTick=function(e){p(e,true)};w._each=h;return w});
(function(e){if(typeof module!=="undefined"&&module&&module.exports){module.exports=e()}else if(typeof define==="function"&&define.amd){define(e)}else{P=e()}})(function(){"use strict";var e={f:null,w:false,n:null},n=e,t=true,r=0,o=0,i,f,u=v(typeof window)&&window||v(typeof worker)&&worker,c=e.toString,s,a={};function l(){--r;if(e.n){if(!r&&e.n.n){++r;f(l,0)}do{e=e.n;if(e.w){--o}var n=e.f;e.f=null;n()}while(e.n)}t=true}var p=function(e,i){if(t&&++o>r){++r;f(l,0)}n=n.n={f:e,w:t,n:null};t=i===true};function v(e){return e==="object"||e==="function"}function m(e){return e==="function"}if(v(typeof process)&&process&&m(typeof process.nextTick)){f=process.nextTick}else if(u&&m(typeof u.setImmediate)){f=function(e){u.setImmediate(e)}}else if(m(typeof MessageChannel)){i=new MessageChannel;i.port1.onmessage=l;f=function(){i.port2.postMessage(0)}}else{f=setTimeout;if(u&&v(typeof Image)&&Image){(function(){var e=0;var n=function(e){var n=new Image;n.onerror=e;n.src="data:image/png,"};try{n(function(){if(--e===0){f=n}});++e}catch(t){}e&&setTimeout(function(){e=0},0)})()}}function y(e){p(function(){if(g.onerror){g.onerror(e)}else{throw e}},true)}function d(e,n){var t=n.t;return function(r,o,i){if(t===n.t){++n.t;e(r,o,i)}}}s=Array.isArray||function(e){return!!e&&c.call(e)==="[object Array]"};function h(e,n){for(var t=0,r=e.length;t<r;++t){if(t in e){n(e[t],t)}}}function w(e,n){if(s(e)){h(e,n);return}for(var t in e){n(e[t],t)}}function g(e){if(e instanceof j){return e}var n=T();n.resolve(e);return n.promise}g.defer=T;function T(){var e=[],n={t:0},t=false,r;function o(n,o,i,f){var u=i===a?void 0:T();function c(){var e=t?n:o;if(typeof e==="function"){try{var i=e(r)}catch(f){u?u.reject(f):y(f);return}u&&u.resolve(i)}else if(u){u.resolve(r,a,t)}else if(!t){y(r)}}if(e){e.push(c)}else if(!u&&f){c()}else{p(c)}return u&&u.promise}function i(o,c,s){if(e){if(c===a){t=!!s;r=o;h(e,p);e=null}else if(o instanceof j){o.then(f,u,a,true)}else if(o===Object(o)){p(function(){try{var e=o.then;if(typeof e==="function"){e.call(o,d(i,n),d(u,n))}else{f(o)}}catch(t){u(t)}})}else{f(o)}}}function f(e){i(e,a,true)}function u(e){i(e,a,false)}return{promise:new j(o),resolve:d(i,n),reject:d(u,n)}}function j(e){this.then=e}j.prototype.done=function(e,n){this.then(e,n,a)};j.prototype.spread=function(e,n){return this.then(e&&function(n){return k(n).then(function(n){return e.apply(void 0,n)})},n)};j.prototype.timeout=function(e){var n=T();var t=setTimeout(function(){n.reject(new Error("Timed out after "+e+" ms"))},e);this.then(function(e){clearTimeout(t);n.resolve(e)},function(e){clearTimeout(t);n.reject(e)},a,true);return n.promise};j.prototype.delay=function(e){var n=this;var t=T();setTimeout(function(){t.resolve(n)},e);return t.promise};g.all=k;function k(e){var n=0;var t=T();w(e,function(r,o){++n;g(r).then(function(r){e[o]=r;if(--n===0){t.resolve(e)}},t.reject,a)});if(n===0){t.resolve(e)}return t.promise}g.onerror=null;g.prototype=j.prototype;g.nextTick=function(e){p(e,true)};g._each=w;return g});
{
"name": "p-promise",
"version": "0.1.1",
"version": "0.1.2",
"description": "A simple Promises/A+ library.",

@@ -5,0 +5,0 @@ "author": "Robert Katić <robert.katic@gmail.com> (https://github.com/rkatic)",

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