UNPKG

@tanstack/db

Version:

A reactive client store for building super fast apps on sync

79 lines (78 loc) 2.2 kB
class ReverseIndex { constructor(index) { this.originalIndex = index; } // Define the reversed operations lookup(operation, value) { const reverseOperation = operation === `gt` ? `lt` : operation === `gte` ? `lte` : operation === `lt` ? `gt` : operation === `lte` ? `gte` : operation; return this.originalIndex.lookup(reverseOperation, value); } rangeQuery(options = {}) { return this.originalIndex.rangeQueryReversed(options); } rangeQueryReversed(options = {}) { return this.originalIndex.rangeQuery(options); } take(n, from, filterFn) { return this.originalIndex.takeReversed(n, from, filterFn); } takeReversed(n, from, filterFn) { return this.originalIndex.take(n, from, filterFn); } get orderedEntriesArray() { return this.originalIndex.orderedEntriesArrayReversed; } get orderedEntriesArrayReversed() { return this.originalIndex.orderedEntriesArray; } // All operations below delegate to the original index supports(operation) { return this.originalIndex.supports(operation); } matchesField(fieldPath) { return this.originalIndex.matchesField(fieldPath); } matchesCompareOptions(compareOptions) { return this.originalIndex.matchesCompareOptions(compareOptions); } matchesDirection(direction) { return this.originalIndex.matchesDirection(direction); } getStats() { return this.originalIndex.getStats(); } add(key, item) { this.originalIndex.add(key, item); } remove(key, item) { this.originalIndex.remove(key, item); } update(key, oldItem, newItem) { this.originalIndex.update(key, oldItem, newItem); } build(entries) { this.originalIndex.build(entries); } clear() { this.originalIndex.clear(); } get keyCount() { return this.originalIndex.keyCount; } equalityLookup(value) { return this.originalIndex.equalityLookup(value); } inArrayLookup(values) { return this.originalIndex.inArrayLookup(values); } get indexedKeysSet() { return this.originalIndex.indexedKeysSet; } get valueMapData() { return this.originalIndex.valueMapData; } } export { ReverseIndex }; //# sourceMappingURL=reverse-index.js.map