diff options
author | Florian Dold <florian.dold@gmail.com> | 2017-08-14 05:01:11 +0200 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2017-08-14 05:02:09 +0200 |
commit | 363723fc84f7b8477592e0105aeb331ec9a017af (patch) | |
tree | 29f92724f34131bac64d6a318dd7e30612e631c7 /node_modules/promise/lib | |
parent | 5634e77ad96bfe1818f6b6ee70b7379652e5487f (diff) |
node_modules
Diffstat (limited to 'node_modules/promise/lib')
-rw-r--r-- | node_modules/promise/lib/core.js | 82 | ||||
-rw-r--r-- | node_modules/promise/lib/es6-extensions.js | 12 | ||||
-rw-r--r-- | node_modules/promise/lib/node-extensions.js | 6 | ||||
-rw-r--r-- | node_modules/promise/lib/rejection-tracking.js | 28 | ||||
-rw-r--r-- | node_modules/promise/lib/synchronous.js | 20 |
5 files changed, 74 insertions, 74 deletions
diff --git a/node_modules/promise/lib/core.js b/node_modules/promise/lib/core.js index 207fb819b..aefc987b6 100644 --- a/node_modules/promise/lib/core.js +++ b/node_modules/promise/lib/core.js @@ -56,17 +56,17 @@ function Promise(fn) { throw new TypeError('Promises must be constructed via new'); } if (typeof fn !== 'function') { - throw new TypeError('not a function'); + throw new TypeError('Promise constructor\'s argument is not a function'); } - this._45 = 0; - this._81 = 0; - this._65 = null; - this._54 = null; + this._40 = 0; + this._65 = 0; + this._55 = null; + this._72 = null; if (fn === noop) return; doResolve(fn, this); } -Promise._10 = null; -Promise._97 = null; +Promise._37 = null; +Promise._87 = null; Promise._61 = noop; Promise.prototype.then = function(onFulfilled, onRejected) { @@ -84,26 +84,26 @@ function safeThen(self, onFulfilled, onRejected) { res.then(resolve, reject); handle(self, new Handler(onFulfilled, onRejected, res)); }); -}; +} function handle(self, deferred) { - while (self._81 === 3) { - self = self._65; + while (self._65 === 3) { + self = self._55; } - if (Promise._10) { - Promise._10(self); + if (Promise._37) { + Promise._37(self); } - if (self._81 === 0) { - if (self._45 === 0) { - self._45 = 1; - self._54 = deferred; + if (self._65 === 0) { + if (self._40 === 0) { + self._40 = 1; + self._72 = deferred; return; } - if (self._45 === 1) { - self._45 = 2; - self._54 = [self._54, deferred]; + if (self._40 === 1) { + self._40 = 2; + self._72 = [self._72, deferred]; return; } - self._54.push(deferred); + self._72.push(deferred); return; } handleResolved(self, deferred); @@ -111,16 +111,16 @@ function handle(self, deferred) { function handleResolved(self, deferred) { asap(function() { - var cb = self._81 === 1 ? deferred.onFulfilled : deferred.onRejected; + var cb = self._65 === 1 ? deferred.onFulfilled : deferred.onRejected; if (cb === null) { - if (self._81 === 1) { - resolve(deferred.promise, self._65); + if (self._65 === 1) { + resolve(deferred.promise, self._55); } else { - reject(deferred.promise, self._65); + reject(deferred.promise, self._55); } return; } - var ret = tryCallOne(cb, self._65); + var ret = tryCallOne(cb, self._55); if (ret === IS_ERROR) { reject(deferred.promise, LAST_ERROR); } else { @@ -148,8 +148,8 @@ function resolve(self, newValue) { then === self.then && newValue instanceof Promise ) { - self._81 = 3; - self._65 = newValue; + self._65 = 3; + self._55 = newValue; finale(self); return; } else if (typeof then === 'function') { @@ -157,29 +157,29 @@ function resolve(self, newValue) { return; } } - self._81 = 1; - self._65 = newValue; + self._65 = 1; + self._55 = newValue; finale(self); } function reject(self, newValue) { - self._81 = 2; - self._65 = newValue; - if (Promise._97) { - Promise._97(self, newValue); + self._65 = 2; + self._55 = newValue; + if (Promise._87) { + Promise._87(self, newValue); } finale(self); } function finale(self) { - if (self._45 === 1) { - handle(self, self._54); - self._54 = null; + if (self._40 === 1) { + handle(self, self._72); + self._72 = null; } - if (self._45 === 2) { - for (var i = 0; i < self._54.length; i++) { - handle(self, self._54[i]); + if (self._40 === 2) { + for (var i = 0; i < self._72.length; i++) { + handle(self, self._72[i]); } - self._54 = null; + self._72 = null; } } @@ -205,7 +205,7 @@ function doResolve(fn, promise) { if (done) return; done = true; reject(promise, reason); - }) + }); if (!done && res === IS_ERROR) { done = true; reject(promise, LAST_ERROR); diff --git a/node_modules/promise/lib/es6-extensions.js b/node_modules/promise/lib/es6-extensions.js index 1ab6eae56..8ab266698 100644 --- a/node_modules/promise/lib/es6-extensions.js +++ b/node_modules/promise/lib/es6-extensions.js @@ -17,8 +17,8 @@ var EMPTYSTRING = valuePromise(''); function valuePromise(value) { var p = new Promise(Promise._61); - p._81 = 1; - p._65 = value; + p._65 = 1; + p._55 = value; return p; } Promise.resolve = function (value) { @@ -55,11 +55,11 @@ Promise.all = function (arr) { function res(i, val) { if (val && (typeof val === 'object' || typeof val === 'function')) { if (val instanceof Promise && val.then === Promise.prototype.then) { - while (val._81 === 3) { - val = val._65; + while (val._65 === 3) { + val = val._55; } - if (val._81 === 1) return res(i, val._65); - if (val._81 === 2) reject(val._65); + if (val._65 === 1) return res(i, val._55); + if (val._65 === 2) reject(val._55); val.then(function (val) { res(i, val); }, reject); diff --git a/node_modules/promise/lib/node-extensions.js b/node_modules/promise/lib/node-extensions.js index 890ae45dc..157cddc2b 100644 --- a/node_modules/promise/lib/node-extensions.js +++ b/node_modules/promise/lib/node-extensions.js @@ -18,7 +18,7 @@ Promise.denodeify = function (fn, argumentCount) { } else { return denodeifyWithoutCount(fn); } -} +}; var callbackFn = ( 'function (err, res) {' + @@ -113,7 +113,7 @@ Promise.nodeify = function (fn) { } } } -} +}; Promise.prototype.nodeify = function (callback, ctx) { if (typeof callback != 'function') return this; @@ -127,4 +127,4 @@ Promise.prototype.nodeify = function (callback, ctx) { callback.call(ctx, err); }); }); -} +}; diff --git a/node_modules/promise/lib/rejection-tracking.js b/node_modules/promise/lib/rejection-tracking.js index 088a0deaa..10ccce306 100644 --- a/node_modules/promise/lib/rejection-tracking.js +++ b/node_modules/promise/lib/rejection-tracking.js @@ -12,8 +12,8 @@ var enabled = false; exports.disable = disable; function disable() { enabled = false; - Promise._10 = null; - Promise._97 = null; + Promise._37 = null; + Promise._87 = null; } exports.enable = enable; @@ -24,27 +24,27 @@ function enable(options) { var id = 0; var displayId = 0; var rejections = {}; - Promise._10 = function (promise) { + Promise._37 = function (promise) { if ( - promise._81 === 2 && // IS REJECTED - rejections[promise._72] + promise._65 === 2 && // IS REJECTED + rejections[promise._51] ) { - if (rejections[promise._72].logged) { - onHandled(promise._72); + if (rejections[promise._51].logged) { + onHandled(promise._51); } else { - clearTimeout(rejections[promise._72].timeout); + clearTimeout(rejections[promise._51].timeout); } - delete rejections[promise._72]; + delete rejections[promise._51]; } }; - Promise._97 = function (promise, err) { - if (promise._45 === 0) { // not yet handled - promise._72 = id++; - rejections[promise._72] = { + Promise._87 = function (promise, err) { + if (promise._40 === 0) { // not yet handled + promise._51 = id++; + rejections[promise._51] = { displayId: null, error: err, timeout: setTimeout( - onUnhandled.bind(null, promise._72), + onUnhandled.bind(null, promise._51), // For reference errors and type errors, this almost always // means the programmer made a mistake, so log them after just // 100ms diff --git a/node_modules/promise/lib/synchronous.js b/node_modules/promise/lib/synchronous.js index 2f97451aa..49399644b 100644 --- a/node_modules/promise/lib/synchronous.js +++ b/node_modules/promise/lib/synchronous.js @@ -17,38 +17,38 @@ Promise.enableSynchronous = function () { }; Promise.prototype.getValue = function () { - if (this._81 === 3) { - return this._65.getValue(); + if (this._65 === 3) { + return this._55.getValue(); } if (!this.isFulfilled()) { throw new Error('Cannot get a value of an unfulfilled promise.'); } - return this._65; + return this._55; }; Promise.prototype.getReason = function () { - if (this._81 === 3) { - return this._65.getReason(); + if (this._65 === 3) { + return this._55.getReason(); } if (!this.isRejected()) { throw new Error('Cannot get a rejection reason of a non-rejected promise.'); } - return this._65; + return this._55; }; Promise.prototype.getState = function () { - if (this._81 === 3) { - return this._65.getState(); + if (this._65 === 3) { + return this._55.getState(); } - if (this._81 === -1 || this._81 === -2) { + if (this._65 === -1 || this._65 === -2) { return 0; } - return this._81; + return this._65; }; }; |