1 | var Symbol = require('./_Symbol');
|
2 |
|
3 |
|
4 | var objectProto = Object.prototype;
|
5 |
|
6 |
|
7 | var hasOwnProperty = objectProto.hasOwnProperty;
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 | var nativeObjectToString = objectProto.toString;
|
15 |
|
16 |
|
17 | var symToStringTag = Symbol ? Symbol.toStringTag : undefined;
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
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;
|