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

Function isCaseWhenConditionTrue

packages/db/src/query/compiler/evaluators.ts:609–627  ·  view source on GitHub ↗
(value: any)

Source from the content-addressed store, hash-verified

607}
608
609export function isCaseWhenConditionTrue(value: any): boolean {
610 if (value == null || value === false) {
611 return false
612 }
613
614 if (value === true) {
615 return true
616 }
617
618 if (typeof value === `number`) {
619 return value !== 0 && !Number.isNaN(value)
620 }
621
622 if (typeof value === `bigint`) {
623 return value !== 0n
624 }
625
626 return Boolean(value)
627}
628
629/**
630 * Evaluates LIKE/ILIKE patterns

Callers 4

compileFunctionFunction · 0.85
compileConditionalSelectFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected