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

Method trimEndAborted

src/MagicString.js:746–774  ·  view source on GitHub ↗
(charType)

Source from the content-addressed store, hash-verified

744 }
745
746 trimEndAborted(charType) {
747 const rx = new RegExp((charType || '\\s') + '+$');
748
749 this.outro = this.outro.replace(rx, '');
750 if (this.outro.length) return true;
751
752 let chunk = this.lastChunk;
753
754 do {
755 const end = chunk.end;
756 const aborted = chunk.trimEnd(rx);
757
758 // if chunk was trimmed, we have a new lastChunk
759 if (chunk.end !== end) {
760 if (this.lastChunk === chunk) {
761 this.lastChunk = chunk.next;
762 }
763
764 this.byEnd[chunk.end] = chunk;
765 this.byStart[chunk.next.start] = chunk.next;
766 this.byEnd[chunk.next.end] = chunk.next;
767 }
768
769 if (aborted) return true;
770 chunk = chunk.previous;
771 } while (chunk);
772
773 return false;
774 }
775
776 trimEnd(charType) {
777 this.trimEndAborted(charType);

Callers 2

trimEndMethod · 0.95
trimEndMethod · 0.45

Calls 2

replaceMethod · 0.45
trimEndMethod · 0.45

Tested by

no test coverage detected