Skip to content

Instantly share code, notes, and snippets.

@aMarCruz

aMarCruz/isFunction

Created May 4, 2015
Embed
What would you like to do?
Returns true if argument is a function (CommonJS)
// Safe isFunction()
// Avoid a Chakra JIT bug in compatibility modes of IE 11.
var isFunction = function (expr) {
return typeof expr === 'function' || false;
};
if (isFunction(/./) || (Uint8Array && !isFunction(Uint8Array))) {
isFunction = (function (expr) {
var _toString = Object.prototype.toString;
return function (expr) {
return _toString.call(expr) === '[object Function]';
};
})();
}
module.exports = isFunction;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment