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

Method lastChar

src/MagicString.ts:797–813  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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

Callers 1

indentMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected