@internal
(charType?: string)
| 1069 | |
| 1070 | /** @internal */ |
| 1071 | trimStartAborted(charType?: string): boolean { |
| 1072 | const rx = new RegExp(`^${charType || '\\s'}+`) |
| 1073 | |
| 1074 | this.intro = this.intro.replace(rx, '') |
| 1075 | if (this.intro.length) |
| 1076 | return true |
| 1077 | |
| 1078 | let chunk = this.firstChunk |
| 1079 | |
| 1080 | do { |
| 1081 | const end = chunk.end |
| 1082 | const aborted = chunk.trimStart(rx) |
| 1083 | |
| 1084 | if (chunk.end !== end) { |
| 1085 | // special case... |
| 1086 | if (chunk === this.lastChunk) |
| 1087 | this.lastChunk = chunk.next |
| 1088 | |
| 1089 | this.byEnd.set(chunk.end, chunk) |
| 1090 | this.byStart.set(chunk.next.start, chunk.next) |
| 1091 | this.byEnd.set(chunk.next.end, chunk.next) |
| 1092 | } |
| 1093 | |
| 1094 | if (aborted) |
| 1095 | return true |
| 1096 | chunk = chunk.next |
| 1097 | } while (chunk) |
| 1098 | |
| 1099 | return false |
| 1100 | } |
| 1101 | |
| 1102 | /** |
| 1103 | * Trims content matching `charType` (defaults to `\s`, i.e. whitespace) from the start. |