Last active
April 15, 2021 08:11
-
-
Save monkeymonk/ff196cb1a6bb7edfe9a93bbe16911bbe to your computer and use it in GitHub Desktop.
Return true if the given value is a callable object or function.
This file contains 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
/** | |
* Return true if the given value is a callable object or function. | |
* @param value | |
*/ | |
export default function isCallable(value) { | |
if (value === null || typeof value === 'number' || typeof value === 'undefined' || typeof value.call === 'undefined') { | |
return false; | |
} | |
return true; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment