* Same as `s.replace`, but replace all matched strings instead of just one.
(searchValue: string | RegExp, replacement: string | ReplacementFunction)
| 1335 | * Same as `s.replace`, but replace all matched strings instead of just one. |
| 1336 | */ |
| 1337 | replaceAll(searchValue: string | RegExp, replacement: string | ReplacementFunction): this { |
| 1338 | if (typeof searchValue === 'string') { |
| 1339 | return this._replaceAllString(searchValue, replacement) |
| 1340 | } |
| 1341 | |
| 1342 | if (!searchValue.global) { |
| 1343 | throw new MagicStringError('replaceAll() requires a global RegExp') |
| 1344 | } |
| 1345 | |
| 1346 | return this._replaceRegexp(searchValue, replacement) |
| 1347 | } |
| 1348 | } |
no test coverage detected