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

Method lastChar

src/MagicString.ts:812–828  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

810 }
811
812 lastChar(): string {
813 if (this.outro.length)
814 return this.outro[this.outro.length - 1]
815 let chunk: Chunk | null = this.lastChunk
816 while (chunk) {
817 if (chunk.outro.length)
818 return chunk.outro[chunk.outro.length - 1]
819 if (chunk.content.length)
820 return chunk.content[chunk.content.length - 1]
821 if (chunk.intro.length)
822 return chunk.intro[chunk.intro.length - 1]
823 chunk = chunk.previous
824 }
825 if (this.intro.length)
826 return this.intro[this.intro.length - 1]
827 return ''
828 }
829
830 lastLine(): string {
831 let lineIndex = this.outro.lastIndexOf(n)

Callers 1

indentMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected