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

Method lastChar

src/MagicString.ts:849–865  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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

Callers 1

indentMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected