Skip to content

Commit

Permalink
[Refactor] use gopd
Browse files Browse the repository at this point in the history
  • Loading branch information
ljharb committed Nov 8, 2022
1 parent 89916cc commit 35912aa
Show file tree
Hide file tree
Showing 44 changed files with 45 additions and 54 deletions.
2 changes: 1 addition & 1 deletion 2015/ObjectDefineProperties.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ var ToObject = require('./ToObject');
var ToPropertyDescriptor = require('./ToPropertyDescriptor');

var forEach = require('../helpers/forEach');
var getOwnPropertyDescriptor = require('../helpers/getOwnPropertyDescriptor');
var getOwnPropertyDescriptor = require('gopd');
var OwnPropertyKeys = require('../helpers/OwnPropertyKeys');

var $push = callBound('Array.prototype.push');
Expand Down
2 changes: 1 addition & 1 deletion 2015/OrdinaryDefineOwnProperty.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

var GetIntrinsic = require('get-intrinsic');

var $gOPD = require('../helpers/getOwnPropertyDescriptor');
var $gOPD = require('gopd');
var $SyntaxError = GetIntrinsic('%SyntaxError%');
var $TypeError = GetIntrinsic('%TypeError%');

Expand Down
2 changes: 1 addition & 1 deletion 2015/OrdinaryGetOwnProperty.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

var GetIntrinsic = require('get-intrinsic');

var $gOPD = require('../helpers/getOwnPropertyDescriptor');
var $gOPD = require('gopd');
var $TypeError = GetIntrinsic('%TypeError%');

var callBound = require('call-bind/callBound');
Expand Down
2 changes: 1 addition & 1 deletion 2015/SetIntegrityLevel.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ var GetIntrinsic = require('get-intrinsic');
var $SyntaxError = GetIntrinsic('%SyntaxError%');
var $TypeError = GetIntrinsic('%TypeError%');
var $preventExtensions = GetIntrinsic('%Object.preventExtensions%', true);
var $gOPD = require('../helpers/getOwnPropertyDescriptor');
var $gOPD = require('gopd');
var $gOPN = GetIntrinsic('%Object.getOwnPropertyNames%', true);

var forEach = require('../helpers/forEach');
Expand Down
2 changes: 1 addition & 1 deletion 2015/TestIntegrityLevel.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

var GetIntrinsic = require('get-intrinsic');

var $gOPD = require('../helpers/getOwnPropertyDescriptor');
var $gOPD = require('gopd');
var $TypeError = GetIntrinsic('%TypeError%');

var every = require('../helpers/every');
Expand Down
2 changes: 1 addition & 1 deletion 2016/ObjectDefineProperties.js

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

2 changes: 1 addition & 1 deletion 2016/OrdinaryDefineOwnProperty.js

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

2 changes: 1 addition & 1 deletion 2016/OrdinaryGetOwnProperty.js

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

2 changes: 1 addition & 1 deletion 2016/SetIntegrityLevel.js

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

2 changes: 1 addition & 1 deletion 2016/TestIntegrityLevel.js

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

2 changes: 1 addition & 1 deletion 2017/ObjectDefineProperties.js

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

2 changes: 1 addition & 1 deletion 2017/OrdinaryDefineOwnProperty.js

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

2 changes: 1 addition & 1 deletion 2017/OrdinaryGetOwnProperty.js

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

2 changes: 1 addition & 1 deletion 2017/SetIntegrityLevel.js

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

2 changes: 1 addition & 1 deletion 2017/TestIntegrityLevel.js

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

2 changes: 1 addition & 1 deletion 2018/ObjectDefineProperties.js

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

2 changes: 1 addition & 1 deletion 2018/OrdinaryDefineOwnProperty.js

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

2 changes: 1 addition & 1 deletion 2018/OrdinaryGetOwnProperty.js

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

2 changes: 1 addition & 1 deletion 2018/SetIntegrityLevel.js

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

2 changes: 1 addition & 1 deletion 2018/TestIntegrityLevel.js

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

2 changes: 1 addition & 1 deletion 2019/ObjectDefineProperties.js

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

2 changes: 1 addition & 1 deletion 2019/OrdinaryDefineOwnProperty.js

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

2 changes: 1 addition & 1 deletion 2019/OrdinaryGetOwnProperty.js

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

2 changes: 1 addition & 1 deletion 2019/SetIntegrityLevel.js

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

2 changes: 1 addition & 1 deletion 2019/TestIntegrityLevel.js

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

2 changes: 1 addition & 1 deletion 2020/ObjectDefineProperties.js

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

2 changes: 1 addition & 1 deletion 2020/OrdinaryDefineOwnProperty.js

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

2 changes: 1 addition & 1 deletion 2020/OrdinaryGetOwnProperty.js

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

2 changes: 1 addition & 1 deletion 2020/SetIntegrityLevel.js

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

2 changes: 1 addition & 1 deletion 2020/TestIntegrityLevel.js

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

2 changes: 1 addition & 1 deletion 2021/ObjectDefineProperties.js

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

2 changes: 1 addition & 1 deletion 2021/OrdinaryDefineOwnProperty.js

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

2 changes: 1 addition & 1 deletion 2021/OrdinaryGetOwnProperty.js

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

2 changes: 1 addition & 1 deletion 2021/SetIntegrityLevel.js

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

2 changes: 1 addition & 1 deletion 2021/TestIntegrityLevel.js

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

2 changes: 1 addition & 1 deletion 2022/ObjectDefineProperties.js

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

2 changes: 1 addition & 1 deletion 2022/OrdinaryDefineOwnProperty.js

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

2 changes: 1 addition & 1 deletion 2022/OrdinaryGetOwnProperty.js

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

2 changes: 1 addition & 1 deletion 2022/SetIntegrityLevel.js

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

2 changes: 1 addition & 1 deletion 2022/TestIntegrityLevel.js

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

14 changes: 2 additions & 12 deletions helpers/getOwnPropertyDescriptor.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,5 @@
'use strict';

var GetIntrinsic = require('get-intrinsic');
// TODO: remove, semver-major

var $gOPD = GetIntrinsic('%Object.getOwnPropertyDescriptor%', true);
if ($gOPD) {
try {
$gOPD([], 'length');
} catch (e) {
// IE 8 has a broken gOPD
$gOPD = null;
}
}

module.exports = $gOPD;
module.exports = require('gopd');
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
"function.prototype.name": "^1.1.5",
"get-intrinsic": "^1.1.3",
"get-symbol-description": "^1.0.0",
"gopd": "^1.0.1",
"has": "^1.0.3",
"has-property-descriptors": "^1.0.0",
"has-symbols": "^1.0.3",
Expand Down
2 changes: 1 addition & 1 deletion test/GetIntrinsic.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ var mockProperty = require('mock-property');

var callBound = require('call-bind/callBound');
var v = require('es-value-fixtures');
var $gOPD = require('../helpers/getOwnPropertyDescriptor');
var $gOPD = require('gopd');
var DefinePropertyOrThrow = require('../2021/DefinePropertyOrThrow');

var $isProto = callBound('%Object.prototype.isPrototypeOf%');
Expand Down
Loading

0 comments on commit 35912aa

Please sign in to comment.