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

Method lastChar

src/MagicString.ts:798–814  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

796 }
797
798 lastChar(): string {
799 if (this.outro.length)
800 return this.outro[this.outro.length - 1]
801 let chunk: Chunk | null = this.lastChunk
802 while (chunk) {
803 if (chunk.outro.length)
804 return chunk.outro[chunk.outro.length - 1]
805 if (chunk.content.length)
806 return chunk.content[chunk.content.length - 1]
807 if (chunk.intro.length)
808 return chunk.intro[chunk.intro.length - 1]
809 chunk = chunk.previous
810 }
811 if (this.intro.length)
812 return this.intro[this.intro.length - 1]
813 return ''
814 }
815
816 lastLine(): string {
817 let lineIndex = this.outro.lastIndexOf(n)

Callers 1

indentMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected