ts-flex-query
Version:
Flexible and type-safe data queries
26 lines • 920 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.and = and;
exports.or = or;
exports.not = not;
exports.negate = negate;
const function_application_1 = require("../../expressions/function-application");
const basic_1 = require("../basic");
const func_1 = require("./func");
const value_1 = require("./value");
function reduceBooleanOperands(functionKey, defaultValue, operands) {
return operands.length ? operands.reduce((prev, op) => (0, func_1.func)(functionKey, prev, op)) : (0, value_1.value)(defaultValue);
}
function and(...operands) {
return reduceBooleanOperands('and', true, operands);
}
function or(...operands) {
return reduceBooleanOperands('or', false, operands);
}
function not(operand) {
return (0, func_1.func)('not', operand);
}
function negate() {
return (0, basic_1.apply)(function_application_1.funcs.not);
}
//# sourceMappingURL=boolean.js.map