Created
May 4, 2015 08:12
-
-
Save aMarCruz/50a7b8be65a7bdf535eb to your computer and use it in GitHub Desktop.
Returns true if argument is a function (CommonJS)
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
// 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