@jondotsoy/condition
v0.2.2
Published
Conditions for JSON. Receive conditions from outside.
Downloads
307
Maintainers
Readme
condition.js
Conditions for JSON. Receive conditions from outside.
Expressions:
- equal
- greaterThan
- lessThan
- greaterThanOrEqual
- lessThanOrEqual
- and
- or
- not
Sample:
import { evaluateCondition } from "@jondotsoy/condition";
const condition: ConditionDTO = {
and: [
{
equal: ["a.b", 3],
},
{
not: {
equal: ["a.c", 4],
},
},
],
};
const context = {
a: {
b: 3,
c: 3,
},
};
evaluateCondition(condition, context); // => true