node_modules/es-abstract/2022/RegExpExec.js in immosquare-cleaner-0.1.32 vs node_modules/es-abstract/2022/RegExpExec.js in immosquare-cleaner-0.1.38
- old
+ new
@@ -1,11 +1,9 @@
'use strict';
-var GetIntrinsic = require('get-intrinsic');
+var $TypeError = require('es-errors/type');
-var $TypeError = GetIntrinsic('%TypeError%');
-
var regexExec = require('call-bind/callBound')('RegExp.prototype.exec');
var Call = require('./Call');
var Get = require('./Get');
var IsCallable = require('./IsCallable');
@@ -15,16 +13,16 @@
module.exports = function RegExpExec(R, S) {
if (Type(R) !== 'Object') {
throw new $TypeError('Assertion failed: `R` must be an Object');
}
- if (Type(S) !== 'String') {
+ if (typeof S !== 'string') {
throw new $TypeError('Assertion failed: `S` must be a String');
}
var exec = Get(R, 'exec');
if (IsCallable(exec)) {
var result = Call(exec, R, [S]);
- if (result === null || Type(result) === 'Object') {
+ if (typeof result === 'object') {
return result;
}
throw new $TypeError('"exec" method must return `null` or an Object');
}
return regexExec(R, S);