|
63 | 63 | [{"if":[true, "apple", true, "banana", true, "carrot", "date"]}, null, "apple"], |
64 | 64 |
|
65 | 65 | "Missing", |
66 | | - |
67 | 66 | [{"missing":[]}, null, []], |
68 | 67 | [{"missing":["a"]}, null, ["a"]], |
69 | 68 | [{"missing":"a"}, null, ["a"]], |
|
81 | 80 | [{"missing":["a.b"]}, {"a":{"b":"apple brownie"}}, []], |
82 | 81 | [{"missing":["a.b", "a.c"]}, {"a":{"b":"apple brownie"}}, ["a.c"]], |
83 | 82 |
|
84 | | -"Missing and If are friends", |
| 83 | +"Missing and If are friends, because empty arrays are falsey in JsonLogic", |
85 | 84 | [{"if":[ {"missing":"a"}, "missed it", "found it" ]}, {"a":"apple"}, "found it"], |
86 | 85 | [{"if":[ {"missing":"a"}, "missed it", "found it" ]}, {"b":"banana"}, "missed it"], |
87 | 86 |
|
|
98 | 97 | [{"merge":[1,2]}, null, [1,2]], |
99 | 98 | [{"merge":[1,[2]]}, null, [1,2]], |
100 | 99 |
|
101 | | -"Missing and Merge, and If are friends. VIN is always required, APR is only required if financing is true.", |
| 100 | +"Missing, Merge, and If are friends. VIN is always required, APR is only required if financing is true.", |
102 | 101 | [ |
103 | | -{"missing":{"merge":[ |
104 | | - "vin", |
105 | | - {"if": [{"var":"financing"}, ["apr"], [] ]} |
106 | | -]} }, |
107 | | -{"financing":true}, |
108 | | -["vin","apr"] |
| 102 | + {"missing":{"merge":[ "vin", {"if": [{"var":"financing"}, ["apr"], [] ]} ]} }, |
| 103 | + {"financing":true}, |
| 104 | + ["vin","apr"] |
109 | 105 | ], |
110 | 106 |
|
111 | 107 | [ |
112 | | -{"missing":{"merge":[ |
113 | | - "vin", |
114 | | - {"if": [{"var":"financing"}, ["apr"], [] ]} |
115 | | -]} }, |
116 | | -{"financing":false}, |
117 | | -["vin"] |
| 108 | + {"missing":{"merge":[ "vin", {"if": [{"var":"financing"}, ["apr"], [] ]} ]} }, |
| 109 | + {"financing":false}, |
| 110 | + ["vin"] |
118 | 111 | ], |
119 | 112 |
|
120 | 113 | "END" |
|
0 commit comments