Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use instanceof to determine whether an object is a Q promise inside function Q #566

Merged
merged 2 commits into from
Sep 11, 2014

Conversation

vilicvane
Copy link
Collaborator

Considering modules using nested Q may have different versions or plugins (yup, such as my q-retry), I think it would be safer to determine whether the Q-promise-alike object is the instance of current Q promise constructor. So that the promise chain would be more reliable especially when promises are widely used in different modules.

This would bring a little bit performance impact, but it should be considered minor (actually only one more coerce for two modules and a single chain).

@vilicvane vilicvane changed the title use instanceof to determine whether an object is a Q promise (isPromise function). use instanceof to determine whether an object is a Q promise inside function Q Aug 10, 2014
@kriskowal
Copy link
Owner

I am likely to merge this.

@vilicvane
Copy link
Collaborator Author

hope you will. ;)

@kriskowal kriskowal merged commit 34d90bc into kriskowal:v1 Sep 11, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants