diff options
Diffstat (limited to 'node_modules/es5-ext/object/is-plain-function.js')
-rw-r--r-- | node_modules/es5-ext/object/is-plain-function.js | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/node_modules/es5-ext/object/is-plain-function.js b/node_modules/es5-ext/object/is-plain-function.js new file mode 100644 index 000000000..a2f32348a --- /dev/null +++ b/node_modules/es5-ext/object/is-plain-function.js @@ -0,0 +1,11 @@ +"use strict"; + +var isClassStr = RegExp.prototype.test.bind(/^\s*class[\s{/}]/) + , fnToString = Function.prototype.toString; + +module.exports = function (fn) { + if (typeof fn !== "function") return false; + if (typeof fn.call !== "function") return false; + if (typeof fn.apply !== "function") return false; + return !isClassStr(fnToString.call(fn)); +}; |