massive update, probably broken
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-prettier / node_modules / core-js / internals / classof.js
1 var global = require('../internals/global');
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 = global.Object;
9
10 // ES3 wrong here
11 var CORRECT_ARGUMENTS = classofRaw(function () { return arguments; }()) == 'Arguments';
12
13 // fallback for IE11 Script Access Denied error
14 var tryGet = function (it, key) {
15   try {
16     return it[key];
17   } catch (error) { /* empty */ }
18 };
19
20 // getting tag from ES6+ `Object.prototype.toString`
21 module.exports = TO_STRING_TAG_SUPPORT ? classofRaw : function (it) {
22   var O, tag, result;
23   return it === undefined ? 'Undefined' : it === null ? 'Null'
24     // @@toStringTag case
25     : typeof (tag = tryGet(O = Object(it), TO_STRING_TAG)) == 'string' ? tag
26     // builtinTag case
27     : CORRECT_ARGUMENTS ? classofRaw(O)
28     // ES3 arguments fallback
29     : (result = classofRaw(O)) == 'Object' && isCallable(O.callee) ? 'Arguments' : result;
30 };