Skip to content

Commit

Permalink
Use instanceof instanceof to recognize promises
Browse files Browse the repository at this point in the history
  • Loading branch information
kriskowal committed Nov 10, 2014
1 parent de8e152 commit 077efa7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
11 changes: 11 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
<!-- vim:ts=4:sts=4:sw=4:et:tw=70 -->

## 1.0.2

- Use instanceof to recognize own promise instances as opposed to
thenables.
- Construct timeout errors with `code === ETIMEDOUT` (Kornel Lesiński)
- More descriminant CommonJS module environment detection.
- Dropped continuous integration for Node.js 0.6 and 0.8 because of
changes to npm that preclude the use of new `^` version predicate
operator in any transitive dependency.
- Users can now override `Q.nextTick`.

## 1.0.1

- Adds support for `Q.Promise`, which implements common usage of the
Expand Down
4 changes: 1 addition & 3 deletions q.js
Original file line number Diff line number Diff line change
Expand Up @@ -912,9 +912,7 @@ function nearer(value) {
*/
Q.isPromise = isPromise;
function isPromise(object) {
return isObject(object) &&
typeof object.promiseDispatch === "function" &&
typeof object.inspect === "function";
return object instanceof Promise;
}

Q.isPromiseAlike = isPromiseAlike;
Expand Down

0 comments on commit 077efa7

Please sign in to comment.