source: trip-planner-front/node_modules/core-js/internals/object-set-prototype-of.js@ ceaed42

Last change on this file since ceaed42 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 1002 bytes
Line 
1/* eslint-disable no-proto -- safe */
2var anObject = require('../internals/an-object');
3var 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// eslint-disable-next-line es/no-object-setprototypeof -- safe
9module.exports = Object.setPrototypeOf || ('__proto__' in {} ? function () {
10 var CORRECT_SETTER = false;
11 var test = {};
12 var setter;
13 try {
14 // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
15 setter = Object.getOwnPropertyDescriptor(Object.prototype, '__proto__').set;
16 setter.call(test, []);
17 CORRECT_SETTER = test instanceof Array;
18 } catch (error) { /* empty */ }
19 return function setPrototypeOf(O, proto) {
20 anObject(O);
21 aPossiblePrototype(proto);
22 if (CORRECT_SETTER) setter.call(O, proto);
23 else O.__proto__ = proto;
24 return O;
25 };
26}() : undefined);
Note: See TracBrowser for help on using the repository browser.