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

Method indentAt

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

Source from the content-addressed store, hash-verified

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