UNPKG

@dstanesc/o-o-o-o-o-o-o

Version:

O-O-O-O-O-O-O is a collection of content addressed persistent data structures

55 lines 2 kB
var Operator; (function (Operator) { Operator[Operator["INCL"] = 0] = "INCL"; Operator[Operator["IT"] = 1] = "IT"; Operator[Operator["EQ"] = 2] = "EQ"; Operator[Operator["GT"] = 3] = "GT"; Operator[Operator["GTE"] = 4] = "GTE"; Operator[Operator["LT"] = 5] = "LT"; Operator[Operator["LTE"] = 6] = "LTE"; })(Operator || (Operator = {})); function eq(value, pre) { const operator = Operator.EQ; const operand = value; const predicate = (ctx) => pre === undefined ? ctx === value : pre(ctx) === value; return { operator, operand, predicate }; } function gt(value, pre) { const operator = Operator.GT; const operand = value; const predicate = (ctx) => pre === undefined ? ctx > value : pre(ctx) > value; return { operator, operand, predicate }; } function gte(value, pre) { const operator = Operator.GTE; const operand = value; const predicate = (ctx) => pre === undefined ? ctx >= value : pre(ctx) >= value; return { operator, operand, predicate }; } function lt(value, pre) { const operator = Operator.LT; const operand = value; const predicate = (ctx) => pre === undefined ? ctx < value : pre(ctx) < value; return { operator, operand, predicate }; } function lte(value, pre) { const operator = Operator.LTE; const operand = value; const predicate = (ctx) => pre === undefined ? ctx <= value : pre(ctx) <= value; return { operator, operand, predicate }; } //(value: any) => [55, 33].includes(value) function incl(values, pre) { const operator = Operator.INCL; const operand = values; const predicate = (ctx) => pre === undefined ? values.includes(ctx) : values.includes(pre(ctx)); return { operator, operand, predicate }; } function isTrue() { const operator = Operator.IT; const operand = undefined; const predicate = (ctx) => true; return { operator, operand, predicate }; } export { Operator, eq, gt, gte, lt, lte, isTrue, incl, }; //# sourceMappingURL=ops.js.map