Created
January 21, 2015 19:24
-
-
Save isRuslan/ac4339ffa13619a5e630 to your computer and use it in GitHub Desktop.
Check if it is a promise?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Check if `value` is a promise | |
* Future "native" ES6 promise you can just ckeck: | |
* value instanceof Promise | |
*/ | |
function check (value) { | |
return value && 'then' in value && typeof value.then == 'function'; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment