* Same as `s.replace`, but replace all matched strings instead of just one.
(searchValue: string | RegExp, replacement: string | ReplacementFunction)
| 1261 | * Same as `s.replace`, but replace all matched strings instead of just one. |
| 1262 | */ |
| 1263 | replaceAll(searchValue: string | RegExp, replacement: string | ReplacementFunction): this { |
| 1264 | if (typeof searchValue === 'string') { |
| 1265 | return this._replaceAllString(searchValue, replacement) |
| 1266 | } |
| 1267 | |
| 1268 | if (!searchValue.global) { |
| 1269 | throw new MagicStringError('replaceAll() requires a global RegExp') |
| 1270 | } |
| 1271 | |
| 1272 | return this._replaceRegexp(searchValue, replacement) |
| 1273 | } |
| 1274 | } |
no test coverage detected