16 lines
426 B
JavaScript
16 lines
426 B
JavaScript
module.exports = isFunction
|
|
|
|
var toString = Object.prototype.toString
|
|
|
|
function isFunction (fn) {
|
|
var string = toString.call(fn)
|
|
return string === '[object Function]' ||
|
|
(typeof fn === 'function' && string !== '[object RegExp]') ||
|
|
(typeof window !== 'undefined' &&
|
|
// IE8 and below
|
|
(fn === window.setTimeout ||
|
|
fn === window.alert ||
|
|
fn === window.confirm ||
|
|
fn === window.prompt))
|
|
};
|