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

Method prependLeft

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

Source from the content-addressed store, hash-verified

449 }
450
451 prependLeft(index, content) {
452 index = index + this.offset;
453
454 if (typeof content !== 'string') throw new TypeError('inserted content must be a string');
455
456 if (DEBUG) this.stats.time('insertRight');
457
458 this._split(index);
459
460 const chunk = this.byEnd[index];
461
462 if (chunk) {
463 chunk.prependLeft(content);
464 } else {
465 this.intro = content + this.intro;
466 }
467
468 if (DEBUG) this.stats.timeEnd('insertRight');
469 return this;
470 }
471
472 prependRight(index, content) {
473 index = index + this.offset;

Callers

nothing calls this directly

Calls 3

_splitMethod · 0.95
timeMethod · 0.80
timeEndMethod · 0.80

Tested by

no test coverage detected