Skip to content

Commit

Permalink
revert isPromise and change only the condition inside function Q
Browse files Browse the repository at this point in the history
  • Loading branch information
vilicvane committed Aug 10, 2014
1 parent 7501502 commit 34d90bc
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions q.js
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ function Q(value) {
// If the object is already a Promise, return it directly. This enables
// the resolve function to both be used to created references from objects,
// but to tolerably coerce non-promises to promises.
if (isPromise(value)) {
if (value instanceof Promise) {
return value;
}

Expand Down Expand Up @@ -912,7 +912,9 @@ function nearer(value) {
*/
Q.isPromise = isPromise;
function isPromise(object) {
return object instanceof Promise;
return isObject(object) &&
typeof object.promiseDispatch === "function" &&
typeof object.inspect === "function";
}

Q.isPromiseAlike = isPromiseAlike;
Expand Down

0 comments on commit 34d90bc

Please sign in to comment.