Skip to content

Commit

Permalink
[Robustness] use gopd and es-object-atoms
Browse files Browse the repository at this point in the history
  • Loading branch information
ljharb committed Dec 11, 2024
1 parent 3f32d5d commit babe493
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@
"dependencies": {
"call-bind": "^1.0.8",
"es-errors": "^1.3.0",
"es-object-atoms": "^1.0.0",
"get-symbol-description": "^1.0.2",
"gopd": "^1.2.0",
"has-symbols": "^1.1.0",
"object.getownpropertydescriptors": "^2.1.8"
},
Expand Down
2 changes: 1 addition & 1 deletion polyfill.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
var hasSymbols = require('has-symbols')();

var implementation = require('./implementation');
var gOPD = Object.getOwnPropertyDescriptor;
var gOPD = require('gopd');

module.exports = function descriptionPolyfill() {
if (!hasSymbols || typeof gOPD !== 'function') {
Expand Down
11 changes: 6 additions & 5 deletions shim.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@ var hasSymbols = require('has-symbols')();
var polyfill = require('./polyfill');
var getInferredName = require('get-symbol-description/getInferredName');

var gOPD = Object.getOwnPropertyDescriptor;
var $Object = require('es-object-atoms');
var gOPD = require('gopd');
var gOPDs = require('object.getownpropertydescriptors/polyfill')();
var dP = Object.defineProperty;
var dPs = Object.defineProperties;
var setProto = Object.setPrototypeOf;
var dP = $Object.defineProperty;
var dPs = $Object.defineProperties;
var setProto = $Object.setPrototypeOf;

var define = function defineGetter(getter) {
dP(Symbol.prototype, 'description', {
Expand All @@ -20,7 +21,7 @@ var define = function defineGetter(getter) {

var shimGlobal = function shimGlobalSymbol(getter) {
var origSym = Function.apply.bind(Symbol);
var emptyStrings = Object.create ? Object.create(null) : {};
var emptyStrings = $Object.create ? $Object.create(null) : {};
var SymNew = function Symbol() {
var sym = origSym(this, arguments);
if (arguments.length > 0 && arguments[0] === '') {
Expand Down

0 comments on commit babe493

Please sign in to comment.