@internal
(charType?: string)
| 1085 | |
| 1086 | /** @internal */ |
| 1087 | trimStartAborted(charType?: string): boolean { |
| 1088 | const rx = new RegExp(`^${charType || '\\s'}+`) |
| 1089 | |
| 1090 | this.intro = this.intro.replace(rx, '') |
| 1091 | if (this.intro.length) |
| 1092 | return true |
| 1093 | |
| 1094 | let chunk = this.firstChunk |
| 1095 | |
| 1096 | do { |
| 1097 | const end = chunk.end |
| 1098 | const aborted = chunk.trimStart(rx) |
| 1099 | |
| 1100 | if (chunk.end !== end) { |
| 1101 | // special case... |
| 1102 | if (chunk === this.lastChunk) |
| 1103 | this.lastChunk = chunk.next |
| 1104 | |
| 1105 | this.byEnd.set(chunk.end, chunk) |
| 1106 | this.byStart.set(chunk.next.start, chunk.next) |
| 1107 | this.byEnd.set(chunk.next.end, chunk.next) |
| 1108 | } |
| 1109 | |
| 1110 | if (aborted) |
| 1111 | return true |
| 1112 | chunk = chunk.next |
| 1113 | } while (chunk) |
| 1114 | |
| 1115 | return false |
| 1116 | } |
| 1117 | |
| 1118 | /** |
| 1119 | * Trims content matching `charType` (defaults to `\s`, i.e. whitespace) from the start. |