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

Method trimStartAborted

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

Source from the content-addressed store, hash-verified

778 return this;
779 }
780 trimStartAborted(charType) {
781 const rx = new RegExp('^' + (charType || '\\s') + '+');
782
783 this.intro = this.intro.replace(rx, '');
784 if (this.intro.length) return true;
785
786 let chunk = this.firstChunk;
787
788 do {
789 const end = chunk.end;
790 const aborted = chunk.trimStart(rx);
791
792 if (chunk.end !== end) {
793 // special case...
794 if (chunk === this.lastChunk) this.lastChunk = chunk.next;
795
796 this.byEnd[chunk.end] = chunk;
797 this.byStart[chunk.next.start] = chunk.next;
798 this.byEnd[chunk.next.end] = chunk.next;
799 }
800
801 if (aborted) return true;
802 chunk = chunk.next;
803 } while (chunk);
804
805 return false;
806 }
807
808 trimStart(charType) {
809 this.trimStartAborted(charType);

Callers 2

trimStartMethod · 0.95
trimStartMethod · 0.45

Calls 2

replaceMethod · 0.45
trimStartMethod · 0.45

Tested by

no test coverage detected