@internal
(charType?: string)
| 1235 | |
| 1236 | /** @internal */ |
| 1237 | trimStartAborted(charType?: string): boolean { |
| 1238 | const rx = new RegExp(`^${charType || '\\s'}+`) |
| 1239 | |
| 1240 | this.intro = this.intro.replace(rx, '') |
| 1241 | if (this.intro.length) |
| 1242 | return true |
| 1243 | |
| 1244 | let chunk = this.firstChunk |
| 1245 | |
| 1246 | do { |
| 1247 | const end = chunk.end |
| 1248 | const aborted = chunk.trimStart(rx) |
| 1249 | |
| 1250 | if (chunk.end !== end) { |
| 1251 | // special case... |
| 1252 | if (chunk === this.lastChunk) |
| 1253 | this.lastChunk = chunk.next |
| 1254 | |
| 1255 | this.byEnd.set(chunk.end, chunk) |
| 1256 | this.byStart.set(chunk.next.start, chunk.next) |
| 1257 | this.byEnd.set(chunk.next.end, chunk.next) |
| 1258 | } |
| 1259 | |
| 1260 | if (aborted) |
| 1261 | return true |
| 1262 | chunk = chunk.next |
| 1263 | } while (chunk) |
| 1264 | |
| 1265 | return false |
| 1266 | } |
| 1267 | |
| 1268 | /** |
| 1269 | * Trims content matching `charType` (defaults to `\s`, i.e. whitespace) from the start. |