Skip to content

Instantly share code, notes, and snippets.

@monkeymonk
Last active April 15, 2021 08:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save monkeymonk/ff196cb1a6bb7edfe9a93bbe16911bbe to your computer and use it in GitHub Desktop.
Save monkeymonk/ff196cb1a6bb7edfe9a93bbe16911bbe to your computer and use it in GitHub Desktop.
Return true if the given value is a callable object or function.
/**
* 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