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

Method trimEndAborted

benchmark/data.js:736–756  ·  view source on GitHub ↗
(charType)

Source from the content-addressed store, hash-verified

734 return this.trimStart(charType).trimEnd(charType);
735 }
736 trimEndAborted(charType) {
737 const rx = new RegExp((charType || '\\s') + '+$');
738 this.outro = this.outro.replace(rx, '');
739 if (this.outro.length) return true;
740 let chunk = this.lastChunk;
741 do {
742 const end = chunk.end;
743 const aborted = chunk.trimEnd(rx);
744 if (chunk.end !== end) {
745 if (this.lastChunk === chunk) {
746 this.lastChunk = chunk.next;
747 }
748 this.byEnd[chunk.end] = chunk;
749 this.byStart[chunk.next.start] = chunk.next;
750 this.byEnd[chunk.next.end] = chunk.next;
751 }
752 if (aborted) return true;
753 chunk = chunk.previous;
754 } while (chunk);
755 return false;
756 }
757 trimEnd(charType) {
758 this.trimEndAborted(charType);
759 return this;

Callers 2

trimEndMethod · 0.95
trimEndMethod · 0.45

Calls 2

replaceMethod · 0.45
trimEndMethod · 0.45

Tested by

no test coverage detected