* Same as `s.replace`, but replace all matched strings instead of just one.
(searchValue: string | RegExp, replacement: string | ReplacementFunction)
| 1455 | * Same as `s.replace`, but replace all matched strings instead of just one. |
| 1456 | */ |
| 1457 | replaceAll(searchValue: string | RegExp, replacement: string | ReplacementFunction): this { |
| 1458 | if (typeof searchValue === 'string') { |
| 1459 | return this._replaceAllString(searchValue, replacement) |
| 1460 | } |
| 1461 | |
| 1462 | if (!searchValue.global) { |
| 1463 | throw new MagicStringError('replaceAll() requires a global RegExp') |
| 1464 | } |
| 1465 | |
| 1466 | return this._replaceRegexp(searchValue, replacement) |
| 1467 | } |
| 1468 | } |
no test coverage detected