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

Method lastChar

src/MagicString.ts:843–859  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

841 }
842
843 lastChar(): string {
844 if (this.outro.length)
845 return this.outro[this.outro.length - 1]
846 let chunk: Chunk | null = this.lastChunk
847 while (chunk) {
848 if (chunk.outro.length)
849 return chunk.outro[chunk.outro.length - 1]
850 if (chunk.content.length)
851 return chunk.content[chunk.content.length - 1]
852 if (chunk.intro.length)
853 return chunk.intro[chunk.intro.length - 1]
854 chunk = chunk.previous
855 }
856 if (this.intro.length)
857 return this.intro[this.intro.length - 1]
858 return ''
859 }
860
861 lastLine(): string {
862 let lineIndex = this.outro.lastIndexOf(n)

Callers 1

indentMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected