(match: RegExpMatchArray)
| 1380 | } |
| 1381 | } |
| 1382 | const replaceMatch = (match: RegExpMatchArray): void => { |
| 1383 | /* v8 ignore next 2 -- `match.index` is always defined for matches from `matchAll` */ |
| 1384 | if (match.index == null) |
| 1385 | return |
| 1386 | |
| 1387 | const replacement = getReplacement(match, this.original) |
| 1388 | if (replacement === match[0]) |
| 1389 | return |
| 1390 | |
| 1391 | if (match[0].length === 0) { |
| 1392 | // a zero-length match spans no characters, so there is no range to |
| 1393 | // overwrite - the replacement is an insertion at the matched position, |
| 1394 | // which is what `String.prototype.replace` does for an empty match |
| 1395 | this.appendRight(match.index, replacement) |
| 1396 | } |
| 1397 | else { |
| 1398 | this.overwrite(match.index, match.index + match[0].length, replacement) |
| 1399 | } |
| 1400 | } |
| 1401 | |
| 1402 | if (searchValue.global) { |
| 1403 | // `String.prototype.replace` starts a global regexp from the beginning of |
nothing calls this directly
no test coverage detected