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

Method addEdit

benchmark/data.js:222–234  ·  view source on GitHub ↗
(sourceIndex, content, loc, nameIndex)

Source from the content-addressed store, hash-verified

220 this.pending = null;
221 }
222 addEdit(sourceIndex, content, loc, nameIndex) {
223 if (content.length) {
224 const segment = [this.generatedCodeColumn, sourceIndex, loc.line, loc.column];
225 if (nameIndex >= 0) {
226 segment.push(nameIndex);
227 }
228 this.rawSegments.push(segment);
229 } else if (this.pending) {
230 this.rawSegments.push(this.pending);
231 }
232 this.advance(content);
233 this.pending = null;
234 }
235 addUneditedChunk(sourceIndex, chunk, original, loc, sourcemapLocations) {
236 let originalCharIndex = chunk.start;
237 let first = true;

Callers 2

generateDecodedMapMethod · 0.95
generateDecodedMapMethod · 0.95

Calls 1

advanceMethod · 0.95

Tested by

no test coverage detected