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

Method trimStartAborted

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

Source from the content-addressed store, hash-verified

759 return this;
760 }
761 trimStartAborted(charType) {
762 const rx = new RegExp('^' + (charType || '\\s') + '+');
763 this.intro = this.intro.replace(rx, '');
764 if (this.intro.length) return true;
765 let chunk = this.firstChunk;
766 do {
767 const end = chunk.end;
768 const aborted = chunk.trimStart(rx);
769 if (chunk.end !== end) {
770 if (chunk === this.lastChunk) this.lastChunk = chunk.next;
771 this.byEnd[chunk.end] = chunk;
772 this.byStart[chunk.next.start] = chunk.next;
773 this.byEnd[chunk.next.end] = chunk.next;
774 }
775 if (aborted) return true;
776 chunk = chunk.next;
777 } while (chunk);
778 return false;
779 }
780 trimStart(charType) {
781 this.trimStartAborted(charType);
782 return this;

Callers 2

trimStartMethod · 0.95
trimStartMethod · 0.45

Calls 2

replaceMethod · 0.45
trimStartMethod · 0.45

Tested by

no test coverage detected