(height: number)
| 41 | } |
| 42 | |
| 43 | getDetails(height: number): GetRange<T> | undefined { |
| 44 | let result: GetRange<T> | undefined; |
| 45 | |
| 46 | const arr = [...this.#map.entries()]; |
| 47 | |
| 48 | for (let i = 0; i < arr.length; i++) { |
| 49 | const [currentHeight, value] = arr[i]; |
| 50 | const nextStart = arr[i + 1]?.[0]; |
| 51 | const r = { |
| 52 | value, |
| 53 | startHeight: currentHeight, |
| 54 | endHeight: nextStart ? nextStart - 1 : undefined, |
| 55 | }; |
| 56 | |
| 57 | if (currentHeight === height) { |
| 58 | result = r; |
| 59 | break; |
| 60 | } |
| 61 | if (currentHeight <= height) { |
| 62 | result = r; |
| 63 | } |
| 64 | |
| 65 | if (currentHeight > height) { |
| 66 | break; |
| 67 | } |
| 68 | } |
| 69 | |
| 70 | return result; |
| 71 | } |
| 72 | |
| 73 | getAllWithRange(): GetRange<T>[] { |
| 74 | return [...this.#map.entries()].map(([key, value], index, entries) => { |
no outgoing calls
no test coverage detected