0.2.2 • Published 11 months ago

@jondotsoy/condition v0.2.2

Weekly downloads
-
License
MIT
Repository
github
Last release
11 months ago

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
0.2.2

11 months ago

0.2.1

11 months ago

0.2.0

11 months ago

0.1.3

11 months ago

0.1.2

11 months ago

0.1.1

11 months ago

0.1.0

11 months ago