Skip to content

Commit

Permalink
[Refactor] use get-proto and es-errors
Browse files Browse the repository at this point in the history
  • Loading branch information
ljharb committed Jan 2, 2025
1 parent c630183 commit 6355772
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@
"call-bind": "^1.0.8",
"define-properties": "^1.2.1",
"es-errors": "^1.3.0",
"get-proto": "^1.0.1",
"gopd": "^1.2.0",
"set-function-name": "^2.0.2"
},
"devDependencies": {
Expand Down
8 changes: 4 additions & 4 deletions shim.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

var supportsDescriptors = require('define-properties').supportsDescriptors;
var getPolyfill = require('./polyfill');
var gOPD = Object.getOwnPropertyDescriptor;
var gOPD = require('gopd');
var defineProperty = Object.defineProperty;
var TypeErr = TypeError;
var getProto = Object.getPrototypeOf;
var $TypeError = require('es-errors');
var getProto = require('get-proto');
var regex = /a/;

module.exports = function shimFlags() {
if (!supportsDescriptors || !getProto) {
throw new TypeErr('RegExp.prototype.flags requires a true ES5 environment that supports property descriptors');
throw new $TypeError('RegExp.prototype.flags requires a true ES5 environment that supports property descriptors');
}
var polyfill = getPolyfill();
var proto = getProto(regex);
Expand Down

0 comments on commit 6355772

Please sign in to comment.