Comparing version 7.0.3 to 7.0.4
@@ -61,9 +61,9 @@ 'use strict'; | ||
} | ||
this._41 = 0; | ||
this._86 = null; | ||
this._17 = []; | ||
this._37 = 0; | ||
this._12 = null; | ||
this._59 = []; | ||
if (fn === noop) return; | ||
doResolve(fn, this); | ||
} | ||
Promise._1 = noop; | ||
Promise._99 = noop; | ||
@@ -87,20 +87,20 @@ Promise.prototype.then = function(onFulfilled, onRejected) { | ||
function handle(self, deferred) { | ||
while (self._41 === 3) { | ||
self = self._86; | ||
while (self._37 === 3) { | ||
self = self._12; | ||
} | ||
if (self._41 === 0) { | ||
self._17.push(deferred); | ||
if (self._37 === 0) { | ||
self._59.push(deferred); | ||
return; | ||
} | ||
asap(function() { | ||
var cb = self._41 === 1 ? deferred.onFulfilled : deferred.onRejected; | ||
var cb = self._37 === 1 ? deferred.onFulfilled : deferred.onRejected; | ||
if (cb === null) { | ||
if (self._41 === 1) { | ||
resolve(deferred.promise, self._86); | ||
if (self._37 === 1) { | ||
resolve(deferred.promise, self._12); | ||
} else { | ||
reject(deferred.promise, self._86); | ||
reject(deferred.promise, self._12); | ||
} | ||
return; | ||
} | ||
var ret = tryCallOne(cb, self._86); | ||
var ret = tryCallOne(cb, self._12); | ||
if (ret === IS_ERROR) { | ||
@@ -133,4 +133,4 @@ reject(deferred.promise, LAST_ERROR); | ||
) { | ||
self._41 = 3; | ||
self._86 = newValue; | ||
self._37 = 3; | ||
self._12 = newValue; | ||
finale(self); | ||
@@ -143,4 +143,4 @@ return; | ||
} | ||
self._41 = 1; | ||
self._86 = newValue; | ||
self._37 = 1; | ||
self._12 = newValue; | ||
finale(self); | ||
@@ -150,11 +150,11 @@ } | ||
function reject(self, newValue) { | ||
self._41 = 2; | ||
self._86 = newValue; | ||
self._37 = 2; | ||
self._12 = newValue; | ||
finale(self); | ||
} | ||
function finale(self) { | ||
for (var i = 0; i < self._17.length; i++) { | ||
handle(self, self._17[i]); | ||
for (var i = 0; i < self._59.length; i++) { | ||
handle(self, self._59[i]); | ||
} | ||
self._17 = null; | ||
self._59 = null; | ||
} | ||
@@ -161,0 +161,0 @@ |
@@ -6,3 +6,2 @@ 'use strict'; | ||
var Promise = require('./core.js'); | ||
var asap = require('asap'); | ||
@@ -21,5 +20,5 @@ module.exports = Promise; | ||
function valuePromise(value) { | ||
var p = new Promise(Promise._1); | ||
p._41 = 1; | ||
p._86 = value; | ||
var p = new Promise(Promise._99); | ||
p._37 = 1; | ||
p._12 = value; | ||
return p; | ||
@@ -61,7 +60,7 @@ } | ||
if (val instanceof Promise && val.then === Promise.prototype.then) { | ||
while (val._41 === 3) { | ||
val = val._86; | ||
while (val._37 === 3) { | ||
val = val._12; | ||
} | ||
if (val._41 === 1) return res(i, val._86); | ||
if (val._41 === 2) reject(val._86); | ||
if (val._37 === 1) return res(i, val._12); | ||
if (val._37 === 2) reject(val._12); | ||
val.then(function (val) { | ||
@@ -68,0 +67,0 @@ res(i, val); |
@@ -17,7 +17,5 @@ 'use strict'; | ||
var self = this; | ||
var args = Array.prototype.slice.call(arguments); | ||
var args = Array.prototype.slice.call(arguments, 0, | ||
argumentCount > 0 ? argumentCount : 0); | ||
return new Promise(function (resolve, reject) { | ||
while (args.length && args.length > argumentCount) { | ||
args.pop(); | ||
} | ||
args.push(function (err, res) { | ||
@@ -24,0 +22,0 @@ if (err) reject(err); |
@@ -61,9 +61,9 @@ 'use strict'; | ||
} | ||
this._41 = 0; | ||
this._86 = null; | ||
this._17 = []; | ||
this._37 = 0; | ||
this._12 = null; | ||
this._59 = []; | ||
if (fn === noop) return; | ||
doResolve(fn, this); | ||
} | ||
Promise._1 = noop; | ||
Promise._99 = noop; | ||
@@ -87,20 +87,20 @@ Promise.prototype.then = function(onFulfilled, onRejected) { | ||
function handle(self, deferred) { | ||
while (self._41 === 3) { | ||
self = self._86; | ||
while (self._37 === 3) { | ||
self = self._12; | ||
} | ||
if (self._41 === 0) { | ||
self._17.push(deferred); | ||
if (self._37 === 0) { | ||
self._59.push(deferred); | ||
return; | ||
} | ||
asap(function() { | ||
var cb = self._41 === 1 ? deferred.onFulfilled : deferred.onRejected; | ||
var cb = self._37 === 1 ? deferred.onFulfilled : deferred.onRejected; | ||
if (cb === null) { | ||
if (self._41 === 1) { | ||
resolve(deferred.promise, self._86); | ||
if (self._37 === 1) { | ||
resolve(deferred.promise, self._12); | ||
} else { | ||
reject(deferred.promise, self._86); | ||
reject(deferred.promise, self._12); | ||
} | ||
return; | ||
} | ||
var ret = tryCallOne(cb, self._86); | ||
var ret = tryCallOne(cb, self._12); | ||
if (ret === IS_ERROR) { | ||
@@ -133,4 +133,4 @@ reject(deferred.promise, LAST_ERROR); | ||
) { | ||
self._41 = 3; | ||
self._86 = newValue; | ||
self._37 = 3; | ||
self._12 = newValue; | ||
finale(self); | ||
@@ -143,4 +143,4 @@ return; | ||
} | ||
self._41 = 1; | ||
self._86 = newValue; | ||
self._37 = 1; | ||
self._12 = newValue; | ||
finale(self); | ||
@@ -150,11 +150,11 @@ } | ||
function reject(self, newValue) { | ||
self._41 = 2; | ||
self._86 = newValue; | ||
self._37 = 2; | ||
self._12 = newValue; | ||
finale(self); | ||
} | ||
function finale(self) { | ||
for (var i = 0; i < self._17.length; i++) { | ||
handle(self, self._17[i]); | ||
for (var i = 0; i < self._59.length; i++) { | ||
handle(self, self._59[i]); | ||
} | ||
self._17 = null; | ||
self._59 = null; | ||
} | ||
@@ -161,0 +161,0 @@ |
@@ -6,3 +6,2 @@ 'use strict'; | ||
var Promise = require('./core.js'); | ||
var asap = require('asap/raw'); | ||
@@ -21,5 +20,5 @@ module.exports = Promise; | ||
function valuePromise(value) { | ||
var p = new Promise(Promise._1); | ||
p._41 = 1; | ||
p._86 = value; | ||
var p = new Promise(Promise._99); | ||
p._37 = 1; | ||
p._12 = value; | ||
return p; | ||
@@ -61,7 +60,7 @@ } | ||
if (val instanceof Promise && val.then === Promise.prototype.then) { | ||
while (val._41 === 3) { | ||
val = val._86; | ||
while (val._37 === 3) { | ||
val = val._12; | ||
} | ||
if (val._41 === 1) return res(i, val._86); | ||
if (val._41 === 2) reject(val._86); | ||
if (val._37 === 1) return res(i, val._12); | ||
if (val._37 === 2) reject(val._12); | ||
val.then(function (val) { | ||
@@ -68,0 +67,0 @@ res(i, val); |
@@ -17,7 +17,5 @@ 'use strict'; | ||
var self = this; | ||
var args = Array.prototype.slice.call(arguments); | ||
var args = Array.prototype.slice.call(arguments, 0, | ||
argumentCount > 0 ? argumentCount : 0); | ||
return new Promise(function (resolve, reject) { | ||
while (args.length && args.length > argumentCount) { | ||
args.pop(); | ||
} | ||
args.push(function (err, res) { | ||
@@ -24,0 +22,0 @@ if (err) reject(err); |
{ | ||
"name": "promise", | ||
"version": "7.0.3", | ||
"version": "7.0.4", | ||
"description": "Bare bones Promises/A+ implementation", | ||
@@ -35,2 +35,2 @@ "main": "index.js", | ||
} | ||
} | ||
} |
@@ -61,9 +61,9 @@ 'use strict'; | ||
} | ||
this._41 = 0; | ||
this._86 = null; | ||
this._17 = []; | ||
this._37 = 0; | ||
this._12 = null; | ||
this._59 = []; | ||
if (fn === noop) return; | ||
doResolve(fn, this); | ||
} | ||
Promise._1 = noop; | ||
Promise._99 = noop; | ||
@@ -87,20 +87,20 @@ Promise.prototype.then = function(onFulfilled, onRejected) { | ||
function handle(self, deferred) { | ||
while (self._41 === 3) { | ||
self = self._86; | ||
while (self._37 === 3) { | ||
self = self._12; | ||
} | ||
if (self._41 === 0) { | ||
self._17.push(deferred); | ||
if (self._37 === 0) { | ||
self._59.push(deferred); | ||
return; | ||
} | ||
setImmediate(function() { | ||
var cb = self._41 === 1 ? deferred.onFulfilled : deferred.onRejected; | ||
var cb = self._37 === 1 ? deferred.onFulfilled : deferred.onRejected; | ||
if (cb === null) { | ||
if (self._41 === 1) { | ||
resolve(deferred.promise, self._86); | ||
if (self._37 === 1) { | ||
resolve(deferred.promise, self._12); | ||
} else { | ||
reject(deferred.promise, self._86); | ||
reject(deferred.promise, self._12); | ||
} | ||
return; | ||
} | ||
var ret = tryCallOne(cb, self._86); | ||
var ret = tryCallOne(cb, self._12); | ||
if (ret === IS_ERROR) { | ||
@@ -133,4 +133,4 @@ reject(deferred.promise, LAST_ERROR); | ||
) { | ||
self._41 = 3; | ||
self._86 = newValue; | ||
self._37 = 3; | ||
self._12 = newValue; | ||
finale(self); | ||
@@ -143,4 +143,4 @@ return; | ||
} | ||
self._41 = 1; | ||
self._86 = newValue; | ||
self._37 = 1; | ||
self._12 = newValue; | ||
finale(self); | ||
@@ -150,11 +150,11 @@ } | ||
function reject(self, newValue) { | ||
self._41 = 2; | ||
self._86 = newValue; | ||
self._37 = 2; | ||
self._12 = newValue; | ||
finale(self); | ||
} | ||
function finale(self) { | ||
for (var i = 0; i < self._17.length; i++) { | ||
handle(self, self._17[i]); | ||
for (var i = 0; i < self._59.length; i++) { | ||
handle(self, self._59[i]); | ||
} | ||
self._17 = null; | ||
self._59 = null; | ||
} | ||
@@ -161,0 +161,0 @@ |
@@ -7,3 +7,2 @@ 'use strict'; | ||
module.exports = Promise; | ||
@@ -21,5 +20,5 @@ | ||
function valuePromise(value) { | ||
var p = new Promise(Promise._1); | ||
p._41 = 1; | ||
p._86 = value; | ||
var p = new Promise(Promise._99); | ||
p._37 = 1; | ||
p._12 = value; | ||
return p; | ||
@@ -61,7 +60,7 @@ } | ||
if (val instanceof Promise && val.then === Promise.prototype.then) { | ||
while (val._41 === 3) { | ||
val = val._86; | ||
while (val._37 === 3) { | ||
val = val._12; | ||
} | ||
if (val._41 === 1) return res(i, val._86); | ||
if (val._41 === 2) reject(val._86); | ||
if (val._37 === 1) return res(i, val._12); | ||
if (val._37 === 2) reject(val._12); | ||
val.then(function (val) { | ||
@@ -68,0 +67,0 @@ res(i, val); |
@@ -17,7 +17,5 @@ 'use strict'; | ||
var self = this; | ||
var args = Array.prototype.slice.call(arguments); | ||
var args = Array.prototype.slice.call(arguments, 0, | ||
argumentCount > 0 ? argumentCount : 0); | ||
return new Promise(function (resolve, reject) { | ||
while (args.length && args.length > argumentCount) { | ||
args.pop(); | ||
} | ||
args.push(function (err, res) { | ||
@@ -24,0 +22,0 @@ if (err) reject(err); |
@@ -6,3 +6,2 @@ 'use strict'; | ||
var Promise = require('./core.js'); | ||
var asap = require('asap/raw'); | ||
@@ -9,0 +8,0 @@ module.exports = Promise; |
@@ -17,7 +17,5 @@ 'use strict'; | ||
var self = this; | ||
var args = Array.prototype.slice.call(arguments); | ||
var args = Array.prototype.slice.call(arguments, 0, | ||
argumentCount > 0 ? argumentCount : 0); | ||
return new Promise(function (resolve, reject) { | ||
while (args.length && args.length > argumentCount) { | ||
args.pop(); | ||
} | ||
args.push(function (err, res) { | ||
@@ -24,0 +22,0 @@ if (err) reject(err); |
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
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
50811
1515
1