.gitignore added
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-prettier / node_modules / core-js / internals / object-set-prototype-of.js
1 /* eslint-disable no-proto -- safe */
2 var anObject = require('../internals/an-object');
3 var aPossiblePrototype = require('../internals/a-possible-prototype');
4
5 // `Object.setPrototypeOf` method
6 // https://tc39.es/ecma262/#sec-object.setprototypeof
7 // Works with __proto__ only. Old v8 can't work with null proto objects.
8 module.exports = Object.setPrototypeOf || ('__proto__' in {} ? function () {
9   var CORRECT_SETTER = false;
10   var test = {};
11   var setter;
12   try {
13     setter = Object.getOwnPropertyDescriptor(Object.prototype, '__proto__').set;
14     setter.call(test, []);
15     CORRECT_SETTER = test instanceof Array;
16   } catch (error) { /* empty */ }
17   return function setPrototypeOf(O, proto) {
18     anObject(O);
19     aPossiblePrototype(proto);
20     if (CORRECT_SETTER) setter.call(O, proto);
21     else O.__proto__ = proto;
22     return O;
23   };
24 }() : undefined);