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

Method indentAt

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

Source from the content-addressed store, hash-verified

476 let chunk = this.firstChunk
477
478 const indentAt = (index: number) => {
479 shouldIndentNextCharacter = false
480
481 if (index === chunk!.start) {
482 // `appendRight` rather than `prependRight`, so that the indent lands
483 // directly in front of the content rather than in front of an intro
484 // that has already been indented in its own right
485 chunk!.appendRight(resolvedIndentStr)
486 }
487 else {
488 this._splitChunk(chunk!, index)
489 chunk = chunk!.next
490 chunk!.prependRight(resolvedIndentStr)
491 }
492 }
493
494 while (chunk) {
495 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