* The chunk whose original range holds `index` (`chunk.start <= index < chunk.end`), * or `undefined` when `index` is at or past the end. Searches from the last * visited chunk so that scans over nearby indices stay cheap. * * @internal
(index: number)
| 1134 | * @internal |
| 1135 | */ |
| 1136 | _chunkAt(index: number): Chunk | undefined { |
| 1137 | let chunk = this.byStart.get(index) |
| 1138 | if (chunk) |
| 1139 | return chunk |
| 1140 | chunk = this.lastSearchedChunk |
| 1141 | const searchForward = index >= chunk.end |
| 1142 | while (chunk && !chunk.contains(index)) |
| 1143 | chunk = searchForward ? this.byStart.get(chunk.end) : this.byEnd.get(chunk.start) |
| 1144 | if (chunk) |
| 1145 | this.lastSearchedChunk = chunk |
| 1146 | return chunk |
| 1147 | } |
| 1148 | |
| 1149 | /** @internal */ |
| 1150 | _split(index: number): boolean | void { |
no test coverage detected