You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+8-8Lines changed: 8 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,7 +10,7 @@ The same format can also be executed in PHP by the library [json-logic-php](http
10
10
11
11
### Simple
12
12
```js
13
-
jsonLogic( { "==": [1, 1] } );
13
+
jsonLogic.apply( { "==": [1, 1] } );
14
14
// true
15
15
```
16
16
@@ -24,7 +24,7 @@ This is a simple test, equivalent to `1 == 1`. A few things about the format:
24
24
Here we're beginning to nest rules.
25
25
26
26
```js
27
-
jsonLogic(
27
+
jsonLogic.apply(
28
28
{"and": [
29
29
{ ">": [3,1] },
30
30
{ "<": [1,3] }
@@ -44,7 +44,7 @@ In an infix language (like JavaScript) this could be written as:
44
44
Obviously these rules aren't very interesting if they can only take static literal data. Typically `jsonLogic` will be called with a rule object and a data object. You can use the `var` operator to get attributes of the data object:
45
45
46
46
```js
47
-
jsonLogic(
47
+
jsonLogic.apply(
48
48
{ "var": ["a"] }, // Rule
49
49
{ a :1, b :2 } // Data
50
50
);
@@ -54,7 +54,7 @@ jsonLogic(
54
54
If you like, we support [syntactic sugar](https://en.wikipedia.org/wiki/Syntactic_sugar) on unary operators to skip the array around values:
55
55
56
56
```js
57
-
jsonLogic(
57
+
jsonLogic.apply(
58
58
{ "var":"a" },
59
59
{ a :1, b :2 }
60
60
);
@@ -64,7 +64,7 @@ jsonLogic(
64
64
You can also use the `var` operator to access an array by numeric index:
65
65
66
66
```js
67
-
jsonLogic(
67
+
jsonLogic.apply(
68
68
{"var":1 },
69
69
[ "apple", "banana", "carrot" ]
70
70
);
@@ -81,7 +81,7 @@ var rules = { "and" : [
81
81
82
82
var data = { "temp":100, "pie": { "filling":"apple" } };
83
83
84
-
jsonLogic(rules, data);
84
+
jsonLogic.apply(rules, data);
85
85
// true
86
86
```
87
87
@@ -90,11 +90,11 @@ Sometimes the rule you want to process is "Always" or "Never." If the first par
0 commit comments