不要怂,就是干,撸起袖子干!

Commit 387abfa7 by Jan Aagaard Meier

Forgot to copy-pasta a helper function from bluebird

1 parent f3711679
Showing with 24 additions and 19 deletions
......@@ -101,32 +101,32 @@ SequelizePromise.method = function (fn) {
};
SequelizePromise.prototype._resolveFromSyncValue = function(value) {
if (value && value.hasOwnProperty('e')) {
this._cleanValues();
this._setRejected();
this._settledValue = value.e;
this._ensurePossibleRejectionHandled();
if (value && value.hasOwnProperty('e')) {
this._cleanValues();
this._setRejected();
this._settledValue = value.e;
this._ensurePossibleRejectionHandled();
}
else {
var maybePromise = Promise._cast(value, void 0);
if (maybePromise instanceof Promise || maybePromise instanceof SequelizePromise) {
this._follow(maybePromise);
}
else {
var maybePromise = Promise._cast(value, void 0);
if (maybePromise instanceof Promise || maybePromise instanceof SequelizePromise) {
this._follow(maybePromise);
}
else {
this._cleanValues();
this._setFulfilled();
this._settledValue = value;
}
this._cleanValues();
this._setFulfilled();
this._settledValue = value;
}
}
};
SequelizePromise.attempt = SequelizePromise.try = function (fn, args, ctx) {
var value = tryCatchApply(fn, args, ctx)
var value = tryCatchApply(fn, args, ctx)
var ret = new SequelizePromise(INTERNAL);
ret._setTrace(void 0);
ret._resolveFromSyncValue(value);
return ret;
var ret = new SequelizePromise(INTERNAL);
ret._setTrace(void 0);
ret._resolveFromSyncValue(value);
return ret;
};
// Need to hack resolve cause we can't hack all directrly
......@@ -414,4 +414,8 @@ function tryCatchApply(fn, args, receiver) {
}
}
function asString(val) {
return typeof val === "string" ? val : ("" + val);
}
module.exports = SequelizePromise;
\ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!