MCPcopy Create free account
hub / github.com/TanStack/db / findInArrayExpr

Function findInArrayExpr

packages/db/tests/query/live-query-collection.test.ts:2710–2722  ·  view source on GitHub ↗
(
        expr: LoadSubsetOptions[`where`],
      )

Source from the content-addressed store, hash-verified

2708 // Find the inArray expression in loadSubset calls
2709 // It may be wrapped in `and` since requestSnapshot combines expressions
2710 const findInArrayExpr = (
2711 expr: LoadSubsetOptions[`where`],
2712 ): Func | undefined => {
2713 if (!(expr instanceof Func)) return undefined
2714 if (expr.name === `in`) return expr
2715 if (expr.name === `and` || expr.name === `or`) {
2716 for (const arg of expr.args) {
2717 const found = findInArrayExpr(arg)
2718 if (found) return found
2719 }
2720 }
2721 return undefined
2722 }
2723
2724 const inExpr = capturedOptions
2725 .map((opt) => findInArrayExpr(opt.where))

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected