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

Method remove

benchmark/data-min.js:468–479  ·  view source on GitHub ↗
(t, e)

Source from the content-addressed store, hash-verified

466 return (n ? n.prependRight(e) : (this.outro = e + this.outro), this);
467 }
468 remove(t, e) {
469 for (; t < 0; ) t += this.original.length;
470 for (; e < 0; ) e += this.original.length;
471 if (t === e) return this;
472 if (t < 0 || e > this.original.length) throw new Error('Character is out of bounds');
473 if (t > e) throw new Error('end must be greater than start');
474 (this._split(t), this._split(e));
475 let n = this.byStart[t];
476 for (; n; )
477 ((n.intro = ''), (n.outro = ''), n.edit(''), (n = e > n.end ? this.byStart[n.end] : null));
478 return this;
479 }
480 lastChar() {
481 if (this.outro.length) return this.outro[this.outro.length - 1];
482 let t = this.lastChunk;

Callers 3

snipMethod · 0.45
Bundle.test.tsFile · 0.45

Calls 2

_splitMethod · 0.95
editMethod · 0.45

Tested by

no test coverage detected