MCPcopy Index your code
hub / github.com/fb55/htmlparser2 / getSlice

Method getSlice

src/Parser.ts:741–761  ·  view source on GitHub ↗
(start: number, end: number)

Source from the content-addressed store, hash-verified

739 }
740
741 private getSlice(start: number, end: number) {
742 if (start === end) {
743 return "";
744 }
745
746 while (start - this.bufferOffset >= this.buffers[0].length) {
747 this.shiftBuffer();
748 }
749
750 let slice = this.buffers[0].slice(
751 start - this.bufferOffset,
752 end - this.bufferOffset,
753 );
754
755 while (end - this.bufferOffset > this.buffers[0].length) {
756 this.shiftBuffer();
757 slice += this.buffers[0].slice(0, end - this.bufferOffset);
758 }
759
760 return slice;
761 }
762
763 private shiftBuffer(): void {
764 this.bufferOffset += this.buffers[0].length;

Callers 8

ontextMethod · 0.95
readTagNameMethod · 0.95
onattribnameMethod · 0.95
onattribdataMethod · 0.95
ondeclarationMethod · 0.95
oncommentMethod · 0.95
oncdataMethod · 0.95

Calls 1

shiftBufferMethod · 0.95

Tested by

no test coverage detected