Initial commit
[yaffs-website] / node_modules / grunt-contrib-watch / node_modules / globule / node_modules / lodash / _getRawTag.js
1 var Symbol = require('./_Symbol');
2
3 /** Used for built-in method references. */
4 var objectProto = Object.prototype;
5
6 /** Used to check objects for own properties. */
7 var hasOwnProperty = objectProto.hasOwnProperty;
8
9 /**
10  * Used to resolve the
11  * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
12  * of values.
13  */
14 var nativeObjectToString = objectProto.toString;
15
16 /** Built-in value references. */
17 var symToStringTag = Symbol ? Symbol.toStringTag : undefined;
18
19 /**
20  * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
21  *
22  * @private
23  * @param {*} value The value to query.
24  * @returns {string} Returns the raw `toStringTag`.
25  */
26 function getRawTag(value) {
27   var isOwn = hasOwnProperty.call(value, symToStringTag),
28       tag = value[symToStringTag];
29
30   try {
31     value[symToStringTag] = undefined;
32     var unmasked = true;
33   } catch (e) {}
34
35   var result = nativeObjectToString.call(value);
36   if (unmasked) {
37     if (isOwn) {
38       value[symToStringTag] = tag;
39     } else {
40       delete value[symToStringTag];
41     }
42   }
43   return result;
44 }
45
46 module.exports = getRawTag;