(match: RegExpMatchArray)
| 1336 | } |
| 1337 | } |
| 1338 | const replaceMatch = (match: RegExpMatchArray): void => { |
| 1339 | if (match.index == null) |
| 1340 | return |
| 1341 | |
| 1342 | const replacement = getReplacement(match, this.original) |
| 1343 | if (replacement === match[0]) |
| 1344 | return |
| 1345 | |
| 1346 | if (match[0].length === 0) { |
| 1347 | // a zero-length match spans no characters, so there is no range to |
| 1348 | // overwrite - the replacement is an insertion at the matched position, |
| 1349 | // which is what `String.prototype.replace` does for an empty match |
| 1350 | this.appendRight(match.index, replacement) |
| 1351 | } |
| 1352 | else { |
| 1353 | this.overwrite(match.index, match.index + match[0].length, replacement) |
| 1354 | } |
| 1355 | } |
| 1356 | |
| 1357 | if (searchValue.global) { |
| 1358 | // `String.prototype.replace` starts a global regexp from the beginning of |
nothing calls this directly
no test coverage detected