Update checked-in dependencies

This commit is contained in:
github-actions[bot] 2024-09-16 17:29:58 +00:00
parent 1afca056e3
commit 6989ba7bd2
3942 changed files with 55190 additions and 132206 deletions

View file

@ -1,8 +1,6 @@
'use strict';
var GetIntrinsic = require('get-intrinsic');
var $TypeError = GetIntrinsic('%TypeError%');
var $TypeError = require('es-errors/type');
var callBound = require('call-bind/callBound');
var regexTester = require('safe-regex-test');
@ -21,21 +19,20 @@ var Get = require('./Get');
var IsArray = require('./IsArray');
var ToObject = require('./ToObject');
var ToString = require('./ToString');
var Type = require('./Type');
var isInteger = require('../helpers/isInteger');
var isStringOrHole = require('../helpers/isStringOrHole');
var isStringOrUndefined = require('../helpers/isStringOrUndefined');
// http://www.ecma-international.org/ecma-262/12.0/#sec-getsubstitution
// eslint-disable-next-line max-statements, max-params, max-lines-per-function
module.exports = function GetSubstitution(matched, str, position, captures, namedCaptures, replacement) {
if (Type(matched) !== 'String') {
if (typeof matched !== 'string') {
throw new $TypeError('Assertion failed: `matched` must be a String');
}
var matchLength = matched.length;
if (Type(str) !== 'String') {
if (typeof str !== 'string') {
throw new $TypeError('Assertion failed: `str` must be a String');
}
var stringLength = str.length;
@ -44,17 +41,17 @@ module.exports = function GetSubstitution(matched, str, position, captures, name
throw new $TypeError('Assertion failed: `position` must be a nonnegative integer, and less than or equal to the length of `string`, got ' + inspect(position));
}
if (!IsArray(captures) || !every(captures, isStringOrHole)) {
throw new $TypeError('Assertion failed: `captures` must be a possibly-empty List of Strings, got ' + inspect(captures));
if (!IsArray(captures) || !every(captures, isStringOrUndefined)) {
throw new $TypeError('Assertion failed: `captures` must be a possibly-empty List of Strings or `undefined`, got ' + inspect(captures));
}
if (Type(replacement) !== 'String') {
if (typeof replacement !== 'string') {
throw new $TypeError('Assertion failed: `replacement` must be a String');
}
var tailPos = position + matchLength;
var m = captures.length;
if (Type(namedCaptures) !== 'Undefined') {
if (typeof namedCaptures !== 'undefined') {
namedCaptures = ToObject(namedCaptures); // eslint-disable-line no-param-reassign
}
@ -84,28 +81,26 @@ module.exports = function GetSubstitution(matched, str, position, captures, name
// $1 through $9, and not followed by a digit
var n = $parseInt(next, 10);
// if (n > m, impl-defined)
result += n <= m && Type(captures[n - 1]) === 'Undefined' ? '' : captures[n - 1];
result += n <= m && typeof captures[n - 1] === 'undefined' ? '' : captures[n - 1];
i += 1;
} else if (isDigit(next) && (nextIsLast || isDigit(nextNext))) {
// $00 through $99
var nn = next + nextNext;
var nnI = $parseInt(nn, 10) - 1;
// if nn === '00' or nn > m, impl-defined
result += nn <= m && Type(captures[nnI]) === 'Undefined' ? '' : captures[nnI];
result += nn <= m && typeof captures[nnI] === 'undefined' ? '' : captures[nnI];
i += 2;
} else if (next === '<') {
// eslint-disable-next-line max-depth
if (Type(namedCaptures) === 'Undefined') {
if (typeof namedCaptures === 'undefined') {
result += '$<';
i += 2;
} else {
var endIndex = $indexOf(replacement, '>', i);
// eslint-disable-next-line max-depth
if (endIndex > -1) {
var groupName = $strSlice(replacement, i + '$<'.length, endIndex);
var capture = Get(namedCaptures, groupName);
// eslint-disable-next-line max-depth
if (Type(capture) !== 'Undefined') {
if (typeof capture !== 'undefined') {
result += ToString(capture);
}
i += ('<' + groupName + '>').length;