1 var isObject = require('./isObject');
3 /** `Object#toString` result references. */
4 var funcTag = '[object Function]',
5 genTag = '[object GeneratorFunction]';
7 /** Used for built-in method references. */
8 var objectProto = Object.prototype;
11 * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
14 var objectToString = objectProto.toString;
17 * Checks if `value` is classified as a `Function` object.
22 * @param {*} value The value to check.
23 * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
29 * _.isFunction(/abc/);
32 function isFunction(value) {
33 // The use of `Object#toString` avoids issues with the `typeof` operator
34 // in Safari 8 which returns 'object' for typed array constructors, and
35 // PhantomJS 1.9 which returns 'function' for `NodeList` instances.
36 var tag = isObject(value) ? objectToString.call(value) : '';
37 return tag == funcTag || tag == genTag;
40 module.exports = isFunction;