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

Method appendLeft

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

Source from the content-addressed store, hash-verified

58 }
59
60 appendLeft(index, content) {
61 index = index + this.offset;
62
63 if (typeof content !== 'string') throw new TypeError('inserted content must be a string');
64
65 if (DEBUG) this.stats.time('appendLeft');
66
67 this._split(index);
68
69 const chunk = this.byEnd[index];
70
71 if (chunk) {
72 chunk.appendLeft(content);
73 } else {
74 this.intro += content;
75 }
76
77 if (DEBUG) this.stats.timeEnd('appendLeft');
78 return this;
79 }
80
81 appendRight(index, content) {
82 index = index + this.offset;

Callers 1

insertLeftMethod · 0.95

Calls 3

_splitMethod · 0.95
timeMethod · 0.80
timeEndMethod · 0.80

Tested by

no test coverage detected