UNPKG

@qrvey/formula-lang

Version:

QFormula support for qrvey projects

52 lines 1.39 kB
import { AST_PRIMITIVES } from '../constants'; import { isBooleanExpression } from '../utils/isBooleanExpression'; /** * `AND` Returns true if all expressions are truthy; otherwise, it will return false. */ export const AND = { identifier: 'AND', 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(' AND ')})`; } function snowflake(...args) { return sql(...args); } function redshift(...args) { return sql(...args); } function postgresql(...args) { return sql(...args); } //# sourceMappingURL=and.js.map