MCPcopy Create free account
hub / github.com/Rich-Harris/magic-string / replaceAll

Method replaceAll

src/MagicString.js:905–917  ·  view source on GitHub ↗
(searchValue, replacement)

Source from the content-addressed store, hash-verified

903 }
904
905 replaceAll(searchValue, replacement) {
906 if (typeof searchValue === 'string') {
907 return this._replaceAllString(searchValue, replacement);
908 }
909
910 if (!searchValue.global) {
911 throw new TypeError(
912 'MagicString.prototype.replaceAll called with a non-global RegExp argument',
913 );
914 }
915
916 return this._replaceRegexp(searchValue, replacement);
917 }
918}

Callers 1

Calls 2

_replaceAllStringMethod · 0.95
_replaceRegexpMethod · 0.95

Tested by

no test coverage detected