Skip to content

Commit

Permalink
Merge pull request #1330 from minseok-choe/fix/issue-setPrototypeOf
Browse files Browse the repository at this point in the history
fix #1329
  • Loading branch information
zloirock authored Feb 22, 2024
2 parents 9fcf79b + 805f352 commit f838285
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/core-js/internals/object-set-prototype-of.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
'use strict';
/* eslint-disable no-proto -- safe */
var uncurryThisAccessor = require('../internals/function-uncurry-this-accessor');
var anObject = require('../internals/an-object');
var isObject = require('../internals/is-object');
var requireObjectCoercible = require('../internals/require-object-coercible');
var aPossiblePrototype = require('../internals/a-possible-prototype');

// `Object.setPrototypeOf` method
Expand All @@ -18,8 +19,9 @@ module.exports = Object.setPrototypeOf || ('__proto__' in {} ? function () {
CORRECT_SETTER = test instanceof Array;
} catch (error) { /* empty */ }
return function setPrototypeOf(O, proto) {
anObject(O);
requireObjectCoercible(O);
aPossiblePrototype(proto);
if (!isObject(O)) return O;
if (CORRECT_SETTER) setter(O, proto);
else O.__proto__ = proto;
return O;
Expand Down

0 comments on commit f838285

Please sign in to comment.