(string, replacement)
| 884 | } |
| 885 | |
| 886 | _replaceAllString(string, replacement) { |
| 887 | const { original } = this; |
| 888 | const stringLength = string.length; |
| 889 | for ( |
| 890 | let index = original.indexOf(string); |
| 891 | index !== -1; |
| 892 | index = original.indexOf(string, index + stringLength) |
| 893 | ) { |
| 894 | const previous = original.slice(index, index + stringLength); |
| 895 | let _replacement = replacement; |
| 896 | if (typeof replacement === 'function') { |
| 897 | _replacement = replacement(previous, index, original); |
| 898 | } |
| 899 | if (previous !== _replacement) this.overwrite(index, index + stringLength, _replacement); |
| 900 | } |
| 901 | |
| 902 | return this; |
| 903 | } |
| 904 | |
| 905 | replaceAll(searchValue, replacement) { |
| 906 | if (typeof searchValue === 'string') { |
no test coverage detected