* Returns true if the resulting source is empty (disregarding white space).
()
| 1211 | * Returns true if the resulting source is empty (disregarding white space). |
| 1212 | */ |
| 1213 | isEmpty(): boolean { |
| 1214 | // mirrors toString(): the string-level intro and outro bookend the chunks |
| 1215 | if (this.intro.length && this.intro.trim()) |
| 1216 | return false |
| 1217 | let chunk: Chunk | null = this.firstChunk |
| 1218 | while (chunk) { |
| 1219 | if ( |
| 1220 | (chunk.intro.length && chunk.intro.trim()) |
| 1221 | || (chunk.content.length && chunk.content.trim()) |
| 1222 | || (chunk.outro.length && chunk.outro.trim()) |
| 1223 | ) { |
| 1224 | return false |
| 1225 | } |
| 1226 | chunk = chunk.next |
| 1227 | } |
| 1228 | if (this.outro.length && this.outro.trim()) |
| 1229 | return false |
| 1230 | return true |
| 1231 | } |
| 1232 | |
| 1233 | /** |
| 1234 | * Returns the length of the generated string, counting only content attached to the original characters. |