@bizone-ai/json-transform-utils 1.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +81 -0
- package/dist/ParseContext.d.ts +23 -0
- package/dist/ParseContext.d.ts.map +1 -0
- package/dist/ParseContext.js +69 -0
- package/dist/ParseContext.js.map +1 -0
- package/dist/__tests__/functions/functionsParser.test.d.ts +2 -0
- package/dist/__tests__/functions/functionsParser.test.d.ts.map +1 -0
- package/dist/__tests__/functions/functionsParser.test.js +787 -0
- package/dist/__tests__/functions/functionsParser.test.js.map +1 -0
- package/dist/__tests__/jsonpath/jsonpathJoin.test.d.ts +2 -0
- package/dist/__tests__/jsonpath/jsonpathJoin.test.d.ts.map +1 -0
- package/dist/__tests__/jsonpath/jsonpathJoin.test.js +27 -0
- package/dist/__tests__/jsonpath/jsonpathJoin.test.js.map +1 -0
- package/dist/__tests__/parse.test.d.ts +2 -0
- package/dist/__tests__/parse.test.d.ts.map +1 -0
- package/dist/__tests__/parse.test.js +22 -0
- package/dist/__tests__/parse.test.js.map +1 -0
- package/dist/__tests__/utils/convert.test.d.ts +2 -0
- package/dist/__tests__/utils/convert.test.d.ts.map +1 -0
- package/dist/__tests__/utils/convert.test.js +181 -0
- package/dist/__tests__/utils/convert.test.js.map +1 -0
- package/dist/functions/ContextVariablesSchemas.d.ts +3 -0
- package/dist/functions/ContextVariablesSchemas.d.ts.map +1 -0
- package/dist/functions/ContextVariablesSchemas.js +9 -0
- package/dist/functions/ContextVariablesSchemas.js.map +1 -0
- package/dist/functions/definitions.d.ts +4 -0
- package/dist/functions/definitions.d.ts.map +1 -0
- package/dist/functions/definitions.js +2090 -0
- package/dist/functions/definitions.js.map +1 -0
- package/dist/functions/examples/and.json +44 -0
- package/dist/functions/examples/at.json +156 -0
- package/dist/functions/examples/avg.json +78 -0
- package/dist/functions/examples/base64.json +368 -0
- package/dist/functions/examples/boolean.json +236 -0
- package/dist/functions/examples/coalesce.json +58 -0
- package/dist/functions/examples/concat.json +70 -0
- package/dist/functions/examples/contains.json +61 -0
- package/dist/functions/examples/csv.json +116 -0
- package/dist/functions/examples/csvparse.json +97 -0
- package/dist/functions/examples/date.json +389 -0
- package/dist/functions/examples/decimal.json +102 -0
- package/dist/functions/examples/digest.json +125 -0
- package/dist/functions/examples/distinct.json +142 -0
- package/dist/functions/examples/entries.json +88 -0
- package/dist/functions/examples/eval.json +72 -0
- package/dist/functions/examples/every.json +96 -0
- package/dist/functions/examples/filter.json +51 -0
- package/dist/functions/examples/find.json +51 -0
- package/dist/functions/examples/findindex.json +61 -0
- package/dist/functions/examples/flat.json +74 -0
- package/dist/functions/examples/flatten.json +76 -0
- package/dist/functions/examples/form.json +60 -0
- package/dist/functions/examples/formparse.json +62 -0
- package/dist/functions/examples/group.json +208 -0
- package/dist/functions/examples/if.json +294 -0
- package/dist/functions/examples/indexof.json +48 -0
- package/dist/functions/examples/is.json +512 -0
- package/dist/functions/examples/isnull.json +51 -0
- package/dist/functions/examples/join.json +221 -0
- package/dist/functions/examples/jsonparse.json +101 -0
- package/dist/functions/examples/jsonpatch.json +30 -0
- package/dist/functions/examples/jsonpath.json +62 -0
- package/dist/functions/examples/jsonpointer.json +77 -0
- package/dist/functions/examples/jwtparse.json +54 -0
- package/dist/functions/examples/length.json +202 -0
- package/dist/functions/examples/long.json +53 -0
- package/dist/functions/examples/lookup.json +223 -0
- package/dist/functions/examples/lower.json +24 -0
- package/dist/functions/examples/map.json +188 -0
- package/dist/functions/examples/match.json +62 -0
- package/dist/functions/examples/matchall.json +62 -0
- package/dist/functions/examples/math.json +1073 -0
- package/dist/functions/examples/max.json +104 -0
- package/dist/functions/examples/merge.json +173 -0
- package/dist/functions/examples/min.json +104 -0
- package/dist/functions/examples/normalize.json +142 -0
- package/dist/functions/examples/not.json +99 -0
- package/dist/functions/examples/numberformat.json +162 -0
- package/dist/functions/examples/numberparse.json +72 -0
- package/dist/functions/examples/object.json +148 -0
- package/dist/functions/examples/or.json +102 -0
- package/dist/functions/examples/pad.json +102 -0
- package/dist/functions/examples/partition.json +32 -0
- package/dist/functions/examples/range.json +188 -0
- package/dist/functions/examples/raw.json +58 -0
- package/dist/functions/examples/reduce.json +79 -0
- package/dist/functions/examples/repeat.json +59 -0
- package/dist/functions/examples/replace.json +92 -0
- package/dist/functions/examples/reverse.json +94 -0
- package/dist/functions/examples/slice.json +360 -0
- package/dist/functions/examples/some.json +96 -0
- package/dist/functions/examples/sort.json +353 -0
- package/dist/functions/examples/split.json +52 -0
- package/dist/functions/examples/string.json +95 -0
- package/dist/functions/examples/substring.json +82 -0
- package/dist/functions/examples/sum.json +108 -0
- package/dist/functions/examples/switch.json +78 -0
- package/dist/functions/examples/template.json +125 -0
- package/dist/functions/examples/test.json +82 -0
- package/dist/functions/examples/transform.json +58 -0
- package/dist/functions/examples/trim.json +44 -0
- package/dist/functions/examples/unflatten.json +97 -0
- package/dist/functions/examples/upper.json +24 -0
- package/dist/functions/examples/uriparse.json +52 -0
- package/dist/functions/examples/urldecode.json +42 -0
- package/dist/functions/examples/urlencode.json +43 -0
- package/dist/functions/examples/uuid.json +142 -0
- package/dist/functions/examples/value.json +87 -0
- package/dist/functions/examples/wrap.json +122 -0
- package/dist/functions/examples/xml.json +142 -0
- package/dist/functions/examples/xmlparse.json +161 -0
- package/dist/functions/examples/xor.json +166 -0
- package/dist/functions/examples/yaml.json +196 -0
- package/dist/functions/examples/yamlparse.json +150 -0
- package/dist/functions/examples.d.ts +4 -0
- package/dist/functions/examples.d.ts.map +1 -0
- package/dist/functions/examples.js +178 -0
- package/dist/functions/examples.js.map +1 -0
- package/dist/functions/functions.d.ts +3 -0
- package/dist/functions/functions.d.ts.map +1 -0
- package/dist/functions/functions.js +9 -0
- package/dist/functions/functions.js.map +1 -0
- package/dist/functions/functionsParser.d.ts +45 -0
- package/dist/functions/functionsParser.d.ts.map +1 -0
- package/dist/functions/functionsParser.js +207 -0
- package/dist/functions/functionsParser.js.map +1 -0
- package/dist/functions/parseDefinitions.d.ts +4 -0
- package/dist/functions/parseDefinitions.d.ts.map +1 -0
- package/dist/functions/parseDefinitions.js +56 -0
- package/dist/functions/parseDefinitions.js.map +1 -0
- package/dist/functions/types.d.ts +163 -0
- package/dist/functions/types.d.ts.map +1 -0
- package/dist/functions/types.js +93 -0
- package/dist/functions/types.js.map +1 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +36 -0
- package/dist/index.js.map +1 -0
- package/dist/jsonpath/jsonpathFunctions.d.ts +4 -0
- package/dist/jsonpath/jsonpathFunctions.d.ts.map +1 -0
- package/dist/jsonpath/jsonpathFunctions.js +26 -0
- package/dist/jsonpath/jsonpathFunctions.js.map +1 -0
- package/dist/jsonpath/jsonpathJoin.d.ts +3 -0
- package/dist/jsonpath/jsonpathJoin.d.ts.map +1 -0
- package/dist/jsonpath/jsonpathJoin.js +15 -0
- package/dist/jsonpath/jsonpathJoin.js.map +1 -0
- package/dist/parse.d.ts +12 -0
- package/dist/parse.d.ts.map +1 -0
- package/dist/parse.js +522 -0
- package/dist/parse.js.map +1 -0
- package/dist/transformUtils.d.ts +40 -0
- package/dist/transformUtils.d.ts.map +1 -0
- package/dist/transformUtils.js +89 -0
- package/dist/transformUtils.js.map +1 -0
- package/dist/utils/convert.d.ts +3 -0
- package/dist/utils/convert.d.ts.map +1 -0
- package/dist/utils/convert.js +163 -0
- package/dist/utils/convert.js.map +1 -0
- package/package.json +44 -0
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"name": "object - found",
|
|
4
|
+
"given": {
|
|
5
|
+
"input": ["A", "B", "C"],
|
|
6
|
+
"definition": {
|
|
7
|
+
"$$indexof": "$",
|
|
8
|
+
"of": "B"
|
|
9
|
+
}
|
|
10
|
+
},
|
|
11
|
+
"expect": {
|
|
12
|
+
"equal": 1
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
"name": "object - not found",
|
|
17
|
+
"given": {
|
|
18
|
+
"input": ["A", "B", "C"],
|
|
19
|
+
"definition": {
|
|
20
|
+
"$$indexof": "$",
|
|
21
|
+
"of": "D"
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"expect": {
|
|
25
|
+
"equal": -1
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"name": "inline - found",
|
|
30
|
+
"given": {
|
|
31
|
+
"input": ["A", "B", "C"],
|
|
32
|
+
"definition": "$$indexof(B):$"
|
|
33
|
+
},
|
|
34
|
+
"expect": {
|
|
35
|
+
"equal": 1
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"name": "inline - not found",
|
|
40
|
+
"given": {
|
|
41
|
+
"input": ["A", "B", "C"],
|
|
42
|
+
"definition": "$$indexof(D):$"
|
|
43
|
+
},
|
|
44
|
+
"expect": {
|
|
45
|
+
"equal": -1
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
]
|
|
@@ -0,0 +1,512 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"name": "assert eq not eq",
|
|
4
|
+
"given": {
|
|
5
|
+
"input": "A",
|
|
6
|
+
"definition": { "$$is": "$", "eq": "A" }
|
|
7
|
+
},
|
|
8
|
+
"expect": {
|
|
9
|
+
"equal": true
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
"name": "assert eq not eq",
|
|
14
|
+
"given": {
|
|
15
|
+
"input": "A",
|
|
16
|
+
"definition": { "$$is": "$", "eq": "B" }
|
|
17
|
+
},
|
|
18
|
+
"expect": {
|
|
19
|
+
"equal": false
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"name": "assert eq not eq",
|
|
24
|
+
"given": {
|
|
25
|
+
"input": 4,
|
|
26
|
+
"definition": { "$$is": "$", "eq": 4 }
|
|
27
|
+
},
|
|
28
|
+
"expect": {
|
|
29
|
+
"equal": true
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"name": "assert eq not eq",
|
|
34
|
+
"given": {
|
|
35
|
+
"input": 4.5,
|
|
36
|
+
"definition": { "$$is": "$", "eq": 4 }
|
|
37
|
+
},
|
|
38
|
+
"expect": {
|
|
39
|
+
"equal": false
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
"name": "assert eq not eq",
|
|
44
|
+
"given": {
|
|
45
|
+
"input": 4.5,
|
|
46
|
+
"definition": { "$$is": "$", "neq": 4 }
|
|
47
|
+
},
|
|
48
|
+
"expect": {
|
|
49
|
+
"equal": true
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
"name": "assert eq not eq",
|
|
54
|
+
"given": {
|
|
55
|
+
"input": 4.5,
|
|
56
|
+
"definition": { "$$is": "$", "eq": 4.5, "neq": 4 }
|
|
57
|
+
},
|
|
58
|
+
"expect": {
|
|
59
|
+
"equal": true
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
"name": "assert gt gte lt lte",
|
|
64
|
+
"given": {
|
|
65
|
+
"input": "B",
|
|
66
|
+
"definition": { "$$is": "$", "gt": "A" }
|
|
67
|
+
},
|
|
68
|
+
"expect": {
|
|
69
|
+
"equal": true
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
"name": "assert gt gte lt lte",
|
|
74
|
+
"given": {
|
|
75
|
+
"input": "B",
|
|
76
|
+
"definition": { "$$is": "$", "gte": "B" }
|
|
77
|
+
},
|
|
78
|
+
"expect": {
|
|
79
|
+
"equal": true
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
"name": "assert gt gte lt lte",
|
|
84
|
+
"given": {
|
|
85
|
+
"input": 4,
|
|
86
|
+
"definition": { "$$is": "$", "gt": 3 }
|
|
87
|
+
},
|
|
88
|
+
"expect": {
|
|
89
|
+
"equal": true
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
"name": "assert gt gte lt lte",
|
|
94
|
+
"given": {
|
|
95
|
+
"input": 4,
|
|
96
|
+
"definition": { "$$is": "$", "gte": 4 }
|
|
97
|
+
},
|
|
98
|
+
"expect": {
|
|
99
|
+
"equal": true
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
"name": "assert gt gte lt lte",
|
|
104
|
+
"given": {
|
|
105
|
+
"input": 4,
|
|
106
|
+
"definition": { "$$is": "$", "lte": 4 }
|
|
107
|
+
},
|
|
108
|
+
"expect": {
|
|
109
|
+
"equal": true
|
|
110
|
+
}
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
"name": "assert gt gte lt lte",
|
|
114
|
+
"given": {
|
|
115
|
+
"input": 3,
|
|
116
|
+
"definition": { "$$is": "$", "lt": 4 }
|
|
117
|
+
},
|
|
118
|
+
"expect": {
|
|
119
|
+
"equal": true
|
|
120
|
+
}
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
"name": "assert gt gte lt lte",
|
|
124
|
+
"given": {
|
|
125
|
+
"input": 4,
|
|
126
|
+
"definition": { "$$is": "$", "lt": 4 }
|
|
127
|
+
},
|
|
128
|
+
"expect": {
|
|
129
|
+
"equal": false
|
|
130
|
+
}
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
"name": "assert gt gte lt lte",
|
|
134
|
+
"given": {
|
|
135
|
+
"input": [1, 2, 3],
|
|
136
|
+
"definition": { "$$is": "$", "lt": [true, "a", "b", "c"] }
|
|
137
|
+
},
|
|
138
|
+
"expect": {
|
|
139
|
+
"equal": true
|
|
140
|
+
}
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
"name": "assert gt gte lt lte",
|
|
144
|
+
"given": {
|
|
145
|
+
"input": [1, 2, 3],
|
|
146
|
+
"definition": { "$$is": "$", "gte": ["a", "b", "c"] }
|
|
147
|
+
},
|
|
148
|
+
"expect": {
|
|
149
|
+
"equal": true
|
|
150
|
+
}
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
"name": "assert gt gte lt lte",
|
|
154
|
+
"given": {
|
|
155
|
+
"input": { "a": 1, "b": 2 },
|
|
156
|
+
"definition": { "$$is": "$", "gte": { "key1": "a", "key2": "b" } }
|
|
157
|
+
},
|
|
158
|
+
"expect": {
|
|
159
|
+
"equal": true
|
|
160
|
+
}
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
"name": "assert in not in",
|
|
164
|
+
"given": {
|
|
165
|
+
"input": "A",
|
|
166
|
+
"definition": { "$$is": "$", "in": ["A", "B"] }
|
|
167
|
+
},
|
|
168
|
+
"expect": {
|
|
169
|
+
"equal": true
|
|
170
|
+
}
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
"name": "assert in not in",
|
|
174
|
+
"given": {
|
|
175
|
+
"input": ["A", "B"],
|
|
176
|
+
"definition": { "$$is": "A", "in": "$" }
|
|
177
|
+
},
|
|
178
|
+
"expect": {
|
|
179
|
+
"equal": true
|
|
180
|
+
}
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
"name": "assert in not in",
|
|
184
|
+
"given": {
|
|
185
|
+
"input": ["A", "B"],
|
|
186
|
+
"definition": { "$$is": "B", "in": ["$[0]", "$[1]"] }
|
|
187
|
+
},
|
|
188
|
+
"expect": {
|
|
189
|
+
"equal": true
|
|
190
|
+
}
|
|
191
|
+
},
|
|
192
|
+
{
|
|
193
|
+
"name": "assert in not in",
|
|
194
|
+
"given": {
|
|
195
|
+
"input": ["a", "B"],
|
|
196
|
+
"definition": { "$$is": "A", "in": "$" }
|
|
197
|
+
},
|
|
198
|
+
"expect": {
|
|
199
|
+
"equal": false
|
|
200
|
+
}
|
|
201
|
+
},
|
|
202
|
+
{
|
|
203
|
+
"name": "assert in not in",
|
|
204
|
+
"given": {
|
|
205
|
+
"input": [false, true],
|
|
206
|
+
"definition": { "$$is": true, "in": "$" }
|
|
207
|
+
},
|
|
208
|
+
"expect": {
|
|
209
|
+
"equal": true
|
|
210
|
+
}
|
|
211
|
+
},
|
|
212
|
+
{
|
|
213
|
+
"name": "assert in not in",
|
|
214
|
+
"given": {
|
|
215
|
+
"input": null,
|
|
216
|
+
"definition": { "$$is": 30, "in": [10, 20, 30] }
|
|
217
|
+
},
|
|
218
|
+
"expect": {
|
|
219
|
+
"equal": true
|
|
220
|
+
}
|
|
221
|
+
},
|
|
222
|
+
{
|
|
223
|
+
"name": "assert in not in",
|
|
224
|
+
"given": {
|
|
225
|
+
"input": null,
|
|
226
|
+
"definition": { "$$is": 30, "nin": [10, 20, 30] }
|
|
227
|
+
},
|
|
228
|
+
"expect": {
|
|
229
|
+
"equal": false
|
|
230
|
+
}
|
|
231
|
+
},
|
|
232
|
+
{
|
|
233
|
+
"name": "assert in not in",
|
|
234
|
+
"given": {
|
|
235
|
+
"input": null,
|
|
236
|
+
"definition": { "$$is": 30, "in": "$" }
|
|
237
|
+
},
|
|
238
|
+
"expect": {
|
|
239
|
+
"equal": false
|
|
240
|
+
}
|
|
241
|
+
},
|
|
242
|
+
{
|
|
243
|
+
"name": "assert in not in",
|
|
244
|
+
"given": {
|
|
245
|
+
"input": null,
|
|
246
|
+
"definition": { "$$is": 30, "nin": "$" }
|
|
247
|
+
},
|
|
248
|
+
"expect": {
|
|
249
|
+
"equal": false
|
|
250
|
+
}
|
|
251
|
+
},
|
|
252
|
+
{
|
|
253
|
+
"name": "assert in not in",
|
|
254
|
+
"given": {
|
|
255
|
+
"input": null,
|
|
256
|
+
"definition": { "$$is": [{ "a": 1 }], "in": [[{ "a": 4 }], [{ "a": 1 }], [{ "a": 3 }]] }
|
|
257
|
+
},
|
|
258
|
+
"expect": {
|
|
259
|
+
"equal": true
|
|
260
|
+
}
|
|
261
|
+
},
|
|
262
|
+
{
|
|
263
|
+
"name": "assert in not in",
|
|
264
|
+
"given": {
|
|
265
|
+
"input": null,
|
|
266
|
+
"definition": { "$$is": 30, "in": [10, 20, 30], "nin": [40, 50, 60] }
|
|
267
|
+
},
|
|
268
|
+
"expect": {
|
|
269
|
+
"equal": true
|
|
270
|
+
}
|
|
271
|
+
},
|
|
272
|
+
{
|
|
273
|
+
"name": "assert in not in",
|
|
274
|
+
"given": {
|
|
275
|
+
"input": null,
|
|
276
|
+
"definition": { "$$is": 30, "in": [40, 50, 60], "nin": [10, 20, 30] }
|
|
277
|
+
},
|
|
278
|
+
"expect": {
|
|
279
|
+
"equal": false
|
|
280
|
+
}
|
|
281
|
+
},
|
|
282
|
+
{
|
|
283
|
+
"name": "and or example",
|
|
284
|
+
"given": {
|
|
285
|
+
"input": 2,
|
|
286
|
+
"definition": { "$$is": true, "in": [{ "$$is": "$", "gt": 1, "lt": 3 }, { "$$is": "$", "gte": 4, "lte": 6 }] }
|
|
287
|
+
},
|
|
288
|
+
"expect": {
|
|
289
|
+
"equal": true
|
|
290
|
+
}
|
|
291
|
+
},
|
|
292
|
+
{
|
|
293
|
+
"name": "and or example",
|
|
294
|
+
"given": {
|
|
295
|
+
"input": 4,
|
|
296
|
+
"definition": { "$$is": true, "in": [{ "$$is": "$", "gt": 1, "lt": 3 }, { "$$is": "$", "gte": 4, "lte": 6 }] }
|
|
297
|
+
},
|
|
298
|
+
"expect": {
|
|
299
|
+
"equal": true
|
|
300
|
+
}
|
|
301
|
+
},
|
|
302
|
+
{
|
|
303
|
+
"name": "and or example",
|
|
304
|
+
"given": {
|
|
305
|
+
"input": 5,
|
|
306
|
+
"definition": { "$$is": true, "in": [{ "$$is": "$", "gt": 1, "lt": 3 }, { "$$is": "$", "gte": 4, "lte": 6 }] }
|
|
307
|
+
},
|
|
308
|
+
"expect": {
|
|
309
|
+
"equal": true
|
|
310
|
+
}
|
|
311
|
+
},
|
|
312
|
+
{
|
|
313
|
+
"name": "and or example",
|
|
314
|
+
"given": {
|
|
315
|
+
"input": 6,
|
|
316
|
+
"definition": { "$$is": true, "in": [{ "$$is": "$", "gt": 1, "lt": 3 }, { "$$is": "$", "gte": 4, "lte": 6 }] }
|
|
317
|
+
},
|
|
318
|
+
"expect": {
|
|
319
|
+
"equal": true
|
|
320
|
+
}
|
|
321
|
+
},
|
|
322
|
+
{
|
|
323
|
+
"name": "and or example",
|
|
324
|
+
"given": {
|
|
325
|
+
"input": 1,
|
|
326
|
+
"definition": { "$$is": true, "in": [{ "$$is": "$", "gt": 1, "lt": 3 }, { "$$is": "$", "gte": 4, "lte": 6 }] }
|
|
327
|
+
},
|
|
328
|
+
"expect": {
|
|
329
|
+
"equal": false
|
|
330
|
+
}
|
|
331
|
+
},
|
|
332
|
+
{
|
|
333
|
+
"name": "and or example",
|
|
334
|
+
"given": {
|
|
335
|
+
"input": 3,
|
|
336
|
+
"definition": { "$$is": true, "in": [{ "$$is": "$", "gt": 1, "lt": 3 }, { "$$is": "$", "gte": 4, "lte": 6 }] }
|
|
337
|
+
},
|
|
338
|
+
"expect": {
|
|
339
|
+
"equal": false
|
|
340
|
+
}
|
|
341
|
+
},
|
|
342
|
+
{
|
|
343
|
+
"name": "and or example",
|
|
344
|
+
"given": {
|
|
345
|
+
"input": 7,
|
|
346
|
+
"definition": { "$$is": true, "in": [{ "$$is": "$", "gt": 1, "lt": 3 }, { "$$is": "$", "gte": 4, "lte": 6 }] }
|
|
347
|
+
},
|
|
348
|
+
"expect": {
|
|
349
|
+
"equal": false
|
|
350
|
+
}
|
|
351
|
+
},
|
|
352
|
+
{
|
|
353
|
+
"name": "object op that (EQ)",
|
|
354
|
+
"given": {
|
|
355
|
+
"input": "A",
|
|
356
|
+
"definition": { "$$is": "$", "op": "EQ", "that": "A" }
|
|
357
|
+
},
|
|
358
|
+
"expect": {
|
|
359
|
+
"equal": true
|
|
360
|
+
}
|
|
361
|
+
},
|
|
362
|
+
{
|
|
363
|
+
"name": "object op that (EQ) false",
|
|
364
|
+
"given": {
|
|
365
|
+
"input": "A",
|
|
366
|
+
"definition": { "$$is": "$", "op": "EQ", "that": "B" }
|
|
367
|
+
},
|
|
368
|
+
"expect": {
|
|
369
|
+
"equal": false
|
|
370
|
+
}
|
|
371
|
+
},
|
|
372
|
+
{
|
|
373
|
+
"name": "object op that (!=)",
|
|
374
|
+
"given": {
|
|
375
|
+
"input": "A",
|
|
376
|
+
"definition": { "$$is": "$", "op": "!=", "that": "B" }
|
|
377
|
+
},
|
|
378
|
+
"expect": {
|
|
379
|
+
"equal": true
|
|
380
|
+
}
|
|
381
|
+
},
|
|
382
|
+
{
|
|
383
|
+
"name": "object op that (>)",
|
|
384
|
+
"given": {
|
|
385
|
+
"input": 5,
|
|
386
|
+
"definition": { "$$is": "$", "op": ">", "that": 2 }
|
|
387
|
+
},
|
|
388
|
+
"expect": {
|
|
389
|
+
"equal": true
|
|
390
|
+
}
|
|
391
|
+
},
|
|
392
|
+
{
|
|
393
|
+
"name": "inline op that (EQ equal)",
|
|
394
|
+
"given": {
|
|
395
|
+
"input": "A",
|
|
396
|
+
"definition": "$$is(EQ,A):$"
|
|
397
|
+
},
|
|
398
|
+
"expect": {
|
|
399
|
+
"equal": true
|
|
400
|
+
}
|
|
401
|
+
},
|
|
402
|
+
{
|
|
403
|
+
"name": "inline op that (= equal)",
|
|
404
|
+
"given": {
|
|
405
|
+
"input": "A",
|
|
406
|
+
"definition": "$$is(=,B):$"
|
|
407
|
+
},
|
|
408
|
+
"expect": {
|
|
409
|
+
"equal": false
|
|
410
|
+
}
|
|
411
|
+
},
|
|
412
|
+
{
|
|
413
|
+
"name": "inline op that (!= not equal)",
|
|
414
|
+
"given": {
|
|
415
|
+
"input": "A",
|
|
416
|
+
"definition": "$$is(!=,B):$"
|
|
417
|
+
},
|
|
418
|
+
"expect": {
|
|
419
|
+
"equal": true
|
|
420
|
+
}
|
|
421
|
+
},
|
|
422
|
+
{
|
|
423
|
+
"name": "inline op that (> can't compare string to number)",
|
|
424
|
+
"given": {
|
|
425
|
+
"input": "10",
|
|
426
|
+
"definition": "$$is(>,2):$"
|
|
427
|
+
},
|
|
428
|
+
"expect": {
|
|
429
|
+
"equal": false
|
|
430
|
+
}
|
|
431
|
+
},
|
|
432
|
+
{
|
|
433
|
+
"name": "inline op that (> detect literal number parameter)",
|
|
434
|
+
"given": {
|
|
435
|
+
"input": 10,
|
|
436
|
+
"definition": "$$is(>,2):$"
|
|
437
|
+
},
|
|
438
|
+
"expect": {
|
|
439
|
+
"equal": true
|
|
440
|
+
}
|
|
441
|
+
},
|
|
442
|
+
{
|
|
443
|
+
"name": "inline op that (IN)",
|
|
444
|
+
"given": {
|
|
445
|
+
"input": ["a", "b", "A", "B"],
|
|
446
|
+
"definition": "$$is(IN,$):A"
|
|
447
|
+
},
|
|
448
|
+
"expect": {
|
|
449
|
+
"equal": true
|
|
450
|
+
}
|
|
451
|
+
},
|
|
452
|
+
{
|
|
453
|
+
"name": "inline op that (IN) false",
|
|
454
|
+
"given": {
|
|
455
|
+
"input": ["a", "b", "A", "B"],
|
|
456
|
+
"definition": "$$is(IN,$):C"
|
|
457
|
+
},
|
|
458
|
+
"expect": {
|
|
459
|
+
"equal": false
|
|
460
|
+
}
|
|
461
|
+
},
|
|
462
|
+
{
|
|
463
|
+
"name": "inline op that (NIN)",
|
|
464
|
+
"given": {
|
|
465
|
+
"input": ["a", "b", "A", "B"],
|
|
466
|
+
"definition": "$$is(NIN,$):C"
|
|
467
|
+
},
|
|
468
|
+
"expect": {
|
|
469
|
+
"equal": true
|
|
470
|
+
}
|
|
471
|
+
},
|
|
472
|
+
{
|
|
473
|
+
"name": "inline op that (in) false",
|
|
474
|
+
"given": {
|
|
475
|
+
"input": null,
|
|
476
|
+
"definition": "$$is(in,$):C"
|
|
477
|
+
},
|
|
478
|
+
"expect": {
|
|
479
|
+
"equal": false
|
|
480
|
+
}
|
|
481
|
+
},
|
|
482
|
+
{
|
|
483
|
+
"name": "inline op that (Nin) false",
|
|
484
|
+
"given": {
|
|
485
|
+
"input": null,
|
|
486
|
+
"definition": "$$is(Nin,$):C"
|
|
487
|
+
},
|
|
488
|
+
"expect": {
|
|
489
|
+
"equal": false
|
|
490
|
+
}
|
|
491
|
+
},
|
|
492
|
+
{
|
|
493
|
+
"name": "inline compare to null (!=) false",
|
|
494
|
+
"given": {
|
|
495
|
+
"input": null,
|
|
496
|
+
"definition": "$$is(!=,#null):$"
|
|
497
|
+
},
|
|
498
|
+
"expect": {
|
|
499
|
+
"equal": false
|
|
500
|
+
}
|
|
501
|
+
},
|
|
502
|
+
{
|
|
503
|
+
"name": "inline compare to null (=) true",
|
|
504
|
+
"given": {
|
|
505
|
+
"input": null,
|
|
506
|
+
"definition": "$$is(=,#null):$"
|
|
507
|
+
},
|
|
508
|
+
"expect": {
|
|
509
|
+
"equal": true
|
|
510
|
+
}
|
|
511
|
+
}
|
|
512
|
+
]
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"name": "Null test",
|
|
4
|
+
"given": {
|
|
5
|
+
"input": null,
|
|
6
|
+
"definition": "$$isnull:$"
|
|
7
|
+
},
|
|
8
|
+
"expect": {
|
|
9
|
+
"equal": true
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
"name": "Undefined test",
|
|
14
|
+
"given": {
|
|
15
|
+
"definition": "$$isnull:$"
|
|
16
|
+
},
|
|
17
|
+
"expect": {
|
|
18
|
+
"equal": true
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
"name": "Zero test",
|
|
23
|
+
"given": {
|
|
24
|
+
"input": 0,
|
|
25
|
+
"definition": "$$isnull():$"
|
|
26
|
+
},
|
|
27
|
+
"expect": {
|
|
28
|
+
"equal": false
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"name": "Empty string test",
|
|
33
|
+
"given": {
|
|
34
|
+
"input": "",
|
|
35
|
+
"definition": "$$isnull:$"
|
|
36
|
+
},
|
|
37
|
+
"expect": {
|
|
38
|
+
"equal": false
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"name": "False test",
|
|
43
|
+
"given": {
|
|
44
|
+
"input": false,
|
|
45
|
+
"definition": "$$isnull:$"
|
|
46
|
+
},
|
|
47
|
+
"expect": {
|
|
48
|
+
"equal": false
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
]
|