* Same as `s.replace`, but replace all matched strings instead of just one.
(searchValue: string | RegExp, replacement: string | ReplacementFunction)
| 1218 | * Same as `s.replace`, but replace all matched strings instead of just one. |
| 1219 | */ |
| 1220 | replaceAll(searchValue: string | RegExp, replacement: string | ReplacementFunction): this { |
| 1221 | if (typeof searchValue === 'string') { |
| 1222 | return this._replaceAllString(searchValue, replacement) |
| 1223 | } |
| 1224 | |
| 1225 | if (!searchValue.global) { |
| 1226 | throw new TypeError( |
| 1227 | 'MagicString.prototype.replaceAll called with a non-global RegExp argument', |
| 1228 | ) |
| 1229 | } |
| 1230 | |
| 1231 | return this._replaceRegexp(searchValue, replacement) |
| 1232 | } |
| 1233 | } |
no test coverage detected