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

Method _split

benchmark/data.js:677–685  ·  view source on GitHub ↗
(index)

Source from the content-addressed store, hash-verified

675 return clone;
676 }
677 _split(index) {
678 if (this.byStart[index] || this.byEnd[index]) return;
679 let chunk = this.lastSearchedChunk;
680 const searchForward = index > chunk.end;
681 while (chunk) {
682 if (chunk.contains(index)) return this._splitChunk(chunk, index);
683 chunk = searchForward ? this.byStart[chunk.end] : this.byEnd[chunk.start];
684 }
685 }
686 _splitChunk(chunk, index) {
687 if (chunk.edited && chunk.content.length) {
688 const loc = getLocator(this.original)(index);

Callers 7

appendLeftMethod · 0.95
appendRightMethod · 0.95
moveMethod · 0.95
overwriteMethod · 0.95
prependLeftMethod · 0.95
prependRightMethod · 0.95
removeMethod · 0.95

Calls 2

_splitChunkMethod · 0.95
containsMethod · 0.45

Tested by

no test coverage detected