ts-flex-query
Version:
Flexible and type-safe data queries
18 lines • 886 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.ifUndefined = ifUndefined;
const functions_1 = require("../../functions");
const expression_1 = require("./expression");
const func_1 = require("./func");
const no_op_1 = require("./no-op");
/** Applies a fallback value if the input is undefined or null. */
function ifUndefined(fallbackValue) {
return (0, func_1.customFunc)(functions_1.internal, 'ifUndefined', (0, no_op_1.noOp)(), (0, expression_1.expression)(fallbackValue));
// apply((input) => func(internal, 'mergeObjects', input, obj) as Expression<MergeOutType<TIn, TObj>>);
// return ifThenElse(
// or(func('equal', noOp(), value(undefined)), func('equal', noOp(), value(null))),
// expression(fallbackValue),
// noOp() as PipeOperator<TIn, NonNullable<TIn>>
// );
}
//# sourceMappingURL=if-undefined.js.map