UNPKG

@tanstack/db

Version:

A reactive client store for building super fast apps on sync

22 lines (21 loc) • 736 B
import { Aggregate, Func, ConditionalSelect, isExpressionLike } from "../ir.js"; function findAggregate(value) { if (value === null || typeof value !== `object`) return void 0; if (Array.isArray(value)) { for (const item of value) { const aggregate = findAggregate(item); if (aggregate) return aggregate; } return void 0; } if (value instanceof Aggregate) return value; if (value instanceof Func) return findAggregate(value.args); if (value instanceof ConditionalSelect) return findAggregate([value.branches, value.defaultValue]); if (isExpressionLike(value)) return void 0; return findAggregate(Object.values(value)); } export { findAggregate }; //# sourceMappingURL=find-aggregate.js.map