@internal
(string: string, replacement: string | ReplacementFunction)
| 1250 | |
| 1251 | /** @internal */ |
| 1252 | _replaceString(string: string, replacement: string | ReplacementFunction): this { |
| 1253 | const { original } = this |
| 1254 | const index = original.indexOf(string) |
| 1255 | |
| 1256 | if (index !== -1) { |
| 1257 | if (typeof replacement === 'function') { |
| 1258 | replacement = replacement(string, index, original) |
| 1259 | } |
| 1260 | if (string !== replacement) { |
| 1261 | this.overwrite(index, index + string.length, replacement) |
| 1262 | } |
| 1263 | } |
| 1264 | |
| 1265 | return this |
| 1266 | } |
| 1267 | |
| 1268 | /** |
| 1269 | * String replacement with RegExp or string. |