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

Method lastChar

src/MagicString.ts:985–1001  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

983 }
984
985 lastChar(): string {
986 if (this.outro.length)
987 return this.outro[this.outro.length - 1]
988 let chunk: Chunk | null = this.lastChunk
989 while (chunk) {
990 if (chunk.outro.length)
991 return chunk.outro[chunk.outro.length - 1]
992 if (chunk.content.length)
993 return chunk.content[chunk.content.length - 1]
994 if (chunk.intro.length)
995 return chunk.intro[chunk.intro.length - 1]
996 chunk = chunk.previous
997 }
998 if (this.intro.length)
999 return this.intro[this.intro.length - 1]
1000 return ''
1001 }
1002
1003 lastLine(): string {
1004 let lineIndex = this.outro.lastIndexOf(n)

Callers 1

indentMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected