node_modules/es-abstract/2023/GetMatchString.js in immosquare-cleaner-0.1.32 vs node_modules/es-abstract/2023/GetMatchString.js in immosquare-cleaner-0.1.38

- old
+ new

@@ -1,22 +1,21 @@ 'use strict'; -var GetIntrinsic = require('get-intrinsic'); +var $TypeError = require('es-errors/type'); -var $TypeError = GetIntrinsic('%TypeError%'); - var substring = require('./substring'); -var Type = require('./Type'); -var assertRecord = require('../helpers/assertRecord'); +var isMatchRecord = require('../helpers/records/match-record'); // https://262.ecma-international.org/13.0/#sec-getmatchstring module.exports = function GetMatchString(S, match) { - if (Type(S) !== 'String') { + if (typeof S !== 'string') { throw new $TypeError('Assertion failed: `S` must be a String'); } - assertRecord(Type, 'Match Record', 'match', match); + if (!isMatchRecord(match)) { + throw new $TypeError('Assertion failed: `match` must be a Match Record'); + } if (!(match['[[StartIndex]]'] <= S.length)) { throw new $TypeError('`match` [[StartIndex]] must be a non-negative integer <= the length of S'); } if (!(match['[[EndIndex]]'] <= S.length)) {