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

Method prependRight

src/MagicString.js:472–491  ·  view source on GitHub ↗
(index, content)

Source from the content-addressed store, hash-verified

470 }
471
472 prependRight(index, content) {
473 index = index + this.offset;
474
475 if (typeof content !== 'string') throw new TypeError('inserted content must be a string');
476
477 if (DEBUG) this.stats.time('insertRight');
478
479 this._split(index);
480
481 const chunk = this.byStart[index];
482
483 if (chunk) {
484 chunk.prependRight(content);
485 } else {
486 this.outro = content + this.outro;
487 }
488
489 if (DEBUG) this.stats.timeEnd('insertRight');
490 return this;
491 }
492
493 remove(start, end) {
494 start = start + this.offset;

Callers 2

insertRightMethod · 0.95
indentMethod · 0.45

Calls 3

_splitMethod · 0.95
timeMethod · 0.80
timeEndMethod · 0.80

Tested by

no test coverage detected