@internal
(charType?: string)
| 1255 | |
| 1256 | /** @internal */ |
| 1257 | trimStartAborted(charType?: string): boolean { |
| 1258 | const rx = new RegExp(`^${charType || '\\s'}+`) |
| 1259 | |
| 1260 | this.intro = this.intro.replace(rx, '') |
| 1261 | if (this.intro.length) |
| 1262 | return true |
| 1263 | |
| 1264 | let chunk = this.firstChunk |
| 1265 | |
| 1266 | do { |
| 1267 | const end = chunk.end |
| 1268 | const aborted = chunk.trimStart(rx) |
| 1269 | |
| 1270 | if (chunk.end !== end) { |
| 1271 | // special case... |
| 1272 | if (chunk === this.lastChunk) |
| 1273 | this.lastChunk = chunk.next |
| 1274 | |
| 1275 | this.byEnd.set(chunk.end, chunk) |
| 1276 | this.byStart.set(chunk.next.start, chunk.next) |
| 1277 | this.byEnd.set(chunk.next.end, chunk.next) |
| 1278 | } |
| 1279 | |
| 1280 | if (aborted) |
| 1281 | return true |
| 1282 | chunk = chunk.next |
| 1283 | } while (chunk) |
| 1284 | |
| 1285 | return false |
| 1286 | } |
| 1287 | |
| 1288 | /** |
| 1289 | * Trims content matching `charType` (defaults to `\s`, i.e. whitespace) from the start. |