1 | 'use strict';
|
2 | var TO_STRING_TAG_SUPPORT = require('../internals/to-string-tag-support');
|
3 | var isCallable = require('../internals/is-callable');
|
4 | var classofRaw = require('../internals/classof-raw');
|
5 | var wellKnownSymbol = require('../internals/well-known-symbol');
|
6 |
|
7 | var TO_STRING_TAG = wellKnownSymbol('toStringTag');
|
8 | var $Object = Object;
|
9 |
|
10 |
|
11 | var CORRECT_ARGUMENTS = classofRaw(function () { return arguments; }()) === 'Arguments';
|
12 |
|
13 |
|
14 | var tryGet = function (it, key) {
|
15 | try {
|
16 | return it[key];
|
17 | } catch (error) { }
|
18 | };
|
19 |
|
20 |
|
21 | module.exports = TO_STRING_TAG_SUPPORT ? classofRaw : function (it) {
|
22 | var O, tag, result;
|
23 | return it === undefined ? 'Undefined' : it === null ? 'Null'
|
24 |
|
25 | : typeof (tag = tryGet(O = $Object(it), TO_STRING_TAG)) == 'string' ? tag
|
26 |
|
27 | : CORRECT_ARGUMENTS ? classofRaw(O)
|
28 |
|
29 | : (result = classofRaw(O)) === 'Object' && isCallable(O.callee) ? 'Arguments' : result;
|
30 | };
|