* Performs a lookup operation
(operation: IndexOperation, value: any)
| 202 | * Performs a lookup operation |
| 203 | */ |
| 204 | lookup(operation: IndexOperation, value: any): Set<TKey> { |
| 205 | const startTime = performance.now() |
| 206 | |
| 207 | let result: Set<TKey> |
| 208 | |
| 209 | switch (operation) { |
| 210 | case `eq`: |
| 211 | result = this.equalityLookup(value) |
| 212 | break |
| 213 | case `gt`: |
| 214 | result = this.rangeQuery({ from: value, fromInclusive: false }) |
| 215 | break |
| 216 | case `gte`: |
| 217 | result = this.rangeQuery({ from: value, fromInclusive: true }) |
| 218 | break |
| 219 | case `lt`: |
| 220 | result = this.rangeQuery({ to: value, toInclusive: false }) |
| 221 | break |
| 222 | case `lte`: |
| 223 | result = this.rangeQuery({ to: value, toInclusive: true }) |
| 224 | break |
| 225 | case `in`: |
| 226 | result = this.inArrayLookup(value) |
| 227 | break |
| 228 | default: |
| 229 | throw new Error(`Operation ${operation} not supported by BasicIndex`) |
| 230 | } |
| 231 | |
| 232 | this.trackLookup(startTime) |
| 233 | return result |
| 234 | } |
| 235 | |
| 236 | /** |
| 237 | * Gets the number of indexed keys |
no test coverage detected