Skip to content

Commit

Permalink
[Refactor] ES2015+: {,Ordinary}ObjectCreate: prefer __proto__ syn…
Browse files Browse the repository at this point in the history
…tax over `Object.create`
  • Loading branch information
ljharb committed Jan 22, 2025
1 parent 1f254bc commit 595e5f1
Show file tree
Hide file tree
Showing 10 changed files with 30 additions and 30 deletions.
6 changes: 3 additions & 3 deletions 2015/ObjectCreate.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ module.exports = function ObjectCreate(proto, internalSlotsList) {
}

var O;
if ($ObjectCreate) {
O = $ObjectCreate(proto);
} else if (hasProto) {
if (hasProto) {
O = { __proto__: proto };
} else if ($ObjectCreate) {
O = $ObjectCreate(proto);
} else {
if (proto === null) {
throw new $SyntaxError('native Object.create support is required to create null objects');
Expand Down
6 changes: 3 additions & 3 deletions 2016/ObjectCreate.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions 2017/ObjectCreate.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions 2018/ObjectCreate.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions 2019/ObjectCreate.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions 2020/OrdinaryObjectCreate.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ module.exports = function OrdinaryObjectCreate(proto) {
// return O; // step 5

var O;
if ($ObjectCreate) {
O = $ObjectCreate(proto);
} else if (hasProto) {
if (hasProto) {
O = { __proto__: proto };
} else if ($ObjectCreate) {
O = $ObjectCreate(proto);
} else {
if (proto === null) {
throw new $SyntaxError('native Object.create support is required to create null objects');
Expand Down
6 changes: 3 additions & 3 deletions 2021/OrdinaryObjectCreate.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions 2022/OrdinaryObjectCreate.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions 2023/OrdinaryObjectCreate.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions 2024/OrdinaryObjectCreate.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 595e5f1

Please sign in to comment.