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

Function coerceEmptyFlag

apps/sim/lib/table/sql.ts:545–552  ·  view source on GitHub ↗

* Coerces a `$empty` operand to a boolean. Accepts a real boolean (the UI path) * and the string forms `'true'` / `'false'` (lenient raw-API input). Anything * else throws rather than silently inverting the check — a 400 with a clear * message beats returning the opposite row set.

(field: string, value: unknown)

Source from the content-addressed store, hash-verified

543 * message beats returning the opposite row set.
544 */
545function coerceEmptyFlag(field: string, value: unknown): boolean {
546 if (typeof value === 'boolean') return value
547 if (value === 'true') return true
548 if (value === 'false') return false
549 throw new TableQueryValidationError(
550 `$empty on column "${field}" requires a boolean, got ${typeof value}`
551 )
552}
553
554/**
555 * Builds an emptiness check against a JSONB cell. `isEmpty` matches null cells

Callers 1

buildFieldConditionFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected