@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.
Files changed (160) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +81 -0
  3. package/dist/ParseContext.d.ts +23 -0
  4. package/dist/ParseContext.d.ts.map +1 -0
  5. package/dist/ParseContext.js +69 -0
  6. package/dist/ParseContext.js.map +1 -0
  7. package/dist/__tests__/functions/functionsParser.test.d.ts +2 -0
  8. package/dist/__tests__/functions/functionsParser.test.d.ts.map +1 -0
  9. package/dist/__tests__/functions/functionsParser.test.js +787 -0
  10. package/dist/__tests__/functions/functionsParser.test.js.map +1 -0
  11. package/dist/__tests__/jsonpath/jsonpathJoin.test.d.ts +2 -0
  12. package/dist/__tests__/jsonpath/jsonpathJoin.test.d.ts.map +1 -0
  13. package/dist/__tests__/jsonpath/jsonpathJoin.test.js +27 -0
  14. package/dist/__tests__/jsonpath/jsonpathJoin.test.js.map +1 -0
  15. package/dist/__tests__/parse.test.d.ts +2 -0
  16. package/dist/__tests__/parse.test.d.ts.map +1 -0
  17. package/dist/__tests__/parse.test.js +22 -0
  18. package/dist/__tests__/parse.test.js.map +1 -0
  19. package/dist/__tests__/utils/convert.test.d.ts +2 -0
  20. package/dist/__tests__/utils/convert.test.d.ts.map +1 -0
  21. package/dist/__tests__/utils/convert.test.js +181 -0
  22. package/dist/__tests__/utils/convert.test.js.map +1 -0
  23. package/dist/functions/ContextVariablesSchemas.d.ts +3 -0
  24. package/dist/functions/ContextVariablesSchemas.d.ts.map +1 -0
  25. package/dist/functions/ContextVariablesSchemas.js +9 -0
  26. package/dist/functions/ContextVariablesSchemas.js.map +1 -0
  27. package/dist/functions/definitions.d.ts +4 -0
  28. package/dist/functions/definitions.d.ts.map +1 -0
  29. package/dist/functions/definitions.js +2090 -0
  30. package/dist/functions/definitions.js.map +1 -0
  31. package/dist/functions/examples/and.json +44 -0
  32. package/dist/functions/examples/at.json +156 -0
  33. package/dist/functions/examples/avg.json +78 -0
  34. package/dist/functions/examples/base64.json +368 -0
  35. package/dist/functions/examples/boolean.json +236 -0
  36. package/dist/functions/examples/coalesce.json +58 -0
  37. package/dist/functions/examples/concat.json +70 -0
  38. package/dist/functions/examples/contains.json +61 -0
  39. package/dist/functions/examples/csv.json +116 -0
  40. package/dist/functions/examples/csvparse.json +97 -0
  41. package/dist/functions/examples/date.json +389 -0
  42. package/dist/functions/examples/decimal.json +102 -0
  43. package/dist/functions/examples/digest.json +125 -0
  44. package/dist/functions/examples/distinct.json +142 -0
  45. package/dist/functions/examples/entries.json +88 -0
  46. package/dist/functions/examples/eval.json +72 -0
  47. package/dist/functions/examples/every.json +96 -0
  48. package/dist/functions/examples/filter.json +51 -0
  49. package/dist/functions/examples/find.json +51 -0
  50. package/dist/functions/examples/findindex.json +61 -0
  51. package/dist/functions/examples/flat.json +74 -0
  52. package/dist/functions/examples/flatten.json +76 -0
  53. package/dist/functions/examples/form.json +60 -0
  54. package/dist/functions/examples/formparse.json +62 -0
  55. package/dist/functions/examples/group.json +208 -0
  56. package/dist/functions/examples/if.json +294 -0
  57. package/dist/functions/examples/indexof.json +48 -0
  58. package/dist/functions/examples/is.json +512 -0
  59. package/dist/functions/examples/isnull.json +51 -0
  60. package/dist/functions/examples/join.json +221 -0
  61. package/dist/functions/examples/jsonparse.json +101 -0
  62. package/dist/functions/examples/jsonpatch.json +30 -0
  63. package/dist/functions/examples/jsonpath.json +62 -0
  64. package/dist/functions/examples/jsonpointer.json +77 -0
  65. package/dist/functions/examples/jwtparse.json +54 -0
  66. package/dist/functions/examples/length.json +202 -0
  67. package/dist/functions/examples/long.json +53 -0
  68. package/dist/functions/examples/lookup.json +223 -0
  69. package/dist/functions/examples/lower.json +24 -0
  70. package/dist/functions/examples/map.json +188 -0
  71. package/dist/functions/examples/match.json +62 -0
  72. package/dist/functions/examples/matchall.json +62 -0
  73. package/dist/functions/examples/math.json +1073 -0
  74. package/dist/functions/examples/max.json +104 -0
  75. package/dist/functions/examples/merge.json +173 -0
  76. package/dist/functions/examples/min.json +104 -0
  77. package/dist/functions/examples/normalize.json +142 -0
  78. package/dist/functions/examples/not.json +99 -0
  79. package/dist/functions/examples/numberformat.json +162 -0
  80. package/dist/functions/examples/numberparse.json +72 -0
  81. package/dist/functions/examples/object.json +148 -0
  82. package/dist/functions/examples/or.json +102 -0
  83. package/dist/functions/examples/pad.json +102 -0
  84. package/dist/functions/examples/partition.json +32 -0
  85. package/dist/functions/examples/range.json +188 -0
  86. package/dist/functions/examples/raw.json +58 -0
  87. package/dist/functions/examples/reduce.json +79 -0
  88. package/dist/functions/examples/repeat.json +59 -0
  89. package/dist/functions/examples/replace.json +92 -0
  90. package/dist/functions/examples/reverse.json +94 -0
  91. package/dist/functions/examples/slice.json +360 -0
  92. package/dist/functions/examples/some.json +96 -0
  93. package/dist/functions/examples/sort.json +353 -0
  94. package/dist/functions/examples/split.json +52 -0
  95. package/dist/functions/examples/string.json +95 -0
  96. package/dist/functions/examples/substring.json +82 -0
  97. package/dist/functions/examples/sum.json +108 -0
  98. package/dist/functions/examples/switch.json +78 -0
  99. package/dist/functions/examples/template.json +125 -0
  100. package/dist/functions/examples/test.json +82 -0
  101. package/dist/functions/examples/transform.json +58 -0
  102. package/dist/functions/examples/trim.json +44 -0
  103. package/dist/functions/examples/unflatten.json +97 -0
  104. package/dist/functions/examples/upper.json +24 -0
  105. package/dist/functions/examples/uriparse.json +52 -0
  106. package/dist/functions/examples/urldecode.json +42 -0
  107. package/dist/functions/examples/urlencode.json +43 -0
  108. package/dist/functions/examples/uuid.json +142 -0
  109. package/dist/functions/examples/value.json +87 -0
  110. package/dist/functions/examples/wrap.json +122 -0
  111. package/dist/functions/examples/xml.json +142 -0
  112. package/dist/functions/examples/xmlparse.json +161 -0
  113. package/dist/functions/examples/xor.json +166 -0
  114. package/dist/functions/examples/yaml.json +196 -0
  115. package/dist/functions/examples/yamlparse.json +150 -0
  116. package/dist/functions/examples.d.ts +4 -0
  117. package/dist/functions/examples.d.ts.map +1 -0
  118. package/dist/functions/examples.js +178 -0
  119. package/dist/functions/examples.js.map +1 -0
  120. package/dist/functions/functions.d.ts +3 -0
  121. package/dist/functions/functions.d.ts.map +1 -0
  122. package/dist/functions/functions.js +9 -0
  123. package/dist/functions/functions.js.map +1 -0
  124. package/dist/functions/functionsParser.d.ts +45 -0
  125. package/dist/functions/functionsParser.d.ts.map +1 -0
  126. package/dist/functions/functionsParser.js +207 -0
  127. package/dist/functions/functionsParser.js.map +1 -0
  128. package/dist/functions/parseDefinitions.d.ts +4 -0
  129. package/dist/functions/parseDefinitions.d.ts.map +1 -0
  130. package/dist/functions/parseDefinitions.js +56 -0
  131. package/dist/functions/parseDefinitions.js.map +1 -0
  132. package/dist/functions/types.d.ts +163 -0
  133. package/dist/functions/types.d.ts.map +1 -0
  134. package/dist/functions/types.js +93 -0
  135. package/dist/functions/types.js.map +1 -0
  136. package/dist/index.d.ts +14 -0
  137. package/dist/index.d.ts.map +1 -0
  138. package/dist/index.js +36 -0
  139. package/dist/index.js.map +1 -0
  140. package/dist/jsonpath/jsonpathFunctions.d.ts +4 -0
  141. package/dist/jsonpath/jsonpathFunctions.d.ts.map +1 -0
  142. package/dist/jsonpath/jsonpathFunctions.js +26 -0
  143. package/dist/jsonpath/jsonpathFunctions.js.map +1 -0
  144. package/dist/jsonpath/jsonpathJoin.d.ts +3 -0
  145. package/dist/jsonpath/jsonpathJoin.d.ts.map +1 -0
  146. package/dist/jsonpath/jsonpathJoin.js +15 -0
  147. package/dist/jsonpath/jsonpathJoin.js.map +1 -0
  148. package/dist/parse.d.ts +12 -0
  149. package/dist/parse.d.ts.map +1 -0
  150. package/dist/parse.js +522 -0
  151. package/dist/parse.js.map +1 -0
  152. package/dist/transformUtils.d.ts +40 -0
  153. package/dist/transformUtils.d.ts.map +1 -0
  154. package/dist/transformUtils.js +89 -0
  155. package/dist/transformUtils.js.map +1 -0
  156. package/dist/utils/convert.d.ts +3 -0
  157. package/dist/utils/convert.d.ts.map +1 -0
  158. package/dist/utils/convert.js +163 -0
  159. package/dist/utils/convert.js.map +1 -0
  160. package/package.json +44 -0
@@ -0,0 +1,368 @@
1
+ [
2
+ {
3
+ "name": "inline encode (no arguments)",
4
+ "given": {
5
+ "input": "test{?}<>!",
6
+ "definition": "$$base64:$"
7
+ },
8
+ "expect": {
9
+ "equal": "dGVzdHs/fTw+IQ=="
10
+ }
11
+ },
12
+ {
13
+ "name": "inline encode (e for ENCODE)",
14
+ "given": {
15
+ "input": "test{?}<>!",
16
+ "definition": "$$base64(e):$"
17
+ },
18
+ "expect": {
19
+ "equal": "dGVzdHs/fTw+IQ=="
20
+ }
21
+ },
22
+ {
23
+ "name": "inline encode (e,BASIC,false,UTF-16)",
24
+ "given": {
25
+ "input": "test{?}<>!",
26
+ "definition": "$$base64(e,BASIC,false,UTF-16):$"
27
+ },
28
+ "expect": {
29
+ "equal": "/v8AdABlAHMAdAB7AD8AfQA8AD4AIQ=="
30
+ }
31
+ },
32
+ {
33
+ "name": "inline encode (e,BASIC,true)",
34
+ "given": {
35
+ "input": "test{?}<>!",
36
+ "definition": "$$base64(e,BASIC,true):$"
37
+ },
38
+ "expect": {
39
+ "equal": "dGVzdHs/fTw+IQ"
40
+ }
41
+ },
42
+ {
43
+ "name": "inline encode (e,URL)",
44
+ "given": {
45
+ "input": "test{?}<>!",
46
+ "definition": "$$base64(e,URL):$"
47
+ },
48
+ "expect": {
49
+ "equal": "dGVzdHs_fTw-IQ=="
50
+ }
51
+ },
52
+ {
53
+ "name": "inline encode (e,URL,true)",
54
+ "given": {
55
+ "input": "test{?}<>!",
56
+ "definition": "$$base64(e,URL,true):$"
57
+ },
58
+ "expect": {
59
+ "equal": "dGVzdHs_fTw-IQ"
60
+ }
61
+ },
62
+ {
63
+ "name": "inline encode (e,MIME)",
64
+ "given": {
65
+ "input": "abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ",
66
+ "definition": "$$base64(e,MIME):$"
67
+ },
68
+ "expect": {
69
+ "equal": "YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXowMTIzNDU2Nzg5QUJDREVGR0hJSktMTU5PUFFSU1RV\r\nVldYWVo="
70
+ }
71
+ },
72
+ {
73
+ "name": "inline encode (e,MIME,true)",
74
+ "given": {
75
+ "input": "abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ",
76
+ "definition": "$$base64(e,MIME,true):$"
77
+ },
78
+ "expect": {
79
+ "equal": "YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXowMTIzNDU2Nzg5QUJDREVGR0hJSktMTU5PUFFSU1RV\r\nVldYWVo"
80
+ }
81
+ },
82
+ {
83
+ "name": "object encode (no arguments)",
84
+ "given": {
85
+ "input": "test{?}<>!",
86
+ "definition": {
87
+ "$$base64": "$"
88
+ }
89
+ },
90
+ "expect": {
91
+ "equal": "dGVzdHs/fTw+IQ=="
92
+ }
93
+ },
94
+ {
95
+ "name": "object encode (action=ENCODE)",
96
+ "given": {
97
+ "input": "test{?}<>!",
98
+ "definition": {
99
+ "$$base64": "$",
100
+ "action": "ENCODE"
101
+ }
102
+ },
103
+ "expect": {
104
+ "equal": "dGVzdHs/fTw+IQ=="
105
+ }
106
+ },
107
+ {
108
+ "name": "object encode (action=ENCODE,rfc=BASIC)",
109
+ "given": {
110
+ "input": "test{?}<>!",
111
+ "definition": {
112
+ "$$base64": "$",
113
+ "action": "ENCODE",
114
+ "rfc": "BASIC"
115
+ }
116
+ },
117
+ "expect": {
118
+ "equal": "dGVzdHs/fTw+IQ=="
119
+ }
120
+ },
121
+ {
122
+ "name": "object encode (charset=UTF-16)",
123
+ "given": {
124
+ "input": "test{?}<>!",
125
+ "definition": {
126
+ "$$base64": "$",
127
+ "charset": "UTF-16"
128
+ }
129
+ },
130
+ "expect": {
131
+ "equal": "/v8AdABlAHMAdAB7AD8AfQA8AD4AIQ=="
132
+ }
133
+ },
134
+ {
135
+ "name": "object encode (without_padding=true)",
136
+ "given": {
137
+ "input": "test{?}<>!",
138
+ "definition": {
139
+ "$$base64": "$",
140
+ "without_padding": true
141
+ }
142
+ },
143
+ "expect": {
144
+ "equal": "dGVzdHs/fTw+IQ"
145
+ }
146
+ },
147
+ {
148
+ "name": "object encode (rfc=URL)",
149
+ "given": {
150
+ "input": "test{?}<>!",
151
+ "definition": {
152
+ "$$base64": "$",
153
+ "rfc": "URL"
154
+ }
155
+ },
156
+ "expect": {
157
+ "equal": "dGVzdHs_fTw-IQ=="
158
+ }
159
+ },
160
+ {
161
+ "name": "object encode (rfc=URL,without_padding=true)",
162
+ "given": {
163
+ "input": "test{?}<>!",
164
+ "definition": {
165
+ "$$base64": "$",
166
+ "rfc": "URL",
167
+ "without_padding": true
168
+ }
169
+ },
170
+ "expect": {
171
+ "equal": "dGVzdHs_fTw-IQ"
172
+ }
173
+ },
174
+ {
175
+ "name": "object encode (rfc=MIME)",
176
+ "given": {
177
+ "input": "abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ",
178
+ "definition": {
179
+ "$$base64": "$",
180
+ "rfc": "MIME"
181
+ }
182
+ },
183
+ "expect": {
184
+ "equal": "YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXowMTIzNDU2Nzg5QUJDREVGR0hJSktMTU5PUFFSU1RV\r\nVldYWVo="
185
+ }
186
+ },
187
+ {
188
+ "name": "object encode (rfc=MIME,without_padding=true)",
189
+ "given": {
190
+ "input": "abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ",
191
+ "definition": {
192
+ "$$base64": "$",
193
+ "rfc": "MIME",
194
+ "without_padding": true
195
+ }
196
+ },
197
+ "expect": {
198
+ "equal": "YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXowMTIzNDU2Nzg5QUJDREVGR0hJSktMTU5PUFFSU1RV\r\nVldYWVo"
199
+ }
200
+ },
201
+ {
202
+ "name": "inline decode (DECODE)",
203
+ "given": {
204
+ "input": "dGVzdHs/fTw+IQ==",
205
+ "definition": "$$base64(DECODE):$"
206
+ },
207
+ "expect": {
208
+ "equal": "test{?}<>!"
209
+ }
210
+ },
211
+ {
212
+ "name": "inline decode (d,URL)",
213
+ "given": {
214
+ "input": "dGVzdHs_fTw-IQ==",
215
+ "definition": "$$base64(d,URL):$"
216
+ },
217
+ "expect": {
218
+ "equal": "test{?}<>!"
219
+ }
220
+ },
221
+ {
222
+ "name": "inline decode (d,URL) without padding",
223
+ "given": {
224
+ "input": "dGVzdHs_fTw-IQ",
225
+ "definition": "$$base64(d,URL):$"
226
+ },
227
+ "expect": {
228
+ "equal": "test{?}<>!"
229
+ }
230
+ },
231
+ {
232
+ "name": "inline decode (d,MIME)",
233
+ "given": {
234
+ "input": "YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXowMTIzNDU2Nzg5QUJDREVGR0hJSktMTU5PUFFSU1RV\r\nVldYWVo=",
235
+ "definition": "$$base64(d,MIME):$"
236
+ },
237
+ "expect": {
238
+ "equal": "abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"
239
+ }
240
+ },
241
+ {
242
+ "name": "inline decode (d,MIME) without padding",
243
+ "given": {
244
+ "input": "YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXowMTIzNDU2Nzg5QUJDREVGR0hJSktMTU5PUFFSU1RV\r\nVldYWVo",
245
+ "definition": "$$base64(d,MIME):$"
246
+ },
247
+ "expect": {
248
+ "equal": "abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"
249
+ }
250
+ },
251
+ {
252
+ "name": "inline decode (d,B,,UTF-8)",
253
+ "given": {
254
+ "input": "aGVsbG8tdW5pY29kZS3wn5iA8J+RqOKAjfCfkanigI3wn5Gn4oCN8J+RpvCfqqzim7PinaTwn6eA",
255
+ "definition": "$$base64(d,B,,UTF-8):$"
256
+ },
257
+ "expect": {
258
+ "equal": "hello-unicode-😀👨‍👩‍👧‍👦🪬⛳❤🧀"
259
+ }
260
+ },
261
+ {
262
+ "name": "inline decode (d,B,,UTF-16)",
263
+ "given": {
264
+ "input": "/v8AaABlAGwAbABvAC0AdQBuAGkAYwBvAGQAZQAt2D3eANg93GggDdg93GkgDdg93GcgDdg93GbYPt6sJvMnZNg+3cA=",
265
+ "definition": "$$base64(d,B,,UTF-16):$"
266
+ },
267
+ "expect": {
268
+ "equal": "hello-unicode-😀👨‍👩‍👧‍👦🪬⛳❤🧀"
269
+ }
270
+ },
271
+ {
272
+ "name": "object decode (action=DECODE)",
273
+ "given": {
274
+ "input": "dGVzdHs/fTw+IQ==",
275
+ "definition": {
276
+ "$$base64": "$",
277
+ "action": "DECODE"
278
+ }
279
+ },
280
+ "expect": {
281
+ "equal": "test{?}<>!"
282
+ }
283
+ },
284
+ {
285
+ "name": "object decode (action=DECODE,rfc=URL)",
286
+ "given": {
287
+ "input": "dGVzdHs_fTw-IQ==",
288
+ "definition": {
289
+ "$$base64": "$",
290
+ "action": "DECODE",
291
+ "rfc": "URL"
292
+ }
293
+ },
294
+ "expect": {
295
+ "equal": "test{?}<>!"
296
+ }
297
+ },
298
+ {
299
+ "name": "object decode (action=DECODE,rfc=URL) without padding",
300
+ "given": {
301
+ "input": "dGVzdHs_fTw-IQ",
302
+ "definition": {
303
+ "$$base64": "$",
304
+ "action": "DECODE",
305
+ "rfc": "URL"
306
+ }
307
+ },
308
+ "expect": {
309
+ "equal": "test{?}<>!"
310
+ }
311
+ },
312
+ {
313
+ "name": "object decode (action=DECODE,rfc=MIME)",
314
+ "given": {
315
+ "input": "YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXowMTIzNDU2Nzg5QUJDREVGR0hJSktMTU5PUFFSU1RV\nVldYWVo=",
316
+ "definition": {
317
+ "$$base64": "$",
318
+ "action": "DECODE",
319
+ "rfc": "MIME"
320
+ }
321
+ },
322
+ "expect": {
323
+ "equal": "abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"
324
+ }
325
+ },
326
+ {
327
+ "name": "object decode (action=DECODE,rfc=MIME)",
328
+ "given": {
329
+ "input": "YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXowMTIzNDU2Nzg5QUJDREVGR0hJSktMTU5PUFFSU1RV\nVldYWVo",
330
+ "definition": {
331
+ "$$base64": "$",
332
+ "action": "DECODE",
333
+ "rfc": "MIME"
334
+ }
335
+ },
336
+ "expect": {
337
+ "equal": "abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"
338
+ }
339
+ },
340
+ {
341
+ "name": "object decode (action=DECODE,charset=UTF-8)",
342
+ "given": {
343
+ "input": "aGVsbG8tdW5pY29kZS3wn5iA8J+RqOKAjfCfkanigI3wn5Gn4oCN8J+RpvCfqqzim7PinaTwn6eA",
344
+ "definition": {
345
+ "$$base64": "$",
346
+ "action": "DECODE",
347
+ "charset": "UTF-8"
348
+ }
349
+ },
350
+ "expect": {
351
+ "equal": "hello-unicode-😀👨‍👩‍👧‍👦🪬⛳❤🧀"
352
+ }
353
+ },
354
+ {
355
+ "name": "object decode (action=DECODE,charset=UTF-16)",
356
+ "given": {
357
+ "input": "/v8AaABlAGwAbABvAC0AdQBuAGkAYwBvAGQAZQAt2D3eANg93GggDdg93GkgDdg93GcgDdg93GbYPt6sJvMnZNg+3cA=",
358
+ "definition": {
359
+ "$$base64": "$",
360
+ "action": "DECODE",
361
+ "charset": "UTF-16"
362
+ }
363
+ },
364
+ "expect": {
365
+ "equal": "hello-unicode-😀👨‍👩‍👧‍👦🪬⛳❤🧀"
366
+ }
367
+ }
368
+ ]
@@ -0,0 +1,236 @@
1
+ [
2
+ {
3
+ "name": "true - true (no args)",
4
+ "given": {
5
+ "input": true,
6
+ "definition": "$$boolean:$"
7
+ },
8
+ "expect": {
9
+ "equal": true
10
+ }
11
+ },
12
+ {
13
+ "name": "true - \"0\" (js)",
14
+ "given": {
15
+ "input": "0",
16
+ "definition": "$$boolean(js):$"
17
+ },
18
+ "expect": {
19
+ "equal": true
20
+ }
21
+ },
22
+ {
23
+ "name": "true - \"false\" (js)",
24
+ "given": {
25
+ "input": "false",
26
+ "definition": "$$boolean(js):$"
27
+ },
28
+ "expect": {
29
+ "equal": true
30
+ }
31
+ },
32
+ {
33
+ "name": "true - \"true\" (no args)",
34
+ "given": {
35
+ "input": "true",
36
+ "definition": "$$boolean:$"
37
+ },
38
+ "expect": {
39
+ "equal": true
40
+ }
41
+ },
42
+ {
43
+ "name": "true - \"True\" (no args)",
44
+ "given": {
45
+ "input": "True",
46
+ "definition": "$$boolean:$"
47
+ },
48
+ "expect": {
49
+ "equal": true
50
+ }
51
+ },
52
+ {
53
+ "name": "true - \"true\" (JS)",
54
+ "given": {
55
+ "input": "true",
56
+ "definition": "$$boolean(JS):$"
57
+ },
58
+ "expect": {
59
+ "equal": true
60
+ }
61
+ },
62
+ {
63
+ "name": "true - 1 (no args)",
64
+ "given": {
65
+ "input": 1,
66
+ "definition": "$$boolean:$"
67
+ },
68
+ "expect": {
69
+ "equal": true
70
+ }
71
+ },
72
+ {
73
+ "name": "true - -1 (no args)",
74
+ "given": {
75
+ "input": -1,
76
+ "definition": "$$boolean:$"
77
+ },
78
+ "expect": {
79
+ "equal": true
80
+ }
81
+ },
82
+ {
83
+ "name": "true - {\"\":0} (no args)",
84
+ "given": {
85
+ "input": {
86
+ "": 0
87
+ },
88
+ "definition": "$$boolean:$"
89
+ },
90
+ "expect": {
91
+ "equal": true
92
+ }
93
+ },
94
+ {
95
+ "name": "true - [0] (no args)",
96
+ "given": {
97
+ "input": [
98
+ 0
99
+ ],
100
+ "definition": "$$boolean:$"
101
+ },
102
+ "expect": {
103
+ "equal": true
104
+ }
105
+ },
106
+ {
107
+ "name": "false - false (no args)",
108
+ "given": {
109
+ "input": false,
110
+ "definition": "$$boolean:$"
111
+ },
112
+ "expect": {
113
+ "equal": false
114
+ }
115
+ },
116
+ {
117
+ "name": "false - \"\" (no args)",
118
+ "given": {
119
+ "input": "",
120
+ "definition": "$$boolean:$"
121
+ },
122
+ "expect": {
123
+ "equal": false
124
+ }
125
+ },
126
+ {
127
+ "name": "false - \"\" (js)",
128
+ "given": {
129
+ "input": "",
130
+ "definition": "$$boolean(js):$"
131
+ },
132
+ "expect": {
133
+ "equal": false
134
+ }
135
+ },
136
+ {
137
+ "name": "false - \"0\" (no args)",
138
+ "given": {
139
+ "input": "0",
140
+ "definition": "$$boolean:$"
141
+ },
142
+ "expect": {
143
+ "equal": false
144
+ }
145
+ },
146
+ {
147
+ "name": "false - \"false\" (no args)",
148
+ "given": {
149
+ "input": "false",
150
+ "definition": "$$boolean:$"
151
+ },
152
+ "expect": {
153
+ "equal": false
154
+ }
155
+ },
156
+ {
157
+ "name": "false - False (no args)",
158
+ "given": {
159
+ "input": "False",
160
+ "definition": "$$boolean:$"
161
+ },
162
+ "expect": {
163
+ "equal": false
164
+ }
165
+ },
166
+ {
167
+ "name": "false - 0 (no args)",
168
+ "given": {
169
+ "input": 0,
170
+ "definition": "$$boolean:$"
171
+ },
172
+ "expect": {
173
+ "equal": false
174
+ }
175
+ },
176
+ {
177
+ "name": "false - null (no args)",
178
+ "given": {
179
+ "input": null,
180
+ "definition": "$$boolean:$"
181
+ },
182
+ "expect": {
183
+ "equal": false
184
+ }
185
+ },
186
+ {
187
+ "name": "false - {} (no args)",
188
+ "given": {
189
+ "input": {},
190
+ "definition": "$$boolean:$"
191
+ },
192
+ "expect": {
193
+ "equal": false
194
+ }
195
+ },
196
+ {
197
+ "name": "false - [] (no args)",
198
+ "given": {
199
+ "input": [],
200
+ "definition": "$$boolean:$"
201
+ },
202
+ "expect": {
203
+ "equal": false
204
+ }
205
+ },
206
+ {
207
+ "name": "object true - \"true\" (style=JS)",
208
+ "given": {
209
+ "input": "true",
210
+ "definition": { "$$boolean": "$", "style": "JS" }
211
+ },
212
+ "expect": {
213
+ "equal": true
214
+ }
215
+ },
216
+ {
217
+ "name": "object true - \"false\" (style=js)",
218
+ "given": {
219
+ "input": "false",
220
+ "definition": { "$$boolean": "$", "style": "js" }
221
+ },
222
+ "expect": {
223
+ "equal": true
224
+ }
225
+ },
226
+ {
227
+ "name": "object false - \"false\" (no args)",
228
+ "given": {
229
+ "input": "false",
230
+ "definition": { "$$boolean": "$" }
231
+ },
232
+ "expect": {
233
+ "equal": false
234
+ }
235
+ }
236
+ ]
@@ -0,0 +1,58 @@
1
+ [
2
+ {
3
+ "name": "object - [null, null, 2] passed by variable -> 2",
4
+ "given": {
5
+ "input": [
6
+ null,
7
+ null,
8
+ 2
9
+ ],
10
+ "definition": {
11
+ "$$coalesce": "$"
12
+ }
13
+ },
14
+ "expect": {
15
+ "equal": 2
16
+ }
17
+ },
18
+ {
19
+ "name": "object - [$[0]->null, \"b\", \"c\"] -> \"b\"",
20
+ "given": {
21
+ "input": [
22
+ null,
23
+ null,
24
+ 2
25
+ ],
26
+ "definition": {
27
+ "$$coalesce": [
28
+ "$[0]",
29
+ "b",
30
+ "c"
31
+ ]
32
+ }
33
+ },
34
+ "expect": {
35
+ "equal": "b"
36
+ }
37
+ },
38
+ {
39
+ "name": "alias - \"$$first\"",
40
+ "given": {
41
+ "input": [
42
+ null,
43
+ null,
44
+ 2
45
+ ],
46
+ "definition": {
47
+ "$$first": [
48
+ null,
49
+ null,
50
+ "c"
51
+ ]
52
+ }
53
+ },
54
+ "expect": {
55
+ "equal": "c"
56
+ }
57
+ }
58
+ ]