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

Method trimEnd

benchmark/data.js:100–114  ·  view source on GitHub ↗
(rx)

Source from the content-addressed store, hash-verified

98 return this.intro + this.content + this.outro;
99 }
100 trimEnd(rx) {
101 this.outro = this.outro.replace(rx, '');
102 if (this.outro.length) return true;
103 const trimmed = this.content.replace(rx, '');
104 if (trimmed.length) {
105 if (trimmed !== this.content) {
106 this.split(this.start + trimmed.length).edit('', void 0, true);
107 }
108 return true;
109 } else {
110 this.edit('', void 0, true);
111 this.intro = this.intro.replace(rx, '');
112 if (this.intro.length) return true;
113 }
114 }
115 trimStart(rx) {
116 this.intro = this.intro.replace(rx, '');
117 if (this.intro.length) return true;

Callers 3

trimMethod · 0.45
trimEndAbortedMethod · 0.45
trimMethod · 0.45

Calls 3

editMethod · 0.95
splitMethod · 0.95
replaceMethod · 0.45

Tested by

no test coverage detected