|
1 | 1 | # json-rules-engine-simplified
|
2 | 2 | A simple rules engine expressed in JSON
|
3 | 3 |
|
4 |
| -The primary goal of this project was to be used |
5 |
| -as alternative to [json-rules-engine](https://github.com/CacheControl/json-rules-engine) in [react-jsonschema-form-conditionals](https://github.com/RxNT/react-jsonschema-form-conditionals), |
6 |
| -as such it has some functionality, that might be specific, but there is nothing preventing it from more generic use. |
| 4 | +The primary goal of this project is to be |
| 5 | +an alternative of [json-rules-engine](https://github.com/CacheControl/json-rules-engine) for [react-jsonschema-form-conditionals](https://github.com/RxNT/react-jsonschema-form-conditionals), |
| 6 | +as such it has similar interface and configuration, but simplified predicate language, similar to SQL. |
7 | 7 |
|
8 | 8 | ## Features
|
9 | 9 |
|
10 |
| -- Optional schema and rules validation, to prevent runtime surprises |
| 10 | +- Optional schema and rules validation |
11 | 11 | - Basic boolean operations (`and` `or` and `not`) that allow to have any arbitrary complexity
|
12 | 12 | - Rules expressed in simple, easy to read JSON
|
13 | 13 | - Declarative conditional logic with [predicates](https://github.com/landau/predicate)
|
@@ -36,21 +36,16 @@ let rules = [{
|
36 | 36 | },
|
37 | 37 | event: {
|
38 | 38 | type: "remove",
|
39 |
| - params: { fields: [ "password" ] }, |
| 39 | + params: { |
| 40 | + fields: [ "password" ] |
| 41 | + }, |
40 | 42 | }
|
41 | 43 | }];
|
42 | 44 |
|
43 |
| -let schema = { |
44 |
| - properties: { |
45 |
| - firstName: { type: "string" }, |
46 |
| - lastName: { type: "string" } |
47 |
| - } |
48 |
| -} |
49 |
| - |
50 | 45 | /**
|
51 | 46 | * Setup a new engine
|
52 | 47 | */
|
53 |
| -let engine = new Engine(rules, schema); |
| 48 | +let engine = new Engine(rules); |
54 | 49 |
|
55 | 50 | let formData = {
|
56 | 51 | lastName: "Smit"
|
|
0 commit comments