a1d9530c65e19e3a473b46d55184578074fae076
[yaffs-website] / node_modules / grunt-legacy-util / node_modules / lodash / isFunction.js
1 var isObject = require('./isObject');
2
3 /** `Object#toString` result references. */
4 var funcTag = '[object Function]',
5     genTag = '[object GeneratorFunction]';
6
7 /** Used for built-in method references. */
8 var objectProto = Object.prototype;
9
10 /**
11  * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
12  * of values.
13  */
14 var objectToString = objectProto.toString;
15
16 /**
17  * Checks if `value` is classified as a `Function` object.
18  *
19  * @static
20  * @memberOf _
21  * @category Lang
22  * @param {*} value The value to check.
23  * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
24  * @example
25  *
26  * _.isFunction(_);
27  * // => true
28  *
29  * _.isFunction(/abc/);
30  * // => false
31  */
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;
38 }
39
40 module.exports = isFunction;