5e11a00d3c85226d92dd7823bce6699380a73b94
[yaffs-website] / node_modules / grunt-legacy-log-utils / node_modules / lodash / isSymbol.js
1 var isObjectLike = require('./isObjectLike');
2
3 /** `Object#toString` result references. */
4 var symbolTag = '[object Symbol]';
5
6 /** Used for built-in method references. */
7 var objectProto = Object.prototype;
8
9 /**
10  * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
11  * of values.
12  */
13 var objectToString = objectProto.toString;
14
15 /**
16  * Checks if `value` is classified as a `Symbol` primitive or object.
17  *
18  * @static
19  * @memberOf _
20  * @category Lang
21  * @param {*} value The value to check.
22  * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
23  * @example
24  *
25  * _.isSymbol(Symbol.iterator);
26  * // => true
27  *
28  * _.isSymbol('abc');
29  * // => false
30  */
31 function isSymbol(value) {
32   return typeof value == 'symbol' ||
33     (isObjectLike(value) && objectToString.call(value) == symbolTag);
34 }
35
36 module.exports = isSymbol;