* Returns the last character of the generated string, or `''` if it is empty.
()
| 967 | * Returns the last character of the generated string, or `''` if it is empty. |
| 968 | */ |
| 969 | lastChar(): string { |
| 970 | if (this.outro.length) |
| 971 | return this.outro[this.outro.length - 1] |
| 972 | let chunk: Chunk | null = this.lastChunk |
| 973 | while (chunk) { |
| 974 | if (chunk.outro.length) |
| 975 | return chunk.outro[chunk.outro.length - 1] |
| 976 | if (chunk.content.length) |
| 977 | return chunk.content[chunk.content.length - 1] |
| 978 | if (chunk.intro.length) |
| 979 | return chunk.intro[chunk.intro.length - 1] |
| 980 | chunk = chunk.previous |
| 981 | } |
| 982 | if (this.intro.length) |
| 983 | return this.intro[this.intro.length - 1] |
| 984 | return '' |
| 985 | } |
| 986 | |
| 987 | /** |
| 988 | * Returns everything after the last newline in the generated string, or the whole string if there is no newline. |