Skip to content

Commit 0734c0c

Browse files
Update README.md
1 parent c633e0e commit 0734c0c

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ Lets see how a sample rule will look like and then proceed to explain the differ
3838

3939
Above is a sample rule which has mandatory as well as optional parameters. You can choose to use which all attributes you need to use while defining your rule. Now let look into the attributes one by one.
4040

41-
##### A. condition
41+
##### 1.1. condition
4242
Condition is a function where the user can do the checks on the fact provided. The fact varaiable will be available in `this` context of the condition function. Lets see a sample condition below.
4343

4444
"condition": function(R) {
@@ -49,7 +49,7 @@ As you can see, the we have to pass an expression on to the `R.when` API. If the
4949

5050
Its mandatory to have this field.
5151

52-
##### B. consequnce
52+
##### 1.2. consequnce
5353
The consequence is the part where the we define what happens when the condition evaluates to true for a particular fact. Just like in condition, fact varaiable will be available in `this` context. You may utilize it to add extra result attributes if needed.
5454

5555
"consequence": function(R) {
@@ -60,17 +60,17 @@ In the above example we use an additional parameter `result` to communicate to t
6060

6161
Its mandatory to have this field.
6262

63-
##### C. priority
63+
##### 1.3. priority
6464
This field is used to specify the priority of a rule. The rules with higher priority will be applied on the fact first and then followed by lower priority rules. You can have multiple rules with same priority and the engine will not ensure the order in that case.
6565

6666
Its not mandatory to have this field.
6767

68-
##### D. on
68+
##### 1.4. on
6969
This is field is used to store the state of a rule. This is used to activate and diactivate rules at run time. Rules with `on` set to `false` will not be applied on the facts.
7070

7171
It is not mandatory to have this field.
7272

73-
##### E. add a unique attribute
73+
##### 1.5. add a unique attribute
7474
It is suggested that you should add a property which can be used as a unique identifier for a rule. Why it is because when you need to dynamically turn on/off or change priority of a rule, you will need a filter to select a rule from the engine via the APIs. That time you may use the unique property as a key for the filter for selection process.
7575

7676
Suppose that in the above example `name` is unique for each rule. Then for changing state or re prioritizing a rule at run time, you may use a filter like `{"name":"transaction minimum"}`.

0 commit comments

Comments
 (0)