@internal
(charType?: string)
| 1111 | |
| 1112 | /** @internal */ |
| 1113 | trimStartAborted(charType?: string): boolean { |
| 1114 | const rx = new RegExp(`^${charType || '\\s'}+`) |
| 1115 | |
| 1116 | this.intro = this.intro.replace(rx, '') |
| 1117 | if (this.intro.length) |
| 1118 | return true |
| 1119 | |
| 1120 | let chunk = this.firstChunk |
| 1121 | |
| 1122 | do { |
| 1123 | const end = chunk.end |
| 1124 | const aborted = chunk.trimStart(rx) |
| 1125 | |
| 1126 | if (chunk.end !== end) { |
| 1127 | // special case... |
| 1128 | if (chunk === this.lastChunk) |
| 1129 | this.lastChunk = chunk.next |
| 1130 | |
| 1131 | this.byEnd.set(chunk.end, chunk) |
| 1132 | this.byStart.set(chunk.next.start, chunk.next) |
| 1133 | this.byEnd.set(chunk.next.end, chunk.next) |
| 1134 | } |
| 1135 | |
| 1136 | if (aborted) |
| 1137 | return true |
| 1138 | chunk = chunk.next |
| 1139 | } while (chunk) |
| 1140 | |
| 1141 | return false |
| 1142 | } |
| 1143 | |
| 1144 | /** |
| 1145 | * Trims content matching `charType` (defaults to `\s`, i.e. whitespace) from the start. |