Skip to content

Commit 6355772

Browse files
committed
[Refactor] use get-proto and es-errors
1 parent c630183 commit 6355772

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

package.json

+2
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@
4343
"call-bind": "^1.0.8",
4444
"define-properties": "^1.2.1",
4545
"es-errors": "^1.3.0",
46+
"get-proto": "^1.0.1",
47+
"gopd": "^1.2.0",
4648
"set-function-name": "^2.0.2"
4749
},
4850
"devDependencies": {

shim.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22

33
var supportsDescriptors = require('define-properties').supportsDescriptors;
44
var getPolyfill = require('./polyfill');
5-
var gOPD = Object.getOwnPropertyDescriptor;
5+
var gOPD = require('gopd');
66
var defineProperty = Object.defineProperty;
7-
var TypeErr = TypeError;
8-
var getProto = Object.getPrototypeOf;
7+
var $TypeError = require('es-errors');
8+
var getProto = require('get-proto');
99
var regex = /a/;
1010

1111
module.exports = function shimFlags() {
1212
if (!supportsDescriptors || !getProto) {
13-
throw new TypeErr('RegExp.prototype.flags requires a true ES5 environment that supports property descriptors');
13+
throw new $TypeError('RegExp.prototype.flags requires a true ES5 environment that supports property descriptors');
1414
}
1515
var polyfill = getPolyfill();
1616
var proto = getProto(regex);

0 commit comments

Comments
 (0)