(match: RegExpMatchArray)
| 1223 | } |
| 1224 | } |
| 1225 | const replaceMatch = (match: RegExpMatchArray): void => { |
| 1226 | if (match.index == null) |
| 1227 | return |
| 1228 | |
| 1229 | const replacement = getReplacement(match, this.original) |
| 1230 | if (replacement === match[0]) |
| 1231 | return |
| 1232 | |
| 1233 | if (match[0].length === 0) { |
| 1234 | // a zero-length match spans no characters, so there is no range to |
| 1235 | // overwrite - the replacement is an insertion at the matched position, |
| 1236 | // which is what `String.prototype.replace` does for an empty match |
| 1237 | this.appendRight(match.index, replacement) |
| 1238 | } |
| 1239 | else { |
| 1240 | this.overwrite(match.index, match.index + match[0].length, replacement) |
| 1241 | } |
| 1242 | } |
| 1243 | |
| 1244 | if (searchValue.global) { |
| 1245 | // `String.prototype.replace` starts a global regexp from the beginning of |
nothing calls this directly
no test coverage detected