(match: RegExpMatchArray)
| 1356 | } |
| 1357 | } |
| 1358 | const replaceMatch = (match: RegExpMatchArray): void => { |
| 1359 | /* v8 ignore next 2 -- `match.index` is always defined for matches from `matchAll` */ |
| 1360 | if (match.index == null) |
| 1361 | return |
| 1362 | |
| 1363 | const replacement = getReplacement(match, this.original) |
| 1364 | if (replacement === match[0]) |
| 1365 | return |
| 1366 | |
| 1367 | if (match[0].length === 0) { |
| 1368 | // a zero-length match spans no characters, so there is no range to |
| 1369 | // overwrite - the replacement is an insertion at the matched position, |
| 1370 | // which is what `String.prototype.replace` does for an empty match |
| 1371 | this.appendRight(match.index, replacement) |
| 1372 | } |
| 1373 | else { |
| 1374 | this.overwrite(match.index, match.index + match[0].length, replacement) |
| 1375 | } |
| 1376 | } |
| 1377 | |
| 1378 | if (searchValue.global) { |
| 1379 | // `String.prototype.replace` starts a global regexp from the beginning of |
nothing calls this directly
no test coverage detected