MCPcopy Index your code
hub / github.com/simstudioai/sim / flattenCondition

Function flattenCondition

apps/sim/lib/workspace-events/no-activity.test.ts:60–67  ·  view source on GitHub ↗

Flattens nested and/or condition trees from the drizzle operator mocks.

(condition: unknown)

Source from the content-addressed store, hash-verified

58
59/** Flattens nested and/or condition trees from the drizzle operator mocks. */
60function flattenCondition(condition: unknown): unknown[] {
61 if (!condition || typeof condition !== 'object') return []
62 const node = condition as { type?: string; conditions?: unknown[] }
63 if (node.type === 'and' || node.type === 'or') {
64 return [node, ...(node.conditions ?? []).flatMap(flattenCondition)]
65 }
66 return [node]
67}
68
69function allWhereConditions(): unknown[] {
70 return dbChainMockFns.where.mock.calls.flatMap(([condition]) => flattenCondition(condition))

Callers 1

allWhereConditionsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected