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

Method indentAt

src/MagicString.ts:469–483  ·  view source on GitHub ↗
(index: number)

Source from the content-addressed store, hash-verified

467
468 // only called from the loop below, while `chunk` is non-null
469 const indentAt = (index: number) => {
470 shouldIndentNextCharacter = false
471
472 if (index === chunk!.start) {
473 // `appendRight` rather than `prependRight`, so that the indent lands
474 // directly in front of the content rather than in front of an intro
475 // that has already been indented in its own right
476 chunk!.appendRight(resolvedIndentStr)
477 }
478 else {
479 this._splitChunk(chunk!, index)
480 chunk = chunk!.next
481 chunk!.prependRight(resolvedIndentStr)
482 }
483 }
484
485 while (chunk) {
486 const end = chunk.end

Callers

nothing calls this directly

Calls 3

_splitChunkMethod · 0.95
appendRightMethod · 0.45
prependRightMethod · 0.45

Tested by

no test coverage detected