UNPKG

ts-flex-query

Version:
17 lines 806 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ifThenElse = ifThenElse; exports.ifThen = ifThen; const if_1 = require("../../expressions/if"); const convenience_1 = require("../convenience"); /** Returns the @see thenValue if @see condition evaluates to true and @see elseValue otherwise. */ function ifThenElse(condition, thenValue, elseValue) { return { instantiate: (input) => new if_1.IfExpression(condition.instantiate(input), thenValue.instantiate(input), elseValue.instantiate(input)) }; } /** Returns the @see thenValue if @see condition evaluates to true. Otherwise, returns undefined. */ function ifThen(condition, thenValue) { return ifThenElse(condition, thenValue, (0, convenience_1.value)(undefined)); } //# sourceMappingURL=if.js.map