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

promise

Package Overview
Dependencies
Maintainers
2
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

promise - npm Package Compare versions

Comparing version 7.1.1 to 7.2.0

index.d.ts

82

domains/core.js

@@ -59,14 +59,14 @@ 'use strict';

if (typeof fn !== 'function') {
throw new TypeError('not a function');
throw new TypeError('Promise constructor\'s argument is not a function');
}
this._94 = 0;
this._45 = 0;
this._81 = 0;
this._65 = null;
this._54 = null;
this._87 = null;
this._29 = null;
if (fn === noop) return;
doResolve(fn, this);
}
Promise._10 = null;
Promise._97 = null;
Promise._61 = noop;
Promise._42 = null;
Promise._40 = null;
Promise._85 = noop;

@@ -88,22 +88,22 @@ Promise.prototype.then = function(onFulfilled, onRejected) {

});
};
}
function handle(self, deferred) {
while (self._81 === 3) {
self = self._65;
while (self._45 === 3) {
self = self._87;
}
if (Promise._10) {
Promise._10(self);
if (Promise._42) {
Promise._42(self);
}
if (self._81 === 0) {
if (self._45 === 0) {
self._45 = 1;
self._54 = deferred;
if (self._45 === 0) {
if (self._94 === 0) {
self._94 = 1;
self._29 = deferred;
return;
}
if (self._45 === 1) {
self._45 = 2;
self._54 = [self._54, deferred];
if (self._94 === 1) {
self._94 = 2;
self._29 = [self._29, deferred];
return;
}
self._54.push(deferred);
self._29.push(deferred);
return;

@@ -116,12 +116,12 @@ }

asap(function() {
var cb = self._81 === 1 ? deferred.onFulfilled : deferred.onRejected;
var cb = self._45 === 1 ? deferred.onFulfilled : deferred.onRejected;
if (cb === null) {
if (self._81 === 1) {
resolve(deferred.promise, self._65);
if (self._45 === 1) {
resolve(deferred.promise, self._87);
} else {
reject(deferred.promise, self._65);
reject(deferred.promise, self._87);
}
return;
}
var ret = tryCallOne(cb, self._65);
var ret = tryCallOne(cb, self._87);
if (ret === IS_ERROR) {

@@ -154,4 +154,4 @@ reject(deferred.promise, LAST_ERROR);

) {
self._81 = 3;
self._65 = newValue;
self._45 = 3;
self._87 = newValue;
finale(self);

@@ -164,4 +164,4 @@ return;

}
self._81 = 1;
self._65 = newValue;
self._45 = 1;
self._87 = newValue;
finale(self);

@@ -171,6 +171,6 @@ }

function reject(self, newValue) {
self._81 = 2;
self._65 = newValue;
if (Promise._97) {
Promise._97(self, newValue);
self._45 = 2;
self._87 = newValue;
if (Promise._40) {
Promise._40(self, newValue);
}

@@ -180,11 +180,11 @@ finale(self);

function finale(self) {
if (self._45 === 1) {
handle(self, self._54);
self._54 = null;
if (self._94 === 1) {
handle(self, self._29);
self._29 = null;
}
if (self._45 === 2) {
for (var i = 0; i < self._54.length; i++) {
handle(self, self._54[i]);
if (self._94 === 2) {
for (var i = 0; i < self._29.length; i++) {
handle(self, self._29[i]);
}
self._54 = null;
self._29 = null;
}

@@ -215,3 +215,3 @@ }

reject(promise, reason);
})
});
if (!done && res === IS_ERROR) {

@@ -218,0 +218,0 @@ done = true;

@@ -19,5 +19,5 @@ 'use strict';

function valuePromise(value) {
var p = new Promise(Promise._61);
p._81 = 1;
p._65 = value;
var p = new Promise(Promise._85);
p._45 = 1;
p._87 = value;
return p;

@@ -59,7 +59,7 @@ }

if (val instanceof Promise && val.then === Promise.prototype.then) {
while (val._81 === 3) {
val = val._65;
while (val._45 === 3) {
val = val._87;
}
if (val._81 === 1) return res(i, val._65);
if (val._81 === 2) reject(val._65);
if (val._45 === 1) return res(i, val._87);
if (val._45 === 2) reject(val._87);
val.then(function (val) {

@@ -66,0 +66,0 @@ res(i, val);

@@ -21,3 +21,3 @@ 'use strict';

}
}
};

@@ -117,3 +117,3 @@ var callbackFn = (

}
}
};

@@ -132,2 +132,2 @@ Promise.prototype.nodeify = function (callback, ctx) {

});
}
};

@@ -15,4 +15,4 @@ 'use strict';

enabled = false;
Promise._10 = null;
Promise._97 = null;
Promise._42 = null;
Promise._40 = null;
}

@@ -28,23 +28,23 @@

var rejections = {};
Promise._10 = function (promise) {
Promise._42 = function (promise) {
if (
promise._81 === 2 && // IS REJECTED
rejections[promise._72]
promise._45 === 2 && // IS REJECTED
rejections[promise._84]
) {
if (rejections[promise._72].logged) {
onHandled(promise._72);
if (rejections[promise._84].logged) {
onHandled(promise._84);
} else {
clearTimeout(rejections[promise._72].timeout);
clearTimeout(rejections[promise._84].timeout);
}
delete rejections[promise._72];
delete rejections[promise._84];
}
};
Promise._97 = function (promise, err) {
if (promise._45 === 0) { // not yet handled
promise._72 = id++;
rejections[promise._72] = {
Promise._40 = function (promise, err) {
if (promise._94 === 0) { // not yet handled
promise._84 = id++;
rejections[promise._84] = {
displayId: null,
error: err,
timeout: setTimeout(
onUnhandled.bind(null, promise._72),
onUnhandled.bind(null, promise._84),
// For reference errors and type errors, this almost always

@@ -51,0 +51,0 @@ // means the programmer made a mistake, so log them after just

@@ -20,4 +20,4 @@ 'use strict';

Promise.prototype.getValue = function () {
if (this._81 === 3) {
return this._65.getValue();
if (this._45 === 3) {
return this._87.getValue();
}

@@ -29,8 +29,8 @@

return this._65;
return this._87;
};
Promise.prototype.getReason = function () {
if (this._81 === 3) {
return this._65.getReason();
if (this._45 === 3) {
return this._87.getReason();
}

@@ -42,14 +42,14 @@

return this._65;
return this._87;
};
Promise.prototype.getState = function () {
if (this._81 === 3) {
return this._65.getState();
if (this._45 === 3) {
return this._87.getState();
}
if (this._81 === -1 || this._81 === -2) {
if (this._45 === -1 || this._45 === -2) {
return 0;
}
return this._81;
return this._45;
};

@@ -56,0 +56,0 @@ };

@@ -59,14 +59,14 @@ 'use strict';

if (typeof fn !== 'function') {
throw new TypeError('not a function');
throw new TypeError('Promise constructor\'s argument is not a function');
}
this._94 = 0;
this._45 = 0;
this._81 = 0;
this._65 = null;
this._54 = null;
this._87 = null;
this._29 = null;
if (fn === noop) return;
doResolve(fn, this);
}
Promise._10 = null;
Promise._97 = null;
Promise._61 = noop;
Promise._42 = null;
Promise._40 = null;
Promise._85 = noop;

@@ -88,22 +88,22 @@ Promise.prototype.then = function(onFulfilled, onRejected) {

});
};
}
function handle(self, deferred) {
while (self._81 === 3) {
self = self._65;
while (self._45 === 3) {
self = self._87;
}
if (Promise._10) {
Promise._10(self);
if (Promise._42) {
Promise._42(self);
}
if (self._81 === 0) {
if (self._45 === 0) {
self._45 = 1;
self._54 = deferred;
if (self._45 === 0) {
if (self._94 === 0) {
self._94 = 1;
self._29 = deferred;
return;
}
if (self._45 === 1) {
self._45 = 2;
self._54 = [self._54, deferred];
if (self._94 === 1) {
self._94 = 2;
self._29 = [self._29, deferred];
return;
}
self._54.push(deferred);
self._29.push(deferred);
return;

@@ -116,12 +116,12 @@ }

asap(function() {
var cb = self._81 === 1 ? deferred.onFulfilled : deferred.onRejected;
var cb = self._45 === 1 ? deferred.onFulfilled : deferred.onRejected;
if (cb === null) {
if (self._81 === 1) {
resolve(deferred.promise, self._65);
if (self._45 === 1) {
resolve(deferred.promise, self._87);
} else {
reject(deferred.promise, self._65);
reject(deferred.promise, self._87);
}
return;
}
var ret = tryCallOne(cb, self._65);
var ret = tryCallOne(cb, self._87);
if (ret === IS_ERROR) {

@@ -154,4 +154,4 @@ reject(deferred.promise, LAST_ERROR);

) {
self._81 = 3;
self._65 = newValue;
self._45 = 3;
self._87 = newValue;
finale(self);

@@ -164,4 +164,4 @@ return;

}
self._81 = 1;
self._65 = newValue;
self._45 = 1;
self._87 = newValue;
finale(self);

@@ -171,6 +171,6 @@ }

function reject(self, newValue) {
self._81 = 2;
self._65 = newValue;
if (Promise._97) {
Promise._97(self, newValue);
self._45 = 2;
self._87 = newValue;
if (Promise._40) {
Promise._40(self, newValue);
}

@@ -180,11 +180,11 @@ finale(self);

function finale(self) {
if (self._45 === 1) {
handle(self, self._54);
self._54 = null;
if (self._94 === 1) {
handle(self, self._29);
self._29 = null;
}
if (self._45 === 2) {
for (var i = 0; i < self._54.length; i++) {
handle(self, self._54[i]);
if (self._94 === 2) {
for (var i = 0; i < self._29.length; i++) {
handle(self, self._29[i]);
}
self._54 = null;
self._29 = null;
}

@@ -215,3 +215,3 @@ }

reject(promise, reason);
})
});
if (!done && res === IS_ERROR) {

@@ -218,0 +218,0 @@ done = true;

@@ -19,5 +19,5 @@ 'use strict';

function valuePromise(value) {
var p = new Promise(Promise._61);
p._81 = 1;
p._65 = value;
var p = new Promise(Promise._85);
p._45 = 1;
p._87 = value;
return p;

@@ -59,7 +59,7 @@ }

if (val instanceof Promise && val.then === Promise.prototype.then) {
while (val._81 === 3) {
val = val._65;
while (val._45 === 3) {
val = val._87;
}
if (val._81 === 1) return res(i, val._65);
if (val._81 === 2) reject(val._65);
if (val._45 === 1) return res(i, val._87);
if (val._45 === 2) reject(val._87);
val.then(function (val) {

@@ -66,0 +66,0 @@ res(i, val);

@@ -21,3 +21,3 @@ 'use strict';

}
}
};

@@ -117,3 +117,3 @@ var callbackFn = (

}
}
};

@@ -132,2 +132,2 @@ Promise.prototype.nodeify = function (callback, ctx) {

});
}
};

@@ -15,4 +15,4 @@ 'use strict';

enabled = false;
Promise._10 = null;
Promise._97 = null;
Promise._42 = null;
Promise._40 = null;
}

@@ -28,23 +28,23 @@

var rejections = {};
Promise._10 = function (promise) {
Promise._42 = function (promise) {
if (
promise._81 === 2 && // IS REJECTED
rejections[promise._72]
promise._45 === 2 && // IS REJECTED
rejections[promise._84]
) {
if (rejections[promise._72].logged) {
onHandled(promise._72);
if (rejections[promise._84].logged) {
onHandled(promise._84);
} else {
clearTimeout(rejections[promise._72].timeout);
clearTimeout(rejections[promise._84].timeout);
}
delete rejections[promise._72];
delete rejections[promise._84];
}
};
Promise._97 = function (promise, err) {
if (promise._45 === 0) { // not yet handled
promise._72 = id++;
rejections[promise._72] = {
Promise._40 = function (promise, err) {
if (promise._94 === 0) { // not yet handled
promise._84 = id++;
rejections[promise._84] = {
displayId: null,
error: err,
timeout: setTimeout(
onUnhandled.bind(null, promise._72),
onUnhandled.bind(null, promise._84),
// For reference errors and type errors, this almost always

@@ -51,0 +51,0 @@ // means the programmer made a mistake, so log them after just

@@ -20,4 +20,4 @@ 'use strict';

Promise.prototype.getValue = function () {
if (this._81 === 3) {
return this._65.getValue();
if (this._45 === 3) {
return this._87.getValue();
}

@@ -29,8 +29,8 @@

return this._65;
return this._87;
};
Promise.prototype.getReason = function () {
if (this._81 === 3) {
return this._65.getReason();
if (this._45 === 3) {
return this._87.getReason();
}

@@ -42,14 +42,14 @@

return this._65;
return this._87;
};
Promise.prototype.getState = function () {
if (this._81 === 3) {
return this._65.getState();
if (this._45 === 3) {
return this._87.getState();
}
if (this._81 === -1 || this._81 === -2) {
if (this._45 === -1 || this._45 === -2) {
return 0;
}
return this._81;
return this._45;
};

@@ -56,0 +56,0 @@ };

{
"name": "promise",
"version": "7.1.1",
"version": "7.2.0",
"description": "Bare bones Promises/A+ implementation",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -17,4 +17,4 @@ <a href="https://promisesaplus.com/"><img src="https://promisesaplus.com/assets/logo-small.png" align="right" /></a>

[travis-url]: https://travis-ci.org/then/promise
[dep-image]: https://img.shields.io/gemnasium/then/promise.svg?style=flat
[dep-url]: https://gemnasium.com/then/promise
[dep-image]: https://img.shields.io/david/then/promise.svg?style=flat
[dep-url]: https://david-dm.org/then/promise
[npm-image]: https://img.shields.io/npm/v/promise.svg?style=flat

@@ -21,0 +21,0 @@ [npm-url]: https://npmjs.org/package/promise

@@ -59,14 +59,14 @@ 'use strict';

if (typeof fn !== 'function') {
throw new TypeError('not a function');
throw new TypeError('Promise constructor\'s argument is not a function');
}
this._94 = 0;
this._45 = 0;
this._81 = 0;
this._65 = null;
this._54 = null;
this._87 = null;
this._29 = null;
if (fn === noop) return;
doResolve(fn, this);
}
Promise._10 = null;
Promise._97 = null;
Promise._61 = noop;
Promise._42 = null;
Promise._40 = null;
Promise._85 = noop;

@@ -88,22 +88,22 @@ Promise.prototype.then = function(onFulfilled, onRejected) {

});
};
}
function handle(self, deferred) {
while (self._81 === 3) {
self = self._65;
while (self._45 === 3) {
self = self._87;
}
if (Promise._10) {
Promise._10(self);
if (Promise._42) {
Promise._42(self);
}
if (self._81 === 0) {
if (self._45 === 0) {
self._45 = 1;
self._54 = deferred;
if (self._45 === 0) {
if (self._94 === 0) {
self._94 = 1;
self._29 = deferred;
return;
}
if (self._45 === 1) {
self._45 = 2;
self._54 = [self._54, deferred];
if (self._94 === 1) {
self._94 = 2;
self._29 = [self._29, deferred];
return;
}
self._54.push(deferred);
self._29.push(deferred);
return;

@@ -116,12 +116,12 @@ }

setImmediate(function() {
var cb = self._81 === 1 ? deferred.onFulfilled : deferred.onRejected;
var cb = self._45 === 1 ? deferred.onFulfilled : deferred.onRejected;
if (cb === null) {
if (self._81 === 1) {
resolve(deferred.promise, self._65);
if (self._45 === 1) {
resolve(deferred.promise, self._87);
} else {
reject(deferred.promise, self._65);
reject(deferred.promise, self._87);
}
return;
}
var ret = tryCallOne(cb, self._65);
var ret = tryCallOne(cb, self._87);
if (ret === IS_ERROR) {

@@ -154,4 +154,4 @@ reject(deferred.promise, LAST_ERROR);

) {
self._81 = 3;
self._65 = newValue;
self._45 = 3;
self._87 = newValue;
finale(self);

@@ -164,4 +164,4 @@ return;

}
self._81 = 1;
self._65 = newValue;
self._45 = 1;
self._87 = newValue;
finale(self);

@@ -171,6 +171,6 @@ }

function reject(self, newValue) {
self._81 = 2;
self._65 = newValue;
if (Promise._97) {
Promise._97(self, newValue);
self._45 = 2;
self._87 = newValue;
if (Promise._40) {
Promise._40(self, newValue);
}

@@ -180,11 +180,11 @@ finale(self);

function finale(self) {
if (self._45 === 1) {
handle(self, self._54);
self._54 = null;
if (self._94 === 1) {
handle(self, self._29);
self._29 = null;
}
if (self._45 === 2) {
for (var i = 0; i < self._54.length; i++) {
handle(self, self._54[i]);
if (self._94 === 2) {
for (var i = 0; i < self._29.length; i++) {
handle(self, self._29[i]);
}
self._54 = null;
self._29 = null;
}

@@ -215,3 +215,3 @@ }

reject(promise, reason);
})
});
if (!done && res === IS_ERROR) {

@@ -218,0 +218,0 @@ done = true;

@@ -19,5 +19,5 @@ 'use strict';

function valuePromise(value) {
var p = new Promise(Promise._61);
p._81 = 1;
p._65 = value;
var p = new Promise(Promise._85);
p._45 = 1;
p._87 = value;
return p;

@@ -59,7 +59,7 @@ }

if (val instanceof Promise && val.then === Promise.prototype.then) {
while (val._81 === 3) {
val = val._65;
while (val._45 === 3) {
val = val._87;
}
if (val._81 === 1) return res(i, val._65);
if (val._81 === 2) reject(val._65);
if (val._45 === 1) return res(i, val._87);
if (val._45 === 2) reject(val._87);
val.then(function (val) {

@@ -66,0 +66,0 @@ res(i, val);

@@ -21,3 +21,3 @@ 'use strict';

}
}
};

@@ -117,3 +117,3 @@ var callbackFn = (

}
}
};

@@ -132,2 +132,2 @@ Promise.prototype.nodeify = function (callback, ctx) {

});
}
};

@@ -15,4 +15,4 @@ 'use strict';

enabled = false;
Promise._10 = null;
Promise._97 = null;
Promise._42 = null;
Promise._40 = null;
}

@@ -28,23 +28,23 @@

var rejections = {};
Promise._10 = function (promise) {
Promise._42 = function (promise) {
if (
promise._81 === 2 && // IS REJECTED
rejections[promise._72]
promise._45 === 2 && // IS REJECTED
rejections[promise._84]
) {
if (rejections[promise._72].logged) {
onHandled(promise._72);
if (rejections[promise._84].logged) {
onHandled(promise._84);
} else {
clearTimeout(rejections[promise._72].timeout);
clearTimeout(rejections[promise._84].timeout);
}
delete rejections[promise._72];
delete rejections[promise._84];
}
};
Promise._97 = function (promise, err) {
if (promise._45 === 0) { // not yet handled
promise._72 = id++;
rejections[promise._72] = {
Promise._40 = function (promise, err) {
if (promise._94 === 0) { // not yet handled
promise._84 = id++;
rejections[promise._84] = {
displayId: null,
error: err,
timeout: setTimeout(
onUnhandled.bind(null, promise._72),
onUnhandled.bind(null, promise._84),
// For reference errors and type errors, this almost always

@@ -51,0 +51,0 @@ // means the programmer made a mistake, so log them after just

@@ -20,4 +20,4 @@ 'use strict';

Promise.prototype.getValue = function () {
if (this._81 === 3) {
return this._65.getValue();
if (this._45 === 3) {
return this._87.getValue();
}

@@ -29,8 +29,8 @@

return this._65;
return this._87;
};
Promise.prototype.getReason = function () {
if (this._81 === 3) {
return this._65.getReason();
if (this._45 === 3) {
return this._87.getReason();
}

@@ -42,14 +42,14 @@

return this._65;
return this._87;
};
Promise.prototype.getState = function () {
if (this._81 === 3) {
return this._65.getState();
if (this._45 === 3) {
return this._87.getState();
}
if (this._81 === -1 || this._81 === -2) {
if (this._45 === -1 || this._45 === -2) {
return 0;
}
return this._81;
return this._45;
};

@@ -56,0 +56,0 @@ };

@@ -59,3 +59,3 @@ 'use strict';

if (typeof fn !== 'function') {
throw new TypeError('not a function');
throw new TypeError('Promise constructor\'s argument is not a function');
}

@@ -88,3 +88,3 @@ this._deferredState = 0;

});
};
}
function handle(self, deferred) {

@@ -210,3 +210,3 @@ while (self._state === 3) {

reject(promise, reason);
})
});
if (!done && res === IS_ERROR) {

@@ -213,0 +213,0 @@ done = true;

@@ -21,3 +21,3 @@ 'use strict';

}
}
};

@@ -117,3 +117,3 @@ var callbackFn = (

}
}
};

@@ -132,2 +132,2 @@ Promise.prototype.nodeify = function (callback, ctx) {

});
}
};
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