UNPKG

@qrvey/formula-lang

Version:

QFormula support for qrvey projects

52 lines 1.38 kB
import { AST_PRIMITIVES } from '../constants'; import { isBooleanExpression } from '../utils/isBooleanExpression'; /** * `OR` Returns true if any expressions are truthy; otherwise, it will return false. */ export const OR = { identifier: 'OR', recursiveStartIn: 1, parameters: [ { identifier: 'LOGICAL_EXPRESSION', optional: false, expectedPrimitive: AST_PRIMITIVES.BOOLEAN, validator: [isBooleanExpression], }, { identifier: 'LOGICAL_EXPRESSION', optional: false, expectedPrimitive: AST_PRIMITIVES.BOOLEAN, validator: [isBooleanExpression], }, { identifier: 'LOGICAL_EXPRESSION', optional: true, expectedPrimitive: AST_PRIMITIVES.BOOLEAN, validator: [isBooleanExpression], }, ], transpiler: { elasticsearch, snowflake, redshift, postgresql, }, primitiveResult: AST_PRIMITIVES.BOOLEAN, }; function elasticsearch(...args) { return `(${args.join(' || ')})`; } function sql(...args) { return `(${args.join(' OR ')})`; } function snowflake(...args) { return sql(...args); } function redshift(...args) { return sql(...args); } function postgresql(...args) { return sql(...args); } //# sourceMappingURL=or.js.map