@xano/developer-mcp 2.2.4 → 2.2.6-beta.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/dist/meta_api_docs/topics/realtime.js +4 -2
- package/dist/tools/index.d.ts +1 -0
- package/dist/tools/xanoscript_docs.d.ts +1 -0
- package/dist/tools/xanoscript_docs.js +8 -0
- package/dist/xanoscript.d.ts +10 -0
- package/dist/xanoscript.js +73 -1
- package/dist/xanoscript_docs/README.md +4 -2
- package/dist/xanoscript_docs/apis.md +2 -0
- package/dist/xanoscript_docs/docs_index.json +53 -7
- package/dist/xanoscript_docs/expressions/filters.md +2166 -0
- package/dist/xanoscript_docs/expressions.md +189 -0
- package/dist/xanoscript_docs/mcp-servers.md +76 -0
- package/dist/xanoscript_docs/middleware.md +77 -240
- package/dist/xanoscript_docs/realtime-v2.md +395 -0
- package/dist/xanoscript_docs/realtime.md +5 -1
- package/dist/xanoscript_docs/syntax/array-filters.md +4 -2
- package/dist/xanoscript_docs/syntax.md +7 -2
- package/dist/xanoscript_docs/version.json +2 -2
- package/package.json +2 -2
|
@@ -0,0 +1,2166 @@
|
|
|
1
|
+
---
|
|
2
|
+
applyTo: ""
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Expression Filter Reference
|
|
6
|
+
|
|
7
|
+
> **TL;DR:** Signatures, argument lists, and worked examples for all 210 Xano expression filters (transformers), grouped by category. Apply with `value|filter:arg1:arg2`. Where a filter has two names, the **display name** heads the entry and the canonical engine alias follows in parentheses — both are accepted. Do not invent filter names: if a filter is not in this reference, it does not exist.
|
|
8
|
+
|
|
9
|
+
Format of each entry: `display_name` (canonical alias) : input type → result type — description, arguments (with type and default), then `example` → `answer`.
|
|
10
|
+
|
|
11
|
+
Need only a few entries? Call `xano_xanoscript_docs({ filter: "round" })` (comma-separate for several, e.g. `filter: "to_upper,split"`) to fetch just those filters instead of this whole document.
|
|
12
|
+
|
|
13
|
+
## Quick Reference
|
|
14
|
+
|
|
15
|
+
- **math:** `deg2rad`, `rad2deg`, `number_format`, `sin`, `asin`, `asinh`, `cos`, `acos`, `acosh`, `tan`, `atan`, `atanh`, `floor`, `ceil`, `round`, `abs`, `sqrt`, `exp`, `log`, `log10`, `ln`, `pow`, `array_min` (`min`), `array_max` (`max`), `min` (`num_min`), `max` (`num_max`), `sum`, `avg`, `product`, `add`, `subtract` (`sub`), `multiply` (`mul`), `modulus` (`mod`), `divide` (`div`), `bitwise_and`, `bitwise_or`, `bitwise_xor`
|
|
16
|
+
- **array:** `first`, `last`, `count`, `range`, `reverse`, `unique`, `safe_array`, `flatten`, `filter_empty`, `sort` (`fsort`), `shuffle` (`array_shuffle`), `diff` (`array_diff`), `diff_assoc` (`array_diff_assoc`), `intersect` (`array_intersect`), `intersect_assoc` (`array_intersect_assoc`), `merge` (`array_merge`), `merge_recursive` (`array_merge_recursive`), `index_by`, `push` (`array_push`), `pop` (`array_pop`), `unshift` (`array_unshift`), `shift` (`array_shift`), `remove` (`array_remove`), `append`, `prepend`, `join`, `slice` (`array_slice`), `keys` (`array_keys`), `values` (`array_values`), `entries` (`array_entries`), `map`, `filter`, `some`, `every`, `find`, `findIndex`, `reduce`, `pick`, `unpick`
|
|
17
|
+
- **comparison:** `equals` (`eq`), `not_equals` (`ne`), `greater_than` (`gt`), `greater_than_or_equal` (`gte`), `less_than` (`lt`), `less_than_or_equal` (`lte`), `odd`, `even`, `in`, `not`, `bitwise_not`, `is_null` (`null`), `is_empty` (`empty`), `is_object`, `is_array`, `is_int`, `is_decimal`, `is_bool`, `is_text`
|
|
18
|
+
- **text:** `addslashes`, `escape`, `list_encodings`, `detect_encoding`, `to_utf8`, `from_utf8`, `convert_encoding`, `to_lower` (`lower`), `to_upper` (`upper`), `trim`, `ltrim`, `rtrim`, `capitalize`, `substr`, `split`, `strlen`, `strip_html` (`strip_tags`), `unaccent` (`strip_accents`), `index` (`strpos`), `iindex` (`stripos`), `starts_with`, `istarts_with`, `ends_with`, `iends_with`, `contains`, `icontains`, `url_addarg`, `url_delarg`, `url_hasarg`, `url_getarg`, `url_parse`, `querystring_parse`, `concat`, `sprintf`, `replace` (`string_replace`), `regex_matches` (`regex_test`), `regex_get_first_match` (`regex_match`), `regex_get_all_matches` (`regex_match_all`), `regex_quote`, `regex_replace`
|
|
19
|
+
- **manipulation:** `set`, `set_conditional`, `set_ifnotempty`, `set_ifnotnull`, `first_notnull`, `first_notempty`, `unset`, `transform`, `get`, `has`, `fill` (`array_fill`), `fill_keys` (`array_fill_keys`)
|
|
20
|
+
- **transform:** `to_expr`, `to_text`, `to_int`, `to_decimal`, `to_bool`, `to_timestamp` (`to_epochms`), `to_ms` (`to_epoch_ms`), `to_seconds` (`to_epoch_sec`), `to_minutes` (`to_epoch_minute`), `to_hours` (`to_epoch_hour`), `to_days` (`to_epoch_day`), `create_object`, `create_object_from_entries`, `json_decode`, `json_encode`, `xml_decode`, `csv_parse`, `csv_decode`, `csv_encode`, `csv_create`, `url_decode`, `url_decode_rfc3986`, `url_encode`, `url_encode_rfc3986`, `yaml_decode`, `yaml_encode`, `hex2bin`, `bin2hex`, `dechex`, `hexdec`, `decbin`, `bindec`, `decoct`, `octdec`, `base_convert`, `base64_decode`, `base64_encode`, `base64_decode_urlsafe`, `base64_encode_urlsafe`
|
|
21
|
+
- **security:** `encrypt`, `decrypt`, `jws_encode` (`crypto_jws_encode`), `jws_decode` (`crypto_jws_decode`), `jwe_encode` (`crypto_jwe_encode`), `jwe_decode` (`crypto_jwe_decode`), `secureid_encode`, `secureid_decode`, `md5`, `sha1`, `sha256`, `sha384`, `sha512`, `hmac_md5`, `hmac_sha1`, `hmac_sha256`, `hmac_sha384`, `hmac_sha512`, `uuid` (`uuid4`)
|
|
22
|
+
- **timestamp:** `parse_timestamp` (`epochms_from_format`), `format_timestamp` (`epochms_date`), `transform_timestamp` (`epochms_transform`), `add_secs_to_timestamp` (`epochms_add_secs`), `add_ms_to_timestamp` (`epochms_add_ms`)
|
|
23
|
+
|
|
24
|
+
## Math Filters
|
|
25
|
+
|
|
26
|
+
### `deg2rad`
|
|
27
|
+
|
|
28
|
+
`decimal → decimal` — Convert degrees to radians
|
|
29
|
+
|
|
30
|
+
```
|
|
31
|
+
180|deg2rad // 3.141592...
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### `rad2deg`
|
|
35
|
+
|
|
36
|
+
`decimal → decimal` — Convert radians to degrees
|
|
37
|
+
|
|
38
|
+
```
|
|
39
|
+
3.141592|rad2deg // 180
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### `number_format`
|
|
43
|
+
|
|
44
|
+
`any → string` — Format a number with flexible support over decimal places, thousands separator, and decimal separator.
|
|
45
|
+
|
|
46
|
+
Args:
|
|
47
|
+
- `decimals` (int, default `0`) — The number of decimal digits
|
|
48
|
+
- `decimal_separator` (text, default `"."`) — The separator value used for the decimal point
|
|
49
|
+
- `thousands_separator` (text, default `","`) — The separator value used for grouping each set of thousands.
|
|
50
|
+
|
|
51
|
+
```
|
|
52
|
+
31253212.141592|number_format:2:.:, // "31,253,212.14"
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### `sin`
|
|
56
|
+
|
|
57
|
+
`decimal → decimal` — Calculates the sine of the supplied value in radians
|
|
58
|
+
|
|
59
|
+
```
|
|
60
|
+
3.14159|sin // 0
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### `asin`
|
|
64
|
+
|
|
65
|
+
`decimal → decimal` — Calculates the arc sine of the supplied value in radians
|
|
66
|
+
|
|
67
|
+
```
|
|
68
|
+
1|asin // 1.57079...
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### `asinh`
|
|
72
|
+
|
|
73
|
+
`decimal → decimal` — Calculates the inverse hyperbolic sine of the supplied value in radians
|
|
74
|
+
|
|
75
|
+
```
|
|
76
|
+
1|asinh // 0.88137...
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### `cos`
|
|
80
|
+
|
|
81
|
+
`decimal → decimal` — Calculates the cosine of the supplied value in radians
|
|
82
|
+
|
|
83
|
+
```
|
|
84
|
+
1|cos // 0.54030...
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### `acos`
|
|
88
|
+
|
|
89
|
+
`decimal → decimal` — Calculates the arc cosine of the supplied value in radians
|
|
90
|
+
|
|
91
|
+
```
|
|
92
|
+
1|acos // 0
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
### `acosh`
|
|
96
|
+
|
|
97
|
+
`decimal → decimal` — Calculates the inverse hyperbolic cosine of the supplied value in radians
|
|
98
|
+
|
|
99
|
+
```
|
|
100
|
+
11.592|acosh // 3.14159...
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
### `tan`
|
|
104
|
+
|
|
105
|
+
`decimal → decimal` — Calculates the tangent of the supplied value in radians
|
|
106
|
+
|
|
107
|
+
```
|
|
108
|
+
0.785398|tan // 1
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
### `atan`
|
|
112
|
+
|
|
113
|
+
`decimal → decimal` — Calculates the arc tangent of the supplied value in radians
|
|
114
|
+
|
|
115
|
+
```
|
|
116
|
+
1|atan // 0.78539...
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
### `atanh`
|
|
120
|
+
|
|
121
|
+
`decimal → decimal` — Calculates the inverse hyperbolic tangent of the supplied value in radians
|
|
122
|
+
|
|
123
|
+
```
|
|
124
|
+
0.6666|atanh // 0.80470...
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
### `floor`
|
|
128
|
+
|
|
129
|
+
`decimal → decimal` — Round a decimal down to its integer equivalent
|
|
130
|
+
|
|
131
|
+
```
|
|
132
|
+
2.5|floor // 2
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
### `ceil`
|
|
136
|
+
|
|
137
|
+
`decimal → decimal` — Round a decimal up to its integer equivalent
|
|
138
|
+
|
|
139
|
+
```
|
|
140
|
+
2.5|ceil // 3
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
### `round`
|
|
144
|
+
|
|
145
|
+
`decimal → decimal` — Round a decimal with optional precision
|
|
146
|
+
|
|
147
|
+
Args:
|
|
148
|
+
- `precision` (int, default `0`) — the number of decimal digits to round to
|
|
149
|
+
|
|
150
|
+
```
|
|
151
|
+
2.5432|round:1 // 3
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
### `abs`
|
|
155
|
+
|
|
156
|
+
`<T> → decimal` — Returns the absolute value
|
|
157
|
+
|
|
158
|
+
```
|
|
159
|
+
-10|abs // 10
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
### `sqrt`
|
|
163
|
+
|
|
164
|
+
`<T> → decimal` — Returns the square root of the value
|
|
165
|
+
|
|
166
|
+
```
|
|
167
|
+
9|sqrt // 3
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
### `exp`
|
|
171
|
+
|
|
172
|
+
`<T> → decimal` — Returns the exponent of mathematical expression "e"
|
|
173
|
+
|
|
174
|
+
```
|
|
175
|
+
0|exp // 1
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
### `log`
|
|
179
|
+
|
|
180
|
+
`<T> → decimal` — Returns the logarithm with a custom base
|
|
181
|
+
|
|
182
|
+
Args:
|
|
183
|
+
- `base` (<T>)
|
|
184
|
+
|
|
185
|
+
```
|
|
186
|
+
2|log:2 // 1
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
### `log10`
|
|
190
|
+
|
|
191
|
+
`<T> → decimal` — Returns the Base-10 logarithm
|
|
192
|
+
|
|
193
|
+
```
|
|
194
|
+
100|log10 // 2
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
### `ln`
|
|
198
|
+
|
|
199
|
+
`<T> → decimal` — Returns the natural logarithm
|
|
200
|
+
|
|
201
|
+
```
|
|
202
|
+
10|ln // 2.30258...
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
### `pow`
|
|
206
|
+
|
|
207
|
+
`<T> → decimal` — Returns the value raised to the power of exp.
|
|
208
|
+
|
|
209
|
+
Args:
|
|
210
|
+
- `exp` (<T>)
|
|
211
|
+
|
|
212
|
+
```
|
|
213
|
+
10|pow:2 // 100
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
### `array_min` (alias `min`)
|
|
217
|
+
|
|
218
|
+
`<T>[] → decimal` — Returns the min of the values of the array
|
|
219
|
+
|
|
220
|
+
```
|
|
221
|
+
[1,2,3]|array_min // 1
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
### `array_max` (alias `max`)
|
|
225
|
+
|
|
226
|
+
`<T>[] → decimal` — Returns the max of the values of the array
|
|
227
|
+
|
|
228
|
+
```
|
|
229
|
+
[1,2,3]|max // 3
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
### `min` (alias `num_min`)
|
|
233
|
+
|
|
234
|
+
`int | decimal → decimal` — Returns the min both values
|
|
235
|
+
|
|
236
|
+
Args:
|
|
237
|
+
- `value` (any)
|
|
238
|
+
|
|
239
|
+
```
|
|
240
|
+
1|num_min:0 // 0
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
### `max` (alias `num_max`)
|
|
244
|
+
|
|
245
|
+
`int | decimal → decimal` — Returns the max both values
|
|
246
|
+
|
|
247
|
+
Args:
|
|
248
|
+
- `value` (any)
|
|
249
|
+
|
|
250
|
+
```
|
|
251
|
+
5|num_max:20 // 20
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
### `sum`
|
|
255
|
+
|
|
256
|
+
`<T>[] → decimal` — Returns the sum of the values of the array
|
|
257
|
+
|
|
258
|
+
```
|
|
259
|
+
[1,2,3,4]|sum // 10
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
### `avg`
|
|
263
|
+
|
|
264
|
+
`<T>[] → decimal` — Returns the average of the values of the array
|
|
265
|
+
|
|
266
|
+
```
|
|
267
|
+
[1,2,3,4]|avg // 2.5
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
### `product`
|
|
271
|
+
|
|
272
|
+
`<T>[] → decimal` — Returns the product of the values of the array
|
|
273
|
+
|
|
274
|
+
```
|
|
275
|
+
[1,2,3,4]|product // 24
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
### `add`
|
|
279
|
+
|
|
280
|
+
`decimal → decimal` — Add 2 values together and return the answer
|
|
281
|
+
|
|
282
|
+
Args:
|
|
283
|
+
- `value` (decimal)
|
|
284
|
+
|
|
285
|
+
```
|
|
286
|
+
2|add:3 // 5
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
### `subtract` (alias `sub`)
|
|
290
|
+
|
|
291
|
+
`decimal → decimal` — Subtract 2 values together and return the answer
|
|
292
|
+
|
|
293
|
+
Args:
|
|
294
|
+
- `value` (decimal)
|
|
295
|
+
|
|
296
|
+
```
|
|
297
|
+
2|sub:3 // -1
|
|
298
|
+
```
|
|
299
|
+
|
|
300
|
+
### `multiply` (alias `mul`)
|
|
301
|
+
|
|
302
|
+
`decimal → decimal` — Multiply 2 values together and return the answer
|
|
303
|
+
|
|
304
|
+
Args:
|
|
305
|
+
- `value` (decimal)
|
|
306
|
+
|
|
307
|
+
```
|
|
308
|
+
2|mul:3 // 6
|
|
309
|
+
```
|
|
310
|
+
|
|
311
|
+
### `modulus` (alias `mod`)
|
|
312
|
+
|
|
313
|
+
`int → int` — Modulus 2 values together and return the answer
|
|
314
|
+
|
|
315
|
+
Args:
|
|
316
|
+
- `value` (int)
|
|
317
|
+
|
|
318
|
+
```
|
|
319
|
+
20|mod:3 // 2
|
|
320
|
+
```
|
|
321
|
+
|
|
322
|
+
### `divide` (alias `div`)
|
|
323
|
+
|
|
324
|
+
`decimal → decimal` — Divide 2 values together and return the answer
|
|
325
|
+
|
|
326
|
+
Args:
|
|
327
|
+
- `value` (decimal)
|
|
328
|
+
|
|
329
|
+
```
|
|
330
|
+
20|div:4 // 5
|
|
331
|
+
```
|
|
332
|
+
|
|
333
|
+
### `bitwise_and`
|
|
334
|
+
|
|
335
|
+
`int → int` — Bitwise AND 2 values together and return the answer
|
|
336
|
+
|
|
337
|
+
Args:
|
|
338
|
+
- `value` (int)
|
|
339
|
+
|
|
340
|
+
```
|
|
341
|
+
7|bitwise_and:3 // 3
|
|
342
|
+
```
|
|
343
|
+
|
|
344
|
+
### `bitwise_or`
|
|
345
|
+
|
|
346
|
+
`int → int` — Bitwise OR 2 values together and return the answer
|
|
347
|
+
|
|
348
|
+
Args:
|
|
349
|
+
- `value` (int)
|
|
350
|
+
|
|
351
|
+
```
|
|
352
|
+
7|bitwise_or:9 // 15
|
|
353
|
+
```
|
|
354
|
+
|
|
355
|
+
### `bitwise_xor`
|
|
356
|
+
|
|
357
|
+
`int → int` — Bitwise XOR 2 values together and return the answer
|
|
358
|
+
|
|
359
|
+
Args:
|
|
360
|
+
- `value` (int)
|
|
361
|
+
|
|
362
|
+
```
|
|
363
|
+
7|bitwise_xor:9 // 14
|
|
364
|
+
```
|
|
365
|
+
|
|
366
|
+
## Array Filters
|
|
367
|
+
|
|
368
|
+
### `first`
|
|
369
|
+
|
|
370
|
+
`<T>[] → <T>` — Get the first entry of an array
|
|
371
|
+
|
|
372
|
+
```
|
|
373
|
+
["five","six","seven"]|first // "five"
|
|
374
|
+
```
|
|
375
|
+
|
|
376
|
+
### `last`
|
|
377
|
+
|
|
378
|
+
`<T>[] → <T>` — Get the last entry of an array
|
|
379
|
+
|
|
380
|
+
```
|
|
381
|
+
["five","six","seven"]|last // "seven"
|
|
382
|
+
```
|
|
383
|
+
|
|
384
|
+
### `count`
|
|
385
|
+
|
|
386
|
+
`<T>[] → int` — Return the number of items in an object/array
|
|
387
|
+
|
|
388
|
+
```
|
|
389
|
+
["five","six","seven"]|count // 3
|
|
390
|
+
```
|
|
391
|
+
|
|
392
|
+
### `range`
|
|
393
|
+
|
|
394
|
+
`<T> → int[]` — Returns array of values between the specified start/stop.
|
|
395
|
+
|
|
396
|
+
Args:
|
|
397
|
+
- `start` (int) — the start of the range sequence
|
|
398
|
+
- `stop` (int) — the end of the range sequence
|
|
399
|
+
|
|
400
|
+
```
|
|
401
|
+
|range:10:15 // [10,11,12,13,14,15]
|
|
402
|
+
```
|
|
403
|
+
|
|
404
|
+
### `reverse`
|
|
405
|
+
|
|
406
|
+
`<T>[] → <T>[]` — Returns values of an array in reverse order
|
|
407
|
+
|
|
408
|
+
```
|
|
409
|
+
[12,13,14,15]|reverse // [15,14,13,12]
|
|
410
|
+
```
|
|
411
|
+
|
|
412
|
+
### `unique`
|
|
413
|
+
|
|
414
|
+
`<T>[] → <T>[]` — Returns unique values of an array
|
|
415
|
+
|
|
416
|
+
Args:
|
|
417
|
+
- `path` (text) — an optional path within an object - leave blank if just text or numbers
|
|
418
|
+
|
|
419
|
+
```
|
|
420
|
+
[12,13,13,12,11]|unique // [12,13,11]
|
|
421
|
+
```
|
|
422
|
+
|
|
423
|
+
### `safe_array`
|
|
424
|
+
|
|
425
|
+
`<T> | <T>[] → <T>[]` — Always returns an array. Uses the existing value if it is an array or creates an array of one element.
|
|
426
|
+
|
|
427
|
+
```
|
|
428
|
+
12|safe_array // [12]
|
|
429
|
+
```
|
|
430
|
+
|
|
431
|
+
### `flatten`
|
|
432
|
+
|
|
433
|
+
`<T>[] → <T>[]` — Flattens a multidimensional array into a single level array of values.
|
|
434
|
+
|
|
435
|
+
```
|
|
436
|
+
[1,[2,3],[[4,5]]]|flatten // [1,2,3,4,5]
|
|
437
|
+
```
|
|
438
|
+
|
|
439
|
+
### `filter_empty`
|
|
440
|
+
|
|
441
|
+
`<T>[] → <T>[]` — Returns a new array with only entries that are not empty ("", null, 0, "0", false, [], {})
|
|
442
|
+
|
|
443
|
+
Args:
|
|
444
|
+
- `path` (text) — an optional path within an object - leave blank if just text or numbers
|
|
445
|
+
|
|
446
|
+
```
|
|
447
|
+
[{a:1, b:null}, {a:0, b:4}]|filter_empty:a // [{a:1, b:null}]
|
|
448
|
+
```
|
|
449
|
+
|
|
450
|
+
### `sort` (alias `fsort`)
|
|
451
|
+
|
|
452
|
+
`<T>[] → <T>[]` — Sort an array of elements with an optional path inside the element
|
|
453
|
+
|
|
454
|
+
Args:
|
|
455
|
+
- `path` (text) — an optional path into an object
|
|
456
|
+
- `type` (enum, default `"itext"`) — the sorting type - number, text, natural or case-insensitive versions - itext & inatural
|
|
457
|
+
- `asc` (bool, default `true`) — ascending or descending
|
|
458
|
+
|
|
459
|
+
```
|
|
460
|
+
[{v:"a", e:20}, {v:"z", e:10}]|fsort:v:text:true // [{v:"z", e:10}, {v:"a", e:20}]
|
|
461
|
+
```
|
|
462
|
+
|
|
463
|
+
### `shuffle` (alias `array_shuffle`)
|
|
464
|
+
|
|
465
|
+
`<T>[] → <T>[]` — Shuffles the order of the entries in the array.
|
|
466
|
+
|
|
467
|
+
```
|
|
468
|
+
[1,2,3,4]|array_shuffle // [3,2,4,1]
|
|
469
|
+
```
|
|
470
|
+
|
|
471
|
+
### `diff` (alias `array_diff`)
|
|
472
|
+
|
|
473
|
+
`<T>[] → <T>[]` — Return the entries from the first array that are not in the second array. Only values are used for matching.
|
|
474
|
+
|
|
475
|
+
Args:
|
|
476
|
+
- `value` (<T>[])
|
|
477
|
+
|
|
478
|
+
```
|
|
479
|
+
[1,2,3,4]|array_diff:[3,2] // [1,4]
|
|
480
|
+
```
|
|
481
|
+
|
|
482
|
+
### `diff_assoc` (alias `array_diff_assoc`)
|
|
483
|
+
|
|
484
|
+
`<T>[] → <T>[]` — Return the entries from the first array that are not in the second array. Values and keys are used for matching.
|
|
485
|
+
|
|
486
|
+
Args:
|
|
487
|
+
- `value` (<T>[])
|
|
488
|
+
|
|
489
|
+
```
|
|
490
|
+
[{"a": "green"},{"b": "brown"},{"c":"blue"},"red"]|array_diff_assoc:[{"a":"green"}, "yellow", "red"] // [{a: "green",b: "brown", "red"]
|
|
491
|
+
```
|
|
492
|
+
|
|
493
|
+
### `intersect` (alias `array_intersect`)
|
|
494
|
+
|
|
495
|
+
`<T>[] → <T>[]` — Return the entries from the first array that are also present in the second array. Only values are used for matching.
|
|
496
|
+
|
|
497
|
+
Args:
|
|
498
|
+
- `value` (<T>[])
|
|
499
|
+
|
|
500
|
+
```
|
|
501
|
+
[1,2,3,4]|intersect:[3,2] // [2,3]
|
|
502
|
+
```
|
|
503
|
+
|
|
504
|
+
### `intersect_assoc` (alias `array_intersect_assoc`)
|
|
505
|
+
|
|
506
|
+
`<T>[] → <T>[]` — Return the entries from the first array that are also present in the second array. Values and keys are used for matching.
|
|
507
|
+
|
|
508
|
+
Args:
|
|
509
|
+
- `value` (<T>[])
|
|
510
|
+
|
|
511
|
+
```
|
|
512
|
+
[{"a": "green"},{"b": "brown"},{"c":"blue"},"red"]|array_intersect_assoc:[{"a":"green"},{"b":"yellow"},"blue","red"] // [{a: "green",b: "brown", "red"]
|
|
513
|
+
```
|
|
514
|
+
|
|
515
|
+
### `merge` (alias `array_merge`)
|
|
516
|
+
|
|
517
|
+
`<T>[] → <T>[]` — Merge the first level of elements of both arrays together and return the new array
|
|
518
|
+
|
|
519
|
+
Args:
|
|
520
|
+
- `value` (<T>[])
|
|
521
|
+
|
|
522
|
+
```
|
|
523
|
+
[1,2,3]|merge:["a","b","c"] // [1,2,3,"a","b","c"]
|
|
524
|
+
```
|
|
525
|
+
|
|
526
|
+
### `merge_recursive` (alias `array_merge_recursive`)
|
|
527
|
+
|
|
528
|
+
`<T>[] → <T>[]` — Merge the elements from all levels of both arrays together and return the new array
|
|
529
|
+
|
|
530
|
+
Args:
|
|
531
|
+
- `value` (<T>[])
|
|
532
|
+
|
|
533
|
+
```
|
|
534
|
+
{color:{favorite: ["red"]}}|merge_recursive:{color: {favorite: ["green","blue"]}} // {"color":{"favorite": ["red","green","blue"]}}
|
|
535
|
+
```
|
|
536
|
+
|
|
537
|
+
### `index_by`
|
|
538
|
+
|
|
539
|
+
`<T>[] → <T>[]` — Create a new array indexed off of the value of each item's path
|
|
540
|
+
|
|
541
|
+
Args:
|
|
542
|
+
- `path` (text)
|
|
543
|
+
|
|
544
|
+
```
|
|
545
|
+
[{id:1,g:"x"},{id:2,g:"y"},{id:3,g:"x"}]|index_by:g // {"x": [{"id":1,"g":"x"},{"id":3,"g":"x"}], "y": [{"id":2,"g":"y"}]}
|
|
546
|
+
```
|
|
547
|
+
|
|
548
|
+
### `push` (alias `array_push`)
|
|
549
|
+
|
|
550
|
+
`<T>[] → <T>[]` — Push an element on to the end of an array and return the new array
|
|
551
|
+
|
|
552
|
+
Args:
|
|
553
|
+
- `value` (<T>)
|
|
554
|
+
|
|
555
|
+
```
|
|
556
|
+
[1,2,3]|array_push:"a" // [1,2,3,"a"]
|
|
557
|
+
```
|
|
558
|
+
|
|
559
|
+
### `pop` (alias `array_pop`)
|
|
560
|
+
|
|
561
|
+
`<T>[] → <T>` — Pops the last element of the array off and returns it
|
|
562
|
+
|
|
563
|
+
```
|
|
564
|
+
[1,2,3]|array_pop // 3
|
|
565
|
+
```
|
|
566
|
+
|
|
567
|
+
### `unshift` (alias `array_unshift`)
|
|
568
|
+
|
|
569
|
+
`<T>[] → <T>[]` — Push an element to the beginning of an array and return the new array
|
|
570
|
+
|
|
571
|
+
Args:
|
|
572
|
+
- `value` (<T>)
|
|
573
|
+
|
|
574
|
+
```
|
|
575
|
+
[1,2,3]|array_unshift:0 // [0,1,2,3]
|
|
576
|
+
```
|
|
577
|
+
|
|
578
|
+
### `shift` (alias `array_shift`)
|
|
579
|
+
|
|
580
|
+
`<T>[] → <T>` — Shifts the first element of the array off and returns it
|
|
581
|
+
|
|
582
|
+
```
|
|
583
|
+
[1,2,3]|shift // 1
|
|
584
|
+
```
|
|
585
|
+
|
|
586
|
+
### `remove` (alias `array_remove`)
|
|
587
|
+
|
|
588
|
+
`<T>[] → <T>[]` — Remove any elements from the array that match the supplied value and then return the new array
|
|
589
|
+
|
|
590
|
+
Args:
|
|
591
|
+
- `value` (<T>)
|
|
592
|
+
- `path` (text) — an optional path into an object
|
|
593
|
+
- `strict` (bool, default `false`) — enforce strict type matching (100 vs "100")
|
|
594
|
+
|
|
595
|
+
```
|
|
596
|
+
[{v:1},{v:2},{v:3}]|remove:{v:2} // [{v:1},{v:3}]
|
|
597
|
+
```
|
|
598
|
+
|
|
599
|
+
### `append`
|
|
600
|
+
|
|
601
|
+
`<T>[] → <T>[]` — Push an element on to the end of an array within an object and return the updated object
|
|
602
|
+
|
|
603
|
+
Args:
|
|
604
|
+
- `value` (<T>)
|
|
605
|
+
- `path` (text) — an optional path into an object
|
|
606
|
+
|
|
607
|
+
```
|
|
608
|
+
[1,2,3]|append:4 // [1,2,3,4]
|
|
609
|
+
```
|
|
610
|
+
|
|
611
|
+
### `prepend`
|
|
612
|
+
|
|
613
|
+
`<T>[] → <T>[]` — Push an element on to the beginning of an array within an object and return the updated object
|
|
614
|
+
|
|
615
|
+
Args:
|
|
616
|
+
- `value` (<T>)
|
|
617
|
+
- `path` (text) — an optional path into an object
|
|
618
|
+
|
|
619
|
+
```
|
|
620
|
+
[1,2,3]|prepend:0 // [0,1,2,3]
|
|
621
|
+
```
|
|
622
|
+
|
|
623
|
+
### `join`
|
|
624
|
+
|
|
625
|
+
`<T>[] → text` — Joins an array into a text string via the separator and returns the result
|
|
626
|
+
|
|
627
|
+
Args:
|
|
628
|
+
- `separator` (text) — the value used for joining the text array
|
|
629
|
+
|
|
630
|
+
```
|
|
631
|
+
["Epic","Battle"]|join:" " // "Epic Battle"
|
|
632
|
+
```
|
|
633
|
+
|
|
634
|
+
### `slice` (alias `array_slice`)
|
|
635
|
+
|
|
636
|
+
`<T>[] → <T>[]` — Extract a section from an array.
|
|
637
|
+
|
|
638
|
+
Args:
|
|
639
|
+
- `offset` (int, default `0`) — The offset into the array
|
|
640
|
+
- `length` (int, default `-1`) — The length from the offset. Negative values start at the end.
|
|
641
|
+
|
|
642
|
+
```
|
|
643
|
+
[1,2,3,4,5]|array_slice:2:2 // [3,4]
|
|
644
|
+
```
|
|
645
|
+
|
|
646
|
+
### `keys` (alias `array_keys`)
|
|
647
|
+
|
|
648
|
+
`obj | json → text[]` — Get the property keys of an object/array as a numerically indexed array.
|
|
649
|
+
|
|
650
|
+
```
|
|
651
|
+
{"a":1,"b":2,"c":3}|array_keys // ["a","b","c"]
|
|
652
|
+
```
|
|
653
|
+
|
|
654
|
+
### `values` (alias `array_values`)
|
|
655
|
+
|
|
656
|
+
`obj | json → any[]` — Get the property values of an object/array as a numerically indexed array
|
|
657
|
+
|
|
658
|
+
```
|
|
659
|
+
{"a":1,"b":2,"c":3}|array_values // [1,2,3]
|
|
660
|
+
```
|
|
661
|
+
|
|
662
|
+
### `entries` (alias `array_entries`)
|
|
663
|
+
|
|
664
|
+
`obj | json → any[]` — Get the property entries of an object/array as a numerically indexed array of key/value pairs.
|
|
665
|
+
|
|
666
|
+
```
|
|
667
|
+
{"a":1,"b":2,"c":3}|array_entries // [{key:"a",value:1},{key:"b",value:2},{key:"c",value:3}]
|
|
668
|
+
```
|
|
669
|
+
|
|
670
|
+
### `map`
|
|
671
|
+
|
|
672
|
+
`any[] → any[]` — Creates a new array with the results of calling a provided function on every element in the calling array.
|
|
673
|
+
|
|
674
|
+
Args:
|
|
675
|
+
- `code` (text) — return the replacement value
|
|
676
|
+
|
|
677
|
+
```
|
|
678
|
+
[{value: 2}, {value: 5}]|map:$$.value*2 // double each value => [4,10]
|
|
679
|
+
```
|
|
680
|
+
|
|
681
|
+
### `filter`
|
|
682
|
+
|
|
683
|
+
`any[] → any[]` — Filters the elements of an array based on the code block returning true to keep the element or false to skip it.
|
|
684
|
+
|
|
685
|
+
Args:
|
|
686
|
+
- `code` (text) — return true to keep the element
|
|
687
|
+
|
|
688
|
+
```
|
|
689
|
+
[{value: 2}, {value: 5}]|filter:$$.value%2==0 //
|
|
690
|
+
```
|
|
691
|
+
|
|
692
|
+
### `some`
|
|
693
|
+
|
|
694
|
+
`any[] → any[]` — Checks if at least one element in the array passes the test implemented by the provided function.
|
|
695
|
+
|
|
696
|
+
Args:
|
|
697
|
+
- `code` (text) — return true the element is found
|
|
698
|
+
|
|
699
|
+
```
|
|
700
|
+
[{value: 2}, {value: 5}]|some:$$.value%2==0 // at least one value is even => true
|
|
701
|
+
```
|
|
702
|
+
|
|
703
|
+
### `every`
|
|
704
|
+
|
|
705
|
+
`any[] → any[]` — Checks if all elements in the array pass the test implemented by the provided function.
|
|
706
|
+
|
|
707
|
+
Args:
|
|
708
|
+
- `code` (text) — return true the element is found
|
|
709
|
+
|
|
710
|
+
```
|
|
711
|
+
[{value: 2}, {value: 6}]|every:$$.value%2==0 // all values are even => true
|
|
712
|
+
```
|
|
713
|
+
|
|
714
|
+
### `find`
|
|
715
|
+
|
|
716
|
+
`any[] → any[]` — Finds if all elements in the array pass the test implemented by the provided function.
|
|
717
|
+
|
|
718
|
+
Args:
|
|
719
|
+
- `code` (text) — return true the element is found
|
|
720
|
+
|
|
721
|
+
```
|
|
722
|
+
[{id: 1}, {id: 2}, {id: 3}]|find:$$.id==2 // returns {id:2}
|
|
723
|
+
```
|
|
724
|
+
|
|
725
|
+
### `findIndex`
|
|
726
|
+
|
|
727
|
+
`any[] → any[]` — Finds the index of the first element in the array that passes the test implemented by the provided function.
|
|
728
|
+
|
|
729
|
+
Args:
|
|
730
|
+
- `code` (text) — return true the element is found
|
|
731
|
+
|
|
732
|
+
```
|
|
733
|
+
[{id: 1}, {id: 2}, {id: 3}]|findIndex:$$.id==2 // returns 1
|
|
734
|
+
```
|
|
735
|
+
|
|
736
|
+
### `reduce`
|
|
737
|
+
|
|
738
|
+
`any[] → any[]` — Reduces the array to a single value using the code block to combine each element of the array.
|
|
739
|
+
|
|
740
|
+
Args:
|
|
741
|
+
- `code` (text) — return the new result
|
|
742
|
+
- `initial_value` (int, default `0`) — The initial value to start with for the first value of $result.
|
|
743
|
+
|
|
744
|
+
```
|
|
745
|
+
[1,2,3,4,5]|reduce:$$+$result:10 // returns 25
|
|
746
|
+
```
|
|
747
|
+
|
|
748
|
+
### `pick`
|
|
749
|
+
|
|
750
|
+
`<T> → <T>` — Pick keys from the object to create a new object of just those keys.
|
|
751
|
+
|
|
752
|
+
Args:
|
|
753
|
+
- `keys` (text) — comma seperated list of keys
|
|
754
|
+
|
|
755
|
+
```
|
|
756
|
+
{a:1,b:2,c:3}|pick:[a,c] // returns {a:1,c:3}
|
|
757
|
+
```
|
|
758
|
+
|
|
759
|
+
### `unpick`
|
|
760
|
+
|
|
761
|
+
`<T> → <T>` — Remove keys from the object to create a new object of the remaining keys.
|
|
762
|
+
|
|
763
|
+
Args:
|
|
764
|
+
- `keys` (text) — comma seperated list of keys to exclude
|
|
765
|
+
|
|
766
|
+
```
|
|
767
|
+
{a:1,b:2,c:3}|unpick:[a,c] // returns {b:2}
|
|
768
|
+
```
|
|
769
|
+
|
|
770
|
+
## Comparison Filters
|
|
771
|
+
|
|
772
|
+
### `equals` (alias `eq`)
|
|
773
|
+
|
|
774
|
+
`<T> → bool` — Returns a boolean if both values are equal
|
|
775
|
+
|
|
776
|
+
Args:
|
|
777
|
+
- `value` (<T>)
|
|
778
|
+
|
|
779
|
+
```
|
|
780
|
+
4|eq:4 // true
|
|
781
|
+
```
|
|
782
|
+
|
|
783
|
+
### `not_equals` (alias `ne`)
|
|
784
|
+
|
|
785
|
+
`<T> → bool` — Returns a boolean if both values are not equal
|
|
786
|
+
|
|
787
|
+
Args:
|
|
788
|
+
- `value` (<T>)
|
|
789
|
+
|
|
790
|
+
```
|
|
791
|
+
4|ne:4 // false
|
|
792
|
+
```
|
|
793
|
+
|
|
794
|
+
### `greater_than` (alias `gt`)
|
|
795
|
+
|
|
796
|
+
`<T> → bool` — Returns a boolean if the left value is greater than the right value
|
|
797
|
+
|
|
798
|
+
Args:
|
|
799
|
+
- `value` (<T>)
|
|
800
|
+
|
|
801
|
+
```
|
|
802
|
+
4|gt:2 // true
|
|
803
|
+
```
|
|
804
|
+
|
|
805
|
+
### `greater_than_or_equal` (alias `gte`)
|
|
806
|
+
|
|
807
|
+
`<T> → bool` — Returns a boolean if the left value is greater than or equal to the right value
|
|
808
|
+
|
|
809
|
+
Args:
|
|
810
|
+
- `value` (<T>)
|
|
811
|
+
|
|
812
|
+
```
|
|
813
|
+
4|gte:2 // true
|
|
814
|
+
```
|
|
815
|
+
|
|
816
|
+
### `less_than` (alias `lt`)
|
|
817
|
+
|
|
818
|
+
`<T> → bool` — Returns a boolean if the left value is less than the right value
|
|
819
|
+
|
|
820
|
+
Args:
|
|
821
|
+
- `value` (<T>)
|
|
822
|
+
|
|
823
|
+
```
|
|
824
|
+
4|lt:2 // false
|
|
825
|
+
```
|
|
826
|
+
|
|
827
|
+
### `less_than_or_equal` (alias `lte`)
|
|
828
|
+
|
|
829
|
+
`<T> → bool` — Returns a boolean if the left value is less than or equal to the right value
|
|
830
|
+
|
|
831
|
+
Args:
|
|
832
|
+
- `value` (<T>)
|
|
833
|
+
|
|
834
|
+
```
|
|
835
|
+
4|lte:2 // false
|
|
836
|
+
```
|
|
837
|
+
|
|
838
|
+
### `odd`
|
|
839
|
+
|
|
840
|
+
`int → bool` — Returns whether or not the value is odd
|
|
841
|
+
|
|
842
|
+
```
|
|
843
|
+
4|odd // false
|
|
844
|
+
```
|
|
845
|
+
|
|
846
|
+
### `even`
|
|
847
|
+
|
|
848
|
+
`int → bool` — Returns whether or not the value is even
|
|
849
|
+
|
|
850
|
+
```
|
|
851
|
+
4|even // true
|
|
852
|
+
```
|
|
853
|
+
|
|
854
|
+
### `in`
|
|
855
|
+
|
|
856
|
+
`<T>[] → bool` — Returns whether or not the value is in the array
|
|
857
|
+
|
|
858
|
+
Args:
|
|
859
|
+
- `search` (<T>) — The searched value
|
|
860
|
+
|
|
861
|
+
```
|
|
862
|
+
[1,2,3]|in:3 // true
|
|
863
|
+
```
|
|
864
|
+
|
|
865
|
+
### `not`
|
|
866
|
+
|
|
867
|
+
`bool → bool` — Returns the opposite of the existing value evaluated as a boolean
|
|
868
|
+
|
|
869
|
+
```
|
|
870
|
+
true|not // false
|
|
871
|
+
```
|
|
872
|
+
|
|
873
|
+
### `bitwise_not`
|
|
874
|
+
|
|
875
|
+
`int → int` — Returns the existing value with its bits flipped
|
|
876
|
+
|
|
877
|
+
```
|
|
878
|
+
8|bitwise_not // -9
|
|
879
|
+
```
|
|
880
|
+
|
|
881
|
+
### `is_null` (alias `null`)
|
|
882
|
+
|
|
883
|
+
`<T> → bool` — Returns whether or not the value is null
|
|
884
|
+
|
|
885
|
+
```
|
|
886
|
+
8|is_null // false
|
|
887
|
+
```
|
|
888
|
+
|
|
889
|
+
### `is_empty` (alias `empty`)
|
|
890
|
+
|
|
891
|
+
`<T> → bool` — Returns whether or not the value is empty ("", null, 0, "0", false, [], {})
|
|
892
|
+
|
|
893
|
+
```
|
|
894
|
+
[]|is_empty // true
|
|
895
|
+
```
|
|
896
|
+
|
|
897
|
+
### `is_object`
|
|
898
|
+
|
|
899
|
+
`<T> → bool` — Returns whether or not the value is an object.
|
|
900
|
+
|
|
901
|
+
```
|
|
902
|
+
{id:2, value:3, size:4}|is_object // true
|
|
903
|
+
```
|
|
904
|
+
|
|
905
|
+
### `is_array`
|
|
906
|
+
|
|
907
|
+
`<T> → bool` — Returns whether or not the value is a numerical indexed array.
|
|
908
|
+
|
|
909
|
+
```
|
|
910
|
+
[1,2,3]|is_array // true
|
|
911
|
+
```
|
|
912
|
+
|
|
913
|
+
### `is_int`
|
|
914
|
+
|
|
915
|
+
`<T> → bool` — Returns whether or not the value is an integer.
|
|
916
|
+
|
|
917
|
+
```
|
|
918
|
+
123|is_int // true
|
|
919
|
+
```
|
|
920
|
+
|
|
921
|
+
### `is_decimal`
|
|
922
|
+
|
|
923
|
+
`<T> → bool` — Returns whether or not the value is a decimal value.
|
|
924
|
+
|
|
925
|
+
```
|
|
926
|
+
123.45|is_decimal // true
|
|
927
|
+
```
|
|
928
|
+
|
|
929
|
+
### `is_bool`
|
|
930
|
+
|
|
931
|
+
`<T> → bool` — Returns whether or not the value is a boolean.
|
|
932
|
+
|
|
933
|
+
```
|
|
934
|
+
false|is_bool // true
|
|
935
|
+
```
|
|
936
|
+
|
|
937
|
+
### `is_text`
|
|
938
|
+
|
|
939
|
+
`<T> → bool` — Returns whether or not the value is text.
|
|
940
|
+
|
|
941
|
+
```
|
|
942
|
+
"213"|is_text // true
|
|
943
|
+
```
|
|
944
|
+
|
|
945
|
+
## Text Filters
|
|
946
|
+
|
|
947
|
+
### `addslashes`
|
|
948
|
+
|
|
949
|
+
`text → text` — Adds a backslash to the following characters: single quote, double quote, backslash, and null character.
|
|
950
|
+
|
|
951
|
+
```
|
|
952
|
+
'he said "Hi!"'|addslashes // "he said \\"Hi!\\""
|
|
953
|
+
```
|
|
954
|
+
|
|
955
|
+
### `escape`
|
|
956
|
+
|
|
957
|
+
`text → text` — Converts special characters into their escaped variants. Ex: for tabs and for newlines.
|
|
958
|
+
|
|
959
|
+
```
|
|
960
|
+
'he said
|
|
961
|
+
- "Hi!"'|escape // "he said \\n-\\\"Hi!\\\""
|
|
962
|
+
```
|
|
963
|
+
|
|
964
|
+
### `list_encodings`
|
|
965
|
+
|
|
966
|
+
`any → text[]` — List support character encodings
|
|
967
|
+
|
|
968
|
+
```
|
|
969
|
+
|list_encodings // ["UTF-8", "ISO-8859-1", ...]
|
|
970
|
+
```
|
|
971
|
+
|
|
972
|
+
### `detect_encoding`
|
|
973
|
+
|
|
974
|
+
`text → text` — Detect the character encoding of the supplied text
|
|
975
|
+
|
|
976
|
+
Args:
|
|
977
|
+
- `encodings` (text) — optional - leave blank to auto-detect or include a comma seperated list of encodings
|
|
978
|
+
|
|
979
|
+
```
|
|
980
|
+
"étude"|detect_encoding // UTF-8
|
|
981
|
+
```
|
|
982
|
+
|
|
983
|
+
### `to_utf8`
|
|
984
|
+
|
|
985
|
+
`text → text` — Convert the supplied text from its binary form (ISO-8859-1) to UTF-8.
|
|
986
|
+
|
|
987
|
+
```
|
|
988
|
+
"�tudes"|to_utf8 // "études"
|
|
989
|
+
```
|
|
990
|
+
|
|
991
|
+
### `from_utf8`
|
|
992
|
+
|
|
993
|
+
`text → text` — Convert the supplied text from UTF-8 to its binary form (ISO-8859-1).
|
|
994
|
+
|
|
995
|
+
```
|
|
996
|
+
"études"|from_utf8 // "�tudes"
|
|
997
|
+
```
|
|
998
|
+
|
|
999
|
+
### `convert_encoding`
|
|
1000
|
+
|
|
1001
|
+
`text → text` — Convert the character encoding of the supplied text
|
|
1002
|
+
|
|
1003
|
+
Args:
|
|
1004
|
+
- `to` (text) — the resulting character encoding
|
|
1005
|
+
- `from` (text) — the current character encoding of the supplied text. This is commonly identified by the result of detect_encoding.
|
|
1006
|
+
|
|
1007
|
+
```
|
|
1008
|
+
"études"|convert_encoding:"ISO-8859-1":"UTF-8" // "�tudes"
|
|
1009
|
+
```
|
|
1010
|
+
|
|
1011
|
+
### `to_lower` (alias `lower`)
|
|
1012
|
+
|
|
1013
|
+
`text → text` — Converts all characters to lower case and returns the result
|
|
1014
|
+
|
|
1015
|
+
```
|
|
1016
|
+
"Epic Battle"|lower // "epic battle"
|
|
1017
|
+
```
|
|
1018
|
+
|
|
1019
|
+
### `to_upper` (alias `upper`)
|
|
1020
|
+
|
|
1021
|
+
`text → text` — Converts all characters to upper case and returns the result
|
|
1022
|
+
|
|
1023
|
+
```
|
|
1024
|
+
"Epic Battle"|upper // "EPIC BATTLE"
|
|
1025
|
+
```
|
|
1026
|
+
|
|
1027
|
+
### `trim`
|
|
1028
|
+
|
|
1029
|
+
`text | text[] → text` — Trim whitespace or other characters from both sides and return the result
|
|
1030
|
+
|
|
1031
|
+
Args:
|
|
1032
|
+
- `mask` (text) — optional - include a list of characters to trim or leave blank to trim whitespace
|
|
1033
|
+
|
|
1034
|
+
```
|
|
1035
|
+
" Epic Battle "|trim // "Epic Battle"
|
|
1036
|
+
```
|
|
1037
|
+
|
|
1038
|
+
### `ltrim`
|
|
1039
|
+
|
|
1040
|
+
`text | text[] → text` — Trim whitespace or other characters from the left side and return the result
|
|
1041
|
+
|
|
1042
|
+
Args:
|
|
1043
|
+
- `mask` (text) — optional - include a list of characters to trim or leave blank to trim whitespace
|
|
1044
|
+
|
|
1045
|
+
```
|
|
1046
|
+
" Epic Battle "|ltrim // "Epic Battle "
|
|
1047
|
+
```
|
|
1048
|
+
|
|
1049
|
+
### `rtrim`
|
|
1050
|
+
|
|
1051
|
+
`text | text[] → text` — Trim whitespace or other characters from the right return the result
|
|
1052
|
+
|
|
1053
|
+
Args:
|
|
1054
|
+
- `mask` (text) — optional - include a list of characters to trim or leave blank to trim whitespace
|
|
1055
|
+
|
|
1056
|
+
```
|
|
1057
|
+
" Epic Battle "|rtrim // " Epic Battle"
|
|
1058
|
+
```
|
|
1059
|
+
|
|
1060
|
+
### `capitalize`
|
|
1061
|
+
|
|
1062
|
+
`text → text` — Converts the first letter of each word to a capital letter
|
|
1063
|
+
|
|
1064
|
+
```
|
|
1065
|
+
"epic battle"|capitalize // "Epic Battle"
|
|
1066
|
+
```
|
|
1067
|
+
|
|
1068
|
+
### `substr`
|
|
1069
|
+
|
|
1070
|
+
`text → text` — Extracts a section of text
|
|
1071
|
+
|
|
1072
|
+
Args:
|
|
1073
|
+
- `start` (int) — the starting position of text extraction. negative values start at the end.
|
|
1074
|
+
- `length` (int) — optional - the length of the extraction. negative values will omit values from the end.
|
|
1075
|
+
|
|
1076
|
+
```
|
|
1077
|
+
"Epic Battle"|substr:5:6 // "Battle"
|
|
1078
|
+
```
|
|
1079
|
+
|
|
1080
|
+
### `split`
|
|
1081
|
+
|
|
1082
|
+
`text → text[]` — Splits text into an array of text and returns the result
|
|
1083
|
+
|
|
1084
|
+
Args:
|
|
1085
|
+
- `separator` (text) — the value used for splitting the text
|
|
1086
|
+
|
|
1087
|
+
```
|
|
1088
|
+
"Epic Battle"|split:" " // ["Epic","Battle"]
|
|
1089
|
+
```
|
|
1090
|
+
|
|
1091
|
+
### `strlen`
|
|
1092
|
+
|
|
1093
|
+
`text → int` — Returns the number of characters
|
|
1094
|
+
|
|
1095
|
+
```
|
|
1096
|
+
"Epic Battle"|strlen // 11
|
|
1097
|
+
```
|
|
1098
|
+
|
|
1099
|
+
### `strip_html` (alias `strip_tags`)
|
|
1100
|
+
|
|
1101
|
+
`text → text` — Removes HTML tags from a string
|
|
1102
|
+
|
|
1103
|
+
Args:
|
|
1104
|
+
- `exclude` (text) — optional - exclude certain tags. i.e.
|
|
1105
|
+
|
|
1106
|
+
```
|
|
1107
|
+
"<p>Epic Battle</p>"|strip_html // "Epic Battle"
|
|
1108
|
+
```
|
|
1109
|
+
|
|
1110
|
+
### `unaccent` (alias `strip_accents`)
|
|
1111
|
+
|
|
1112
|
+
`text → text` — Removes accents from characters
|
|
1113
|
+
|
|
1114
|
+
```
|
|
1115
|
+
"études"|unaccent // "etudes"
|
|
1116
|
+
```
|
|
1117
|
+
|
|
1118
|
+
### `index` (alias `strpos`)
|
|
1119
|
+
|
|
1120
|
+
`text → int` — Returns the index of the case-sensitive expression or false if it can't be found
|
|
1121
|
+
|
|
1122
|
+
Args:
|
|
1123
|
+
- `search` (text)
|
|
1124
|
+
|
|
1125
|
+
```
|
|
1126
|
+
"Epic Battle"|strpos:"Battle" // 5
|
|
1127
|
+
```
|
|
1128
|
+
|
|
1129
|
+
### `iindex` (alias `stripos`)
|
|
1130
|
+
|
|
1131
|
+
`text → int` — Returns the index of the case-insensitive expression or false if it can't be found
|
|
1132
|
+
|
|
1133
|
+
Args:
|
|
1134
|
+
- `search` (text)
|
|
1135
|
+
|
|
1136
|
+
```
|
|
1137
|
+
"Epic Battle"|stripos:"battle" // 5
|
|
1138
|
+
```
|
|
1139
|
+
|
|
1140
|
+
### `starts_with`
|
|
1141
|
+
|
|
1142
|
+
`text → bool` — Returns whether or not the expression is present at the beginning
|
|
1143
|
+
|
|
1144
|
+
Args:
|
|
1145
|
+
- `search` (text)
|
|
1146
|
+
|
|
1147
|
+
```
|
|
1148
|
+
"Epic Battle"|starts_with:"Epic" // true
|
|
1149
|
+
```
|
|
1150
|
+
|
|
1151
|
+
### `istarts_with`
|
|
1152
|
+
|
|
1153
|
+
`text → bool` — Returns whether or not the case-insensitive expression is present at the beginning
|
|
1154
|
+
|
|
1155
|
+
Args:
|
|
1156
|
+
- `search` (text)
|
|
1157
|
+
|
|
1158
|
+
```
|
|
1159
|
+
"Epic Battle"|istarts_with:"epic" // true
|
|
1160
|
+
```
|
|
1161
|
+
|
|
1162
|
+
### `ends_with`
|
|
1163
|
+
|
|
1164
|
+
`text → bool` — Returns whether or not the expression is present at the end
|
|
1165
|
+
|
|
1166
|
+
Args:
|
|
1167
|
+
- `search` (text)
|
|
1168
|
+
|
|
1169
|
+
```
|
|
1170
|
+
"Epic Battle"|ends_with:"Battle" // true
|
|
1171
|
+
```
|
|
1172
|
+
|
|
1173
|
+
### `iends_with`
|
|
1174
|
+
|
|
1175
|
+
`text → bool` — Returns whether or not the case-insensitive expression is present at the end
|
|
1176
|
+
|
|
1177
|
+
Args:
|
|
1178
|
+
- `search` (text)
|
|
1179
|
+
|
|
1180
|
+
```
|
|
1181
|
+
"Epic Battle"|iends_with:"battle" // true
|
|
1182
|
+
```
|
|
1183
|
+
|
|
1184
|
+
### `contains`
|
|
1185
|
+
|
|
1186
|
+
`text → bool` — Returns whether or not the expression is found
|
|
1187
|
+
|
|
1188
|
+
Args:
|
|
1189
|
+
- `search` (text)
|
|
1190
|
+
|
|
1191
|
+
```
|
|
1192
|
+
"Epic Battle"|contains:"Battle" // true
|
|
1193
|
+
```
|
|
1194
|
+
|
|
1195
|
+
### `icontains`
|
|
1196
|
+
|
|
1197
|
+
`text → bool` — Returns whether or not the case-insensitive expression is found
|
|
1198
|
+
|
|
1199
|
+
Args:
|
|
1200
|
+
- `search` (text)
|
|
1201
|
+
|
|
1202
|
+
```
|
|
1203
|
+
"Epic Battle"|icontains:"battle" // true
|
|
1204
|
+
```
|
|
1205
|
+
|
|
1206
|
+
### `url_addarg`
|
|
1207
|
+
|
|
1208
|
+
`text → text` — Parses a URL and returns an updated version with an encoded version of the supplied argument
|
|
1209
|
+
|
|
1210
|
+
Args:
|
|
1211
|
+
- `key` (text) — the argument key
|
|
1212
|
+
- `value` (text) — the argument value
|
|
1213
|
+
- `encoding_rfc3986` (bool, default `false`) — whether or not to use the RFC 3986 specification
|
|
1214
|
+
|
|
1215
|
+
```
|
|
1216
|
+
"https://example.com?foo=bar"|url_addarg:"fiz":"buz" // "https://example.com?foo=bar&fiz=buz"
|
|
1217
|
+
```
|
|
1218
|
+
|
|
1219
|
+
### `url_delarg`
|
|
1220
|
+
|
|
1221
|
+
`text → text` — Parses a URL and returns an updated version with the supplied argument removed
|
|
1222
|
+
|
|
1223
|
+
Args:
|
|
1224
|
+
- `key` (text) — the argument key
|
|
1225
|
+
|
|
1226
|
+
```
|
|
1227
|
+
"https://example.com?foo=bar&fiz=buz"|url_delarg:"fiz" // "https://example.com?foo=bar"
|
|
1228
|
+
```
|
|
1229
|
+
|
|
1230
|
+
### `url_hasarg`
|
|
1231
|
+
|
|
1232
|
+
`text → text` — Returns the existence of a argument in the URL
|
|
1233
|
+
|
|
1234
|
+
Args:
|
|
1235
|
+
- `key` (text) — the argument key
|
|
1236
|
+
|
|
1237
|
+
```
|
|
1238
|
+
"https://example.com?foo=bar&fiz=buz"|url_hasarg:"fiz" // true
|
|
1239
|
+
```
|
|
1240
|
+
|
|
1241
|
+
### `url_getarg`
|
|
1242
|
+
|
|
1243
|
+
`text → text` — Gets the argument's value from a URL
|
|
1244
|
+
|
|
1245
|
+
Args:
|
|
1246
|
+
- `key` (text) — the argument key
|
|
1247
|
+
- `default` (text, default `""`) — the default is used if no argument is found in the URL
|
|
1248
|
+
|
|
1249
|
+
```
|
|
1250
|
+
"https://example.com?foo=bar&fiz=buz"|url_getarg:"fiz" // "buz"
|
|
1251
|
+
```
|
|
1252
|
+
|
|
1253
|
+
### `url_parse`
|
|
1254
|
+
|
|
1255
|
+
`text → json` — Parses a URL into its individual components.
|
|
1256
|
+
|
|
1257
|
+
```
|
|
1258
|
+
"https://username:password@example.com:8080/path?foo=bar&fiz=buz#fragment"|url_parse // {
|
|
1259
|
+
"scheme": "https",
|
|
1260
|
+
"host": "example.com",
|
|
1261
|
+
"port": 8080,
|
|
1262
|
+
"user": "username",
|
|
1263
|
+
"pass": "password",
|
|
1264
|
+
"path": "/path",
|
|
1265
|
+
"query": "foo=bar&fiz=buz",
|
|
1266
|
+
"fragment": "fragment"
|
|
1267
|
+
}
|
|
1268
|
+
```
|
|
1269
|
+
|
|
1270
|
+
### `querystring_parse`
|
|
1271
|
+
|
|
1272
|
+
`text → json` — Parses a query string from a URL into its individual key-value pairs.
|
|
1273
|
+
|
|
1274
|
+
```
|
|
1275
|
+
"foo=bar&fiz=buz"|querystring_parse // {"foo": "bar", "fiz": "buz"}
|
|
1276
|
+
```
|
|
1277
|
+
|
|
1278
|
+
### `concat`
|
|
1279
|
+
|
|
1280
|
+
`text | int | decimal → text` — Concatenates two values together
|
|
1281
|
+
|
|
1282
|
+
Args:
|
|
1283
|
+
- `value` (text) — the text being concatenated
|
|
1284
|
+
- `sep` (text, default `""`) — an optional separator between both text strings
|
|
1285
|
+
|
|
1286
|
+
```
|
|
1287
|
+
"Hello" | concat:"World!":" - " // "Hello - World!"
|
|
1288
|
+
```
|
|
1289
|
+
|
|
1290
|
+
### `sprintf`
|
|
1291
|
+
|
|
1292
|
+
`text → text` — formats text with variable substitution
|
|
1293
|
+
|
|
1294
|
+
```
|
|
1295
|
+
"Hello %s, you have %d new messages"|sprintf:"Bob":5 // "Hello Bob, you have 5 new messages"
|
|
1296
|
+
```
|
|
1297
|
+
|
|
1298
|
+
### `replace` (alias `string_replace`)
|
|
1299
|
+
|
|
1300
|
+
`text → text` — Replace all occurrences of a text phrase with another
|
|
1301
|
+
|
|
1302
|
+
Args:
|
|
1303
|
+
- `search` (text) — the text being replaced
|
|
1304
|
+
- `replacement` (text) — the replacement text
|
|
1305
|
+
|
|
1306
|
+
```
|
|
1307
|
+
"Hella World"|string_replace:"o":"a" // "Hella Warld"
|
|
1308
|
+
```
|
|
1309
|
+
|
|
1310
|
+
### `regex_matches` (alias `regex_test`)
|
|
1311
|
+
|
|
1312
|
+
`text → bool` — Tests if a regular expression matches the supplied subject text.
|
|
1313
|
+
|
|
1314
|
+
Args:
|
|
1315
|
+
- `subject` (text)
|
|
1316
|
+
|
|
1317
|
+
```
|
|
1318
|
+
"/^a.*c$/"|regex_test:"abbbbc" // true
|
|
1319
|
+
```
|
|
1320
|
+
|
|
1321
|
+
### `regex_get_first_match` (alias `regex_match`)
|
|
1322
|
+
|
|
1323
|
+
`text → text[]` — Return the first set of matches performed by a regular expression on the supplied subject text.
|
|
1324
|
+
|
|
1325
|
+
Args:
|
|
1326
|
+
- `subject` (text)
|
|
1327
|
+
|
|
1328
|
+
```
|
|
1329
|
+
"/(\w+)@(\w+).(\w+)/"|regex_match:"test@example.com" // ["test@example.com","test","example","com"]
|
|
1330
|
+
```
|
|
1331
|
+
|
|
1332
|
+
### `regex_get_all_matches` (alias `regex_match_all`)
|
|
1333
|
+
|
|
1334
|
+
`text → text[]` — Return all matches performed by a regular expression on the supplied subject text.
|
|
1335
|
+
|
|
1336
|
+
Args:
|
|
1337
|
+
- `subject` (text)
|
|
1338
|
+
|
|
1339
|
+
```
|
|
1340
|
+
"/\b\w+@\w+.\w+\b/"|regex_match_all:"test@example.com" // [["test@example.com"]]
|
|
1341
|
+
```
|
|
1342
|
+
|
|
1343
|
+
### `regex_quote`
|
|
1344
|
+
|
|
1345
|
+
`text → text` — Update the supplied text value to be properly escaped for regular expressions.
|
|
1346
|
+
|
|
1347
|
+
Args:
|
|
1348
|
+
- `delimiter` (text, default `""`) — An optional delimiter character to escape.
|
|
1349
|
+
|
|
1350
|
+
```
|
|
1351
|
+
"Hello. How are you?"|regex_quote:"/" // "Hello\\. How are you\\?"
|
|
1352
|
+
```
|
|
1353
|
+
|
|
1354
|
+
### `regex_replace`
|
|
1355
|
+
|
|
1356
|
+
`text → text` — Perform a regular expression search and replace on the supplied subject text.
|
|
1357
|
+
|
|
1358
|
+
Args:
|
|
1359
|
+
- `replacement` (text)
|
|
1360
|
+
- `subject` (text)
|
|
1361
|
+
|
|
1362
|
+
```
|
|
1363
|
+
"/\s+/"|regex_replace:"-":"Hello World" // "Hello-World"
|
|
1364
|
+
```
|
|
1365
|
+
|
|
1366
|
+
## Manipulation Filters
|
|
1367
|
+
|
|
1368
|
+
### `set`
|
|
1369
|
+
|
|
1370
|
+
`any | any[] → any` — Sets a value at the path within the object and returns the updated object
|
|
1371
|
+
|
|
1372
|
+
Args:
|
|
1373
|
+
- `path` (text)
|
|
1374
|
+
- `value` (any)
|
|
1375
|
+
|
|
1376
|
+
```
|
|
1377
|
+
{"fizz":"buzz"}|set:"foo":"bar" // {"fizz": "buzz","foo":"bar"}
|
|
1378
|
+
```
|
|
1379
|
+
|
|
1380
|
+
### `set_conditional`
|
|
1381
|
+
|
|
1382
|
+
`any | any[] → any` — Sets a value at the path within the object and returns the updated object, if the conditional expression is true
|
|
1383
|
+
|
|
1384
|
+
Args:
|
|
1385
|
+
- `path` (text)
|
|
1386
|
+
- `value` (any)
|
|
1387
|
+
- `conditional` (any)
|
|
1388
|
+
|
|
1389
|
+
```
|
|
1390
|
+
{'fizz':'buzz'}|set_conditional:'foo':'bar':2==1+1 // {'fizz':'buzz','foo':'bar'}
|
|
1391
|
+
```
|
|
1392
|
+
|
|
1393
|
+
### `set_ifnotempty`
|
|
1394
|
+
|
|
1395
|
+
`any | any[] → any` — Sets a value (if it is not empty: "", null, 0, "0", false, [], {}) at the path within the object and returns the updated object
|
|
1396
|
+
|
|
1397
|
+
Args:
|
|
1398
|
+
- `path` (text)
|
|
1399
|
+
- `value` (any)
|
|
1400
|
+
|
|
1401
|
+
```
|
|
1402
|
+
{'fizz':'buzz'}|set_ifnotempty:'foo':'bar' // {'fizz':'buzz','foo':'bar'}
|
|
1403
|
+
```
|
|
1404
|
+
|
|
1405
|
+
### `set_ifnotnull`
|
|
1406
|
+
|
|
1407
|
+
`any | any[] → any` — Sets a value (if it is not null) at the path within the object and returns the updated object
|
|
1408
|
+
|
|
1409
|
+
Args:
|
|
1410
|
+
- `path` (text)
|
|
1411
|
+
- `value` (any)
|
|
1412
|
+
|
|
1413
|
+
```
|
|
1414
|
+
{'fizz':'buzz'}|set_ifnotnull:'foo':'bar' // {'fizz':'buzz','foo':'bar'}
|
|
1415
|
+
```
|
|
1416
|
+
|
|
1417
|
+
### `first_notnull`
|
|
1418
|
+
|
|
1419
|
+
`any | any[] → any` — Returns the first value that is not null
|
|
1420
|
+
|
|
1421
|
+
Args:
|
|
1422
|
+
- `value` (any)
|
|
1423
|
+
|
|
1424
|
+
```
|
|
1425
|
+
null|first_notnull:0 // 0
|
|
1426
|
+
```
|
|
1427
|
+
|
|
1428
|
+
### `first_notempty`
|
|
1429
|
+
|
|
1430
|
+
`any | any[] → any` — Returns the first value that is not empty - i.e. not ("", null, 0, "0", false, [], {})
|
|
1431
|
+
|
|
1432
|
+
Args:
|
|
1433
|
+
- `value` (any)
|
|
1434
|
+
|
|
1435
|
+
```
|
|
1436
|
+
""|first_notempty:1 // 1
|
|
1437
|
+
```
|
|
1438
|
+
|
|
1439
|
+
### `unset`
|
|
1440
|
+
|
|
1441
|
+
`any | any[] → any` — Removes a value at the path within the object and returns the updated object
|
|
1442
|
+
|
|
1443
|
+
Args:
|
|
1444
|
+
- `path` (text)
|
|
1445
|
+
|
|
1446
|
+
```
|
|
1447
|
+
{'fizz':'buzz','foo':'bar'}|unset:'foo' // {'fizz':'buzz'}
|
|
1448
|
+
```
|
|
1449
|
+
|
|
1450
|
+
### `transform`
|
|
1451
|
+
|
|
1452
|
+
`any | any[] → any` — Processes an expression with local data bound to the $$ variable
|
|
1453
|
+
|
|
1454
|
+
Args:
|
|
1455
|
+
- `expression` (text)
|
|
1456
|
+
|
|
1457
|
+
```
|
|
1458
|
+
2|transform:$$+3 // 5
|
|
1459
|
+
```
|
|
1460
|
+
|
|
1461
|
+
### `get`
|
|
1462
|
+
|
|
1463
|
+
`any | any[] → any` — Returns the value of an object at the specified path
|
|
1464
|
+
|
|
1465
|
+
Args:
|
|
1466
|
+
- `path` (text)
|
|
1467
|
+
- `default` (json, default `null`) — the default is used if no value is found at the path
|
|
1468
|
+
|
|
1469
|
+
```
|
|
1470
|
+
{'fizz':'buzz'}|get:'fizz' // "buzz"
|
|
1471
|
+
```
|
|
1472
|
+
|
|
1473
|
+
### `has`
|
|
1474
|
+
|
|
1475
|
+
`any | any[] → bool` — Returns the existence of whether or not something is present in the object at the specified path
|
|
1476
|
+
|
|
1477
|
+
Args:
|
|
1478
|
+
- `path` (text)
|
|
1479
|
+
|
|
1480
|
+
```
|
|
1481
|
+
{'fizz':'buzz'}|has:'fizz' // true
|
|
1482
|
+
```
|
|
1483
|
+
|
|
1484
|
+
### `fill` (alias `array_fill`)
|
|
1485
|
+
|
|
1486
|
+
`any → any[]` — Create an array of a certain size with a default value.
|
|
1487
|
+
|
|
1488
|
+
Args:
|
|
1489
|
+
- `start` (int, default `0`) — the starting index of the array.
|
|
1490
|
+
- `count` (int) — the number of entries within the array.
|
|
1491
|
+
|
|
1492
|
+
```
|
|
1493
|
+
"v"|array_fill:0:6 // ["v","v","v","v","v","v"]
|
|
1494
|
+
```
|
|
1495
|
+
|
|
1496
|
+
### `fill_keys` (alias `array_fill_keys`)
|
|
1497
|
+
|
|
1498
|
+
`any → any[]` — Create an array of keys with a default value.
|
|
1499
|
+
|
|
1500
|
+
Args:
|
|
1501
|
+
- `keys` (any[], default `[]`) — an array of keys.
|
|
1502
|
+
|
|
1503
|
+
```
|
|
1504
|
+
key|array_fill_keys:["a","b","c"] // {"a":"key","b":"key","c":"key"}
|
|
1505
|
+
```
|
|
1506
|
+
|
|
1507
|
+
## Transform Filters
|
|
1508
|
+
|
|
1509
|
+
### `to_expr`
|
|
1510
|
+
|
|
1511
|
+
`any → any` — Converts text into an expression, processes it, and returns the result
|
|
1512
|
+
|
|
1513
|
+
```
|
|
1514
|
+
"(2 + 1) % 2"|to_expr // 1
|
|
1515
|
+
```
|
|
1516
|
+
|
|
1517
|
+
### `to_text`
|
|
1518
|
+
|
|
1519
|
+
`int | decimal | bool → text` — Converts integer, decimal, or bool types to text and returns the result
|
|
1520
|
+
|
|
1521
|
+
```
|
|
1522
|
+
1.344|to_text // "1.344"
|
|
1523
|
+
```
|
|
1524
|
+
|
|
1525
|
+
### `to_int`
|
|
1526
|
+
|
|
1527
|
+
`text | decimal | bool → int` — Converts text, decimal, or bool types to an integer and returns the result
|
|
1528
|
+
|
|
1529
|
+
```
|
|
1530
|
+
"133.45 kg"|to_int // 133
|
|
1531
|
+
```
|
|
1532
|
+
|
|
1533
|
+
### `to_decimal`
|
|
1534
|
+
|
|
1535
|
+
`text | int | bool → decimal` — Converts text, integer, or bool types to a decimal and returns the result
|
|
1536
|
+
|
|
1537
|
+
```
|
|
1538
|
+
"133.45 kg"|to_decimal // 133.45
|
|
1539
|
+
```
|
|
1540
|
+
|
|
1541
|
+
### `to_bool`
|
|
1542
|
+
|
|
1543
|
+
`text | int | decimal → bool` — Converts text, integer, or decimal types to a bool and returns the result
|
|
1544
|
+
|
|
1545
|
+
```
|
|
1546
|
+
"true"|to_bool // true
|
|
1547
|
+
```
|
|
1548
|
+
|
|
1549
|
+
### `to_timestamp` (alias `to_epochms`)
|
|
1550
|
+
|
|
1551
|
+
`text | int → epochms` — Converts a text expression (now, next friday, Jan 1 2000) to timestamp compatible format.
|
|
1552
|
+
|
|
1553
|
+
Args:
|
|
1554
|
+
- `timezone` (text, default `"UTC"`) — the timezone - E.g. UTC, America/Los_Angeles, Australia/Sydney
|
|
1555
|
+
|
|
1556
|
+
```
|
|
1557
|
+
"next friday"|to_timestamp:"America/Los_Angeles" // 1758265200000
|
|
1558
|
+
```
|
|
1559
|
+
|
|
1560
|
+
### `to_ms` (alias `to_epoch_ms`)
|
|
1561
|
+
|
|
1562
|
+
`text | int → int` — Converts a text expression (now, next friday, Jan 1 2000) to the number of milliseconds since the unix epoch.
|
|
1563
|
+
|
|
1564
|
+
Args:
|
|
1565
|
+
- `timezone` (text, default `"UTC"`) — the timezone - E.g. UTC, America/Los_Angeles, Australia/Sydney
|
|
1566
|
+
|
|
1567
|
+
```
|
|
1568
|
+
"next friday"|to_ms:"America/Los_Angeles" // 1758265200000
|
|
1569
|
+
```
|
|
1570
|
+
|
|
1571
|
+
### `to_seconds` (alias `to_epoch_sec`)
|
|
1572
|
+
|
|
1573
|
+
`text | int → int` — Converts a text expression (now, next friday, Jan 1 2000) to the number of seconds since the unix epoch.
|
|
1574
|
+
|
|
1575
|
+
Args:
|
|
1576
|
+
- `timezone` (text, default `"UTC"`) — the timezone - E.g. UTC, America/Los_Angeles, Australia/Sydney
|
|
1577
|
+
|
|
1578
|
+
```
|
|
1579
|
+
"next friday"|to_seconds:"America/Los_Angeles" // 1758265200
|
|
1580
|
+
```
|
|
1581
|
+
|
|
1582
|
+
### `to_minutes` (alias `to_epoch_minute`)
|
|
1583
|
+
|
|
1584
|
+
`text | int → int` — Converts a text expression (now, next friday, Jan 1 2000) to the number of minutes since the unix epoch.
|
|
1585
|
+
|
|
1586
|
+
Args:
|
|
1587
|
+
- `timezone` (text, default `"UTC"`) — the timezone - E.g. UTC, America/Los_Angeles, Australia/Sydney
|
|
1588
|
+
|
|
1589
|
+
```
|
|
1590
|
+
"next friday"|to_minutes:"America/Los_Angeles" // 29304420
|
|
1591
|
+
```
|
|
1592
|
+
|
|
1593
|
+
### `to_hours` (alias `to_epoch_hour`)
|
|
1594
|
+
|
|
1595
|
+
`text | int → int` — Converts a text expression (now, next friday, Jan 1 2000) to the number of hours since the unix epoch.
|
|
1596
|
+
|
|
1597
|
+
Args:
|
|
1598
|
+
- `timezone` (text, default `"UTC"`) — the timezone - E.g. UTC, America/Los_Angeles, Australia/Sydney
|
|
1599
|
+
|
|
1600
|
+
```
|
|
1601
|
+
"next friday"|to_hours:"America/Los_Angeles" // 488407
|
|
1602
|
+
```
|
|
1603
|
+
|
|
1604
|
+
### `to_days` (alias `to_epoch_day`)
|
|
1605
|
+
|
|
1606
|
+
`text | int → int` — Converts a text expression (now, next friday, Jan 1 2000) to the number of days since the unix epoch.
|
|
1607
|
+
|
|
1608
|
+
Args:
|
|
1609
|
+
- `timezone` (text, default `"UTC"`) — the timezone - E.g. UTC, America/Los_Angeles, Australia/Sydney
|
|
1610
|
+
|
|
1611
|
+
```
|
|
1612
|
+
"next friday"|to_days:"America/Los_Angeles" // 20350
|
|
1613
|
+
```
|
|
1614
|
+
|
|
1615
|
+
### `create_object`
|
|
1616
|
+
|
|
1617
|
+
`<T>[] → any` — Creates an object based on a list of keys and a list of values
|
|
1618
|
+
|
|
1619
|
+
Args:
|
|
1620
|
+
- `values` (<T>[], default `[]`) — a list of values
|
|
1621
|
+
|
|
1622
|
+
```
|
|
1623
|
+
["a","b","c"]|create_object:[1,2,3] // {"a":1,"b":2,"c":3}
|
|
1624
|
+
```
|
|
1625
|
+
|
|
1626
|
+
### `create_object_from_entries`
|
|
1627
|
+
|
|
1628
|
+
`<T>[] → any` — Creates an object based on an array of key/value pairs. (i.e. same result as the entries filter)
|
|
1629
|
+
|
|
1630
|
+
```
|
|
1631
|
+
[{key:"a",value:1},{key:"b",value:2},{key:"c",value:3}]|create_object_from_entries // {"a":1,"b":2,"c":3}
|
|
1632
|
+
```
|
|
1633
|
+
|
|
1634
|
+
### `json_decode`
|
|
1635
|
+
|
|
1636
|
+
`text | int | decimal | bool → any` — Decodes the value represented as json and returns the result
|
|
1637
|
+
|
|
1638
|
+
```
|
|
1639
|
+
"{\"a\":1,\"b\":2,\"c\":3}"|json_decode // {"a":1,"b":2,"c":3}
|
|
1640
|
+
```
|
|
1641
|
+
|
|
1642
|
+
### `json_encode`
|
|
1643
|
+
|
|
1644
|
+
`<T> → text` — Encodes the value and returns the result as json text
|
|
1645
|
+
|
|
1646
|
+
```
|
|
1647
|
+
{"a":1,"b":2,"c":3}|json_encode // "{\"a\":1,\"b\":2,\"c\":3}"
|
|
1648
|
+
```
|
|
1649
|
+
|
|
1650
|
+
### `xml_decode`
|
|
1651
|
+
|
|
1652
|
+
`text → any` — Decodes XML and returns the result
|
|
1653
|
+
|
|
1654
|
+
```
|
|
1655
|
+
"<root><a>1</a><b>2</b><c>3</c></root>"|xml_decode // {
|
|
1656
|
+
"root": {
|
|
1657
|
+
"@attributes": [],
|
|
1658
|
+
"value": [
|
|
1659
|
+
{
|
|
1660
|
+
"a": {
|
|
1661
|
+
"@attributes": [],
|
|
1662
|
+
"value": "1"
|
|
1663
|
+
}
|
|
1664
|
+
},
|
|
1665
|
+
{
|
|
1666
|
+
"b": {
|
|
1667
|
+
"@attributes": [],
|
|
1668
|
+
"value": "2"
|
|
1669
|
+
}
|
|
1670
|
+
}
|
|
1671
|
+
]
|
|
1672
|
+
}
|
|
1673
|
+
}
|
|
1674
|
+
```
|
|
1675
|
+
|
|
1676
|
+
### `csv_parse`
|
|
1677
|
+
|
|
1678
|
+
`text → any` — Parse the contents of a CSV file and convert it into an array of objects.
|
|
1679
|
+
|
|
1680
|
+
Args:
|
|
1681
|
+
- `separator` (text, default `","`) — the field deliminator - one character only (i.e. a comma)
|
|
1682
|
+
- `enclosure` (text, default `"\""`) — the field enclosure - one character only (i.e. a quotation mark)
|
|
1683
|
+
- `escape` (text, default `"\""`) — the escape value - used to allow using the enclosure field within the field
|
|
1684
|
+
|
|
1685
|
+
### `csv_decode`
|
|
1686
|
+
|
|
1687
|
+
`text → any` — Decodes the value represented in the CSV format and returns the result
|
|
1688
|
+
|
|
1689
|
+
Args:
|
|
1690
|
+
- `separator` (text, default `","`) — the field deliminator - one character only (i.e. a comma)
|
|
1691
|
+
- `enclosure` (text, default `"\""`) — the field enclosure - one character only (i.e. a quotation mark)
|
|
1692
|
+
- `escape` (text, default `"\""`) — the escape value - used to allow using the enclosure field within the field
|
|
1693
|
+
|
|
1694
|
+
### `csv_encode`
|
|
1695
|
+
|
|
1696
|
+
`<T> → text` — Encodes the value and returns the result in CSV format
|
|
1697
|
+
|
|
1698
|
+
Args:
|
|
1699
|
+
- `separator` (text, default `","`) — the field deliminator - one character only (i.e. a comma)
|
|
1700
|
+
- `enclosure` (text, default `"\""`) — the field enclosure - one character only (i.e. a quotation mark)
|
|
1701
|
+
- `escape` (text, default `"\""`) — the escape value - used to allow using the enclosure field within the field
|
|
1702
|
+
|
|
1703
|
+
### `csv_create`
|
|
1704
|
+
|
|
1705
|
+
`<T>[] → text` — Creates a CSV format data stream from a list of column names and their corresponding data rows.
|
|
1706
|
+
|
|
1707
|
+
Args:
|
|
1708
|
+
- `rows` (text[]) — your rows of data
|
|
1709
|
+
- `separator` (text, default `","`) — the field deliminator - one character only (i.e. a comma)
|
|
1710
|
+
- `enclosure` (text, default `"\""`) — the field enclosure - one character only (i.e. a quotation mark)
|
|
1711
|
+
- `escape` (text, default `"\""`) — the escape value - used to allow using the enclosure field within the field
|
|
1712
|
+
|
|
1713
|
+
### `url_decode`
|
|
1714
|
+
|
|
1715
|
+
`text → text` — Decodes the value represented as a url encoded value
|
|
1716
|
+
|
|
1717
|
+
```
|
|
1718
|
+
"Hello%2C%20World%21"|url_decode // "Hello, World!"
|
|
1719
|
+
```
|
|
1720
|
+
|
|
1721
|
+
### `url_decode_rfc3986`
|
|
1722
|
+
|
|
1723
|
+
`text → text` — Decodes the value represented as a url encoded value using the RFC 3986 specification
|
|
1724
|
+
|
|
1725
|
+
```
|
|
1726
|
+
"Hello%2C%20World%21"|url_decode_rfc3986 // "Hello, World!"
|
|
1727
|
+
```
|
|
1728
|
+
|
|
1729
|
+
### `url_encode`
|
|
1730
|
+
|
|
1731
|
+
`text → text` — Encodes the value and returns the result as a url encoded value
|
|
1732
|
+
|
|
1733
|
+
```
|
|
1734
|
+
"Hello, World!"|url_encode // "Hello%2C%20World%21"
|
|
1735
|
+
```
|
|
1736
|
+
|
|
1737
|
+
### `url_encode_rfc3986`
|
|
1738
|
+
|
|
1739
|
+
`text → text` — Encodes the value and returns the result as a url encoded value using the RFC 3986 specification
|
|
1740
|
+
|
|
1741
|
+
```
|
|
1742
|
+
"Hello, World!"|url_encode_rfc3986 // "Hello%2C%20World%21"
|
|
1743
|
+
```
|
|
1744
|
+
|
|
1745
|
+
### `yaml_decode`
|
|
1746
|
+
|
|
1747
|
+
`text | int | decimal | bool → obj` — Decodes the value represented as yaml and returns the result
|
|
1748
|
+
|
|
1749
|
+
```
|
|
1750
|
+
"a: 1\nb: 2\nc: 3"|yaml_decode // {"a":1,"b":2,"c":3}
|
|
1751
|
+
```
|
|
1752
|
+
|
|
1753
|
+
### `yaml_encode`
|
|
1754
|
+
|
|
1755
|
+
`<T> → text` — Encodes the value and returns the result as yaml text
|
|
1756
|
+
|
|
1757
|
+
```
|
|
1758
|
+
{"a":1,"b":2,"c":3}|yaml_encode // "a: 1\nb: 2\nc: 3\n"
|
|
1759
|
+
```
|
|
1760
|
+
|
|
1761
|
+
### `hex2bin`
|
|
1762
|
+
|
|
1763
|
+
`text → text` — Converts a hex value into its binary equivalent
|
|
1764
|
+
|
|
1765
|
+
```
|
|
1766
|
+
"68656c6c6f"|hex2bin // "hello"
|
|
1767
|
+
```
|
|
1768
|
+
|
|
1769
|
+
### `bin2hex`
|
|
1770
|
+
|
|
1771
|
+
`text → text` — Converts a binary value into its hex equivalent
|
|
1772
|
+
|
|
1773
|
+
```
|
|
1774
|
+
"hello"|bin2hex // "68656c6c6f"
|
|
1775
|
+
```
|
|
1776
|
+
|
|
1777
|
+
### `dechex`
|
|
1778
|
+
|
|
1779
|
+
`text → text` — Converts a decimal value into its hex equivalent
|
|
1780
|
+
|
|
1781
|
+
```
|
|
1782
|
+
"255"|dechex // "ff"
|
|
1783
|
+
```
|
|
1784
|
+
|
|
1785
|
+
### `hexdec`
|
|
1786
|
+
|
|
1787
|
+
`text → text` — Converts a hex value into its decimal equivalent
|
|
1788
|
+
|
|
1789
|
+
```
|
|
1790
|
+
"ff"|hexdec // "255"
|
|
1791
|
+
```
|
|
1792
|
+
|
|
1793
|
+
### `decbin`
|
|
1794
|
+
|
|
1795
|
+
`text → text` — Converts a decimal value into its binary string (i.e. 01010) equivalent
|
|
1796
|
+
|
|
1797
|
+
```
|
|
1798
|
+
"10"|decbin // "1010"
|
|
1799
|
+
```
|
|
1800
|
+
|
|
1801
|
+
### `bindec`
|
|
1802
|
+
|
|
1803
|
+
`text → text` — Converts a binary string (i.e. 01010) into its decimal equivalent
|
|
1804
|
+
|
|
1805
|
+
```
|
|
1806
|
+
"1010"|bindec // "10"
|
|
1807
|
+
```
|
|
1808
|
+
|
|
1809
|
+
### `decoct`
|
|
1810
|
+
|
|
1811
|
+
`text → text` — Converts a decimal value into its octal equivalent
|
|
1812
|
+
|
|
1813
|
+
```
|
|
1814
|
+
"10"|decoct // "12"
|
|
1815
|
+
```
|
|
1816
|
+
|
|
1817
|
+
### `octdec`
|
|
1818
|
+
|
|
1819
|
+
`text → text` — Converts an octal value into its decimal equivalent
|
|
1820
|
+
|
|
1821
|
+
```
|
|
1822
|
+
"12"|octdec // "10"
|
|
1823
|
+
```
|
|
1824
|
+
|
|
1825
|
+
### `base_convert`
|
|
1826
|
+
|
|
1827
|
+
`text → text` — Converts a value between two bases
|
|
1828
|
+
|
|
1829
|
+
Args:
|
|
1830
|
+
- `from_base` (any) — the base of the original value
|
|
1831
|
+
- `to_base` (any) — the base of the new converted value
|
|
1832
|
+
|
|
1833
|
+
```
|
|
1834
|
+
"ff"|base_convert:16:10 // "255"
|
|
1835
|
+
```
|
|
1836
|
+
|
|
1837
|
+
### `base64_decode`
|
|
1838
|
+
|
|
1839
|
+
`text → text` — Decodes the value represented as base64 text and returns the result
|
|
1840
|
+
|
|
1841
|
+
```
|
|
1842
|
+
"aGVsbG8="|base64_decode // "hello"
|
|
1843
|
+
```
|
|
1844
|
+
|
|
1845
|
+
### `base64_encode`
|
|
1846
|
+
|
|
1847
|
+
`text → text` — Encodes the value and returns the result as base64 text
|
|
1848
|
+
|
|
1849
|
+
```
|
|
1850
|
+
"hello"|base64_encode // "aGVsbG8="
|
|
1851
|
+
```
|
|
1852
|
+
|
|
1853
|
+
### `base64_decode_urlsafe`
|
|
1854
|
+
|
|
1855
|
+
`text → text` — Decodes the value represented as base64 urlsafe text and returns the result
|
|
1856
|
+
|
|
1857
|
+
```
|
|
1858
|
+
"aGVsbG8_"|base64_decode_urlsafe // "hello?"
|
|
1859
|
+
```
|
|
1860
|
+
|
|
1861
|
+
### `base64_encode_urlsafe`
|
|
1862
|
+
|
|
1863
|
+
`text → text` — Encodes the value and returns the result as base64 urlsafe text
|
|
1864
|
+
|
|
1865
|
+
```
|
|
1866
|
+
"hello?"|base64_encode_urlsafe // "aGVsbG8_"
|
|
1867
|
+
```
|
|
1868
|
+
|
|
1869
|
+
## Security Filters
|
|
1870
|
+
|
|
1871
|
+
### `encrypt`
|
|
1872
|
+
|
|
1873
|
+
`any → text` — Encrypts the value and returns the result in raw binary form.
|
|
1874
|
+
|
|
1875
|
+
Args:
|
|
1876
|
+
- `algorithm` (enum, default `"aes-128-cbc"`) — the algorithm used for encryption
|
|
1877
|
+
- `key` (text) — the key used for encryption
|
|
1878
|
+
- `iv` (text) — the initialization vector
|
|
1879
|
+
|
|
1880
|
+
```
|
|
1881
|
+
"hello"|encrypt:"aes-192-cbc":"1494AX6XJUsDe51kF9S9sA==":"27222b6032574bad" // "���Z �r|5���~�l"
|
|
1882
|
+
```
|
|
1883
|
+
|
|
1884
|
+
### `decrypt`
|
|
1885
|
+
|
|
1886
|
+
`any → text` — Decrypts the value and returns the result.
|
|
1887
|
+
|
|
1888
|
+
Args:
|
|
1889
|
+
- `algorithm` (enum, default `"aes-128-cbc"`) — the algorithm used for decryption
|
|
1890
|
+
- `key` (text) — the key used for decryption
|
|
1891
|
+
- `iv` (text) — the initialization vector
|
|
1892
|
+
|
|
1893
|
+
```
|
|
1894
|
+
"...encrypted..."|decrypt:"aes-192-cbc":"1494AX6XJUsDe51kF9S9sA==":"27222b6032574bad" // "hello"
|
|
1895
|
+
```
|
|
1896
|
+
|
|
1897
|
+
### `jws_encode` (alias `crypto_jws_encode`)
|
|
1898
|
+
|
|
1899
|
+
`any → text` — Encodes the value and return the result as a JWS token
|
|
1900
|
+
|
|
1901
|
+
Args:
|
|
1902
|
+
- `headers` (json) — optional; headers to include in the JWS token
|
|
1903
|
+
- `key` (json) — the key used for signing the JWS token
|
|
1904
|
+
- `algorithm` (enum, default `"HS256"`) — the algorithm used for calculating the signature
|
|
1905
|
+
- `ttl` (int, default `0`) — optional; the amount of time in seconds this token is valid - use 0 for no expiration.
|
|
1906
|
+
|
|
1907
|
+
```
|
|
1908
|
+
"hello"|jws_encode:{sub: "1234567890",name: "John Doe",admin: true,iat: 1516239022}:"a-string-secret-at-least-256-bits-long":HS256 // "...encrypted..."
|
|
1909
|
+
```
|
|
1910
|
+
|
|
1911
|
+
### `jws_decode` (alias `crypto_jws_decode`)
|
|
1912
|
+
|
|
1913
|
+
`any → json` — Decodes the JWS token and return the result
|
|
1914
|
+
|
|
1915
|
+
Args:
|
|
1916
|
+
- `check_claims` (json) — optional; claims to enforce
|
|
1917
|
+
- `key` (json) — the key used for verifying the authenticity of the JWS token
|
|
1918
|
+
- `algorithm` (enum, default `"HS256"`) — the algorithm used for calculating the signature
|
|
1919
|
+
- `timeDrift` (int, default `0`) — optional; if this token is time sensitive, then you can specify an allowable amount of time drift to be more tollerant of clocks not fully synchronized between servers.
|
|
1920
|
+
|
|
1921
|
+
```
|
|
1922
|
+
"eyJzd...ZYw"|jws_decode:{}:"a-string-secret-at-least-256-bits-long":HS256 // "hello"
|
|
1923
|
+
```
|
|
1924
|
+
|
|
1925
|
+
### `jwe_encode` (alias `crypto_jwe_encode`)
|
|
1926
|
+
|
|
1927
|
+
`any → text` — Encodes the value and return the result as a JWE token
|
|
1928
|
+
|
|
1929
|
+
Args:
|
|
1930
|
+
- `headers` (json) — optional; headers to include in the JWS token
|
|
1931
|
+
- `key` (json) — the key used for encrypting the JWE token
|
|
1932
|
+
- `key_algorithm` (enum, default `"A256KW"`) — the algorithm used for encrypting the key used for content encyption
|
|
1933
|
+
- `content_algorithm` (enum, default `"A256CBC-HS512"`) — the algorithm used for encrypting the content
|
|
1934
|
+
- `ttl` (int, default `0`) — optional; the amount of time in seconds this token is valid - use 0 for no expiration.
|
|
1935
|
+
|
|
1936
|
+
```
|
|
1937
|
+
"hello"|jwe_encode:{sub: "1234567890",name: "John Doe",admin: true,iat: 1516239022}:"a-string-secret-at-least-256-bits-long":"A256KW":"A256CBC-HS512" // "...encrypted..."
|
|
1938
|
+
```
|
|
1939
|
+
|
|
1940
|
+
### `jwe_decode` (alias `crypto_jwe_decode`)
|
|
1941
|
+
|
|
1942
|
+
`any → json` — Decodes the JWE token and return the result
|
|
1943
|
+
|
|
1944
|
+
Args:
|
|
1945
|
+
- `check_claims` (json) — optional; claims to enforce
|
|
1946
|
+
- `key` (json) — the key used for decrypting the key used for content decryption
|
|
1947
|
+
- `key_algorithm` (enum, default `"A256KW"`) — the algorithm used for encrypting the key
|
|
1948
|
+
- `content_algorithm` (enum, default `"A256CBC-HS512"`) — the algorithm used for encrypting the content
|
|
1949
|
+
- `timeDrift` (int, default `0`) — optional; if this token is time sensitive, then you can specify an allowable amount of time drift to be more tollerant of clocks not fully synchronized between servers.
|
|
1950
|
+
|
|
1951
|
+
```
|
|
1952
|
+
"eyJ...Xw"|jwe_decode:{}:"a-string-secret-at-least-256-bits-long":"A256KW":"A256CBC-HS512" // "hello"
|
|
1953
|
+
```
|
|
1954
|
+
|
|
1955
|
+
### `secureid_encode`
|
|
1956
|
+
|
|
1957
|
+
`int → text` — Returns an encrypted version of the id
|
|
1958
|
+
|
|
1959
|
+
Args:
|
|
1960
|
+
- `salt` (text) — an optional salt
|
|
1961
|
+
|
|
1962
|
+
```
|
|
1963
|
+
12345|secureid_encode:"my_salt" // "ZlV3Lg.-0-UZyQ9xQk"
|
|
1964
|
+
```
|
|
1965
|
+
|
|
1966
|
+
### `secureid_decode`
|
|
1967
|
+
|
|
1968
|
+
`text → int` — Returns the id of the original encode
|
|
1969
|
+
|
|
1970
|
+
Args:
|
|
1971
|
+
- `salt` (text) — the salt of the original encode
|
|
1972
|
+
|
|
1973
|
+
```
|
|
1974
|
+
"ZlV3Lg.-0-UZyQ9xQk"|secureid_decode:"my_salt" // 12345
|
|
1975
|
+
```
|
|
1976
|
+
|
|
1977
|
+
### `md5`
|
|
1978
|
+
|
|
1979
|
+
`text → text` — Returns a MD5 signature representation of the value
|
|
1980
|
+
|
|
1981
|
+
Args:
|
|
1982
|
+
- `raw` (bool, default `false`) — Unchecked will be a hex value. Checked will be a raw binary value.
|
|
1983
|
+
|
|
1984
|
+
```
|
|
1985
|
+
"some_message"|md5 // "af8a2aae147de3350f6c0f1a075ede5d"
|
|
1986
|
+
```
|
|
1987
|
+
|
|
1988
|
+
### `sha1`
|
|
1989
|
+
|
|
1990
|
+
`text → text` — Returns a SHA1 signature representation of the value
|
|
1991
|
+
|
|
1992
|
+
Args:
|
|
1993
|
+
- `raw` (bool, default `false`) — Unchecked will be a hex value. Checked will be a raw binary value.
|
|
1994
|
+
|
|
1995
|
+
```
|
|
1996
|
+
"some_message"|sha1 // "33a374032... (truncated) ..."
|
|
1997
|
+
```
|
|
1998
|
+
|
|
1999
|
+
### `sha256`
|
|
2000
|
+
|
|
2001
|
+
`text → text` — Returns a SHA256 signature representation of the value
|
|
2002
|
+
|
|
2003
|
+
Args:
|
|
2004
|
+
- `raw` (bool, default `false`) — Unchecked will be a hex value. Checked will be a raw binary value.
|
|
2005
|
+
|
|
2006
|
+
```
|
|
2007
|
+
"some_message"|sha256 // "6cc869f10009fa1... (truncated) ..."
|
|
2008
|
+
```
|
|
2009
|
+
|
|
2010
|
+
### `sha384`
|
|
2011
|
+
|
|
2012
|
+
`text → text` — Returns a SHA384 signature representation of the value
|
|
2013
|
+
|
|
2014
|
+
Args:
|
|
2015
|
+
- `raw` (bool, default `false`) — Unchecked will be a hex value. Checked will be a raw binary value.
|
|
2016
|
+
|
|
2017
|
+
```
|
|
2018
|
+
"some_message"|sha384 // "17a7717060650457... (truncated) ..."
|
|
2019
|
+
```
|
|
2020
|
+
|
|
2021
|
+
### `sha512`
|
|
2022
|
+
|
|
2023
|
+
`text → text` — Returns a SHA512 signature representation of the value
|
|
2024
|
+
|
|
2025
|
+
Args:
|
|
2026
|
+
- `raw` (bool, default `false`) — Unchecked will be a hex value. Checked will be a raw binary value.
|
|
2027
|
+
|
|
2028
|
+
```
|
|
2029
|
+
"some_message"|sha512 // "40aaa4e84e7d98e472d240f1c84298de... (truncated) ..."
|
|
2030
|
+
```
|
|
2031
|
+
|
|
2032
|
+
### `hmac_md5`
|
|
2033
|
+
|
|
2034
|
+
`text → text` — Returns a MD5 signature representation of the value using a shared secret via the HMAC method
|
|
2035
|
+
|
|
2036
|
+
Args:
|
|
2037
|
+
- `key` (text) — The shared secret
|
|
2038
|
+
- `raw` (bool, default `false`) — Unchecked will be a hex value. Checked will be a raw binary value.
|
|
2039
|
+
|
|
2040
|
+
```
|
|
2041
|
+
"some_message"|hmac_md5:MY_SECRET_KEY // "c4c1007ea935001cc7734b360395fb1d"
|
|
2042
|
+
```
|
|
2043
|
+
|
|
2044
|
+
### `hmac_sha1`
|
|
2045
|
+
|
|
2046
|
+
`text → text` — Returns a SHA1 signature representation of the value using a shared secret via the HMAC method
|
|
2047
|
+
|
|
2048
|
+
Args:
|
|
2049
|
+
- `key` (text) — The shared secret
|
|
2050
|
+
- `raw` (bool, default `false`) — Unchecked will be a hex value. Checked will be a raw binary value.
|
|
2051
|
+
|
|
2052
|
+
```
|
|
2053
|
+
"some_message"|hmac_sha1:MY_SECRET_KEY // "83b48df25eda2... (truncated) ..."
|
|
2054
|
+
```
|
|
2055
|
+
|
|
2056
|
+
### `hmac_sha256`
|
|
2057
|
+
|
|
2058
|
+
`text → text` — Returns a SHA256 signature representation of the value using a shared secret via the HMAC method
|
|
2059
|
+
|
|
2060
|
+
Args:
|
|
2061
|
+
- `key` (text) — The shared secret
|
|
2062
|
+
- `raw` (bool, default `false`) — Unchecked will be a hex value. Checked will be a raw binary value.
|
|
2063
|
+
|
|
2064
|
+
```
|
|
2065
|
+
"some_message"|hmac_sha256:MY_SECRET_KEY // "3e18fc78d5326e5... (truncated) ..."
|
|
2066
|
+
```
|
|
2067
|
+
|
|
2068
|
+
### `hmac_sha384`
|
|
2069
|
+
|
|
2070
|
+
`text → text` — Returns a SHA384 signature representation of the value using a shared secret via the HMAC method
|
|
2071
|
+
|
|
2072
|
+
Args:
|
|
2073
|
+
- `key` (text) — The shared secret
|
|
2074
|
+
- `raw` (bool, default `false`) — Unchecked will be a hex value. Checked will be a raw binary value.
|
|
2075
|
+
|
|
2076
|
+
```
|
|
2077
|
+
"some_message"|hmac_sha384:MY_SECRET_KEY // "60818f7b6e6... (truncated) ..."
|
|
2078
|
+
```
|
|
2079
|
+
|
|
2080
|
+
### `hmac_sha512`
|
|
2081
|
+
|
|
2082
|
+
`text → text` — Returns a SHA512 signature representation of the value using a shared secret via the HMAC method
|
|
2083
|
+
|
|
2084
|
+
Args:
|
|
2085
|
+
- `key` (text) — The shared secret
|
|
2086
|
+
- `raw` (bool, default `false`) — Unchecked will be a hex value. Checked will be a raw binary value.
|
|
2087
|
+
|
|
2088
|
+
```
|
|
2089
|
+
"some_message"|hmac_sha512:MY_SECRET_KEY // "880c17f6d5fa9e1ea3b7... (truncated) ..."
|
|
2090
|
+
```
|
|
2091
|
+
|
|
2092
|
+
### `uuid` (alias `uuid4`)
|
|
2093
|
+
|
|
2094
|
+
`any → text` — Returns a universally unique identifier
|
|
2095
|
+
|
|
2096
|
+
```
|
|
2097
|
+
|uuid4 // "550e8400-e29b-41d4-a716-446655440000"
|
|
2098
|
+
```
|
|
2099
|
+
|
|
2100
|
+
## Timestamp Filters
|
|
2101
|
+
|
|
2102
|
+
### `parse_timestamp` (alias `epochms_from_format`)
|
|
2103
|
+
|
|
2104
|
+
`int | text | epochms → text` — Parse a timestamp from a flexible format.
|
|
2105
|
+
|
|
2106
|
+
Args:
|
|
2107
|
+
- `format` (text) — the format of the timestamp
|
|
2108
|
+
- `timezone` (text, default `"UTC"`) — the timezone - E.g. UTC, America/Los_Angeles, Australia/Sydney
|
|
2109
|
+
|
|
2110
|
+
```
|
|
2111
|
+
"2023-08-15 13:45:30"|parse_timestamp:"Y-m-d H:i:s":"America/Los_Angeles" // "1692132330000"
|
|
2112
|
+
```
|
|
2113
|
+
|
|
2114
|
+
### `format_timestamp` (alias `epochms_date`)
|
|
2115
|
+
|
|
2116
|
+
`int | text | epochms → text` — Converts a timestamp into a human readable formatted date based on the supplied format
|
|
2117
|
+
|
|
2118
|
+
Args:
|
|
2119
|
+
- `format` (text) — the format of the resulting date text
|
|
2120
|
+
- `timezone` (text, default `"UTC"`) — the timezone - E.g. UTC, America/Los_Angeles, Australia/Sydney
|
|
2121
|
+
|
|
2122
|
+
```
|
|
2123
|
+
"1692132330000"|format_timestamp:"Y-m-d H:i:s":"America/New_York" // "2023-08-15 16:45:30"
|
|
2124
|
+
```
|
|
2125
|
+
|
|
2126
|
+
### `transform_timestamp` (alias `epochms_transform`)
|
|
2127
|
+
|
|
2128
|
+
`int | text | epochms → text` — Takes a timestamp and applies a relative transformation to it. Ex. -7 days, last Monday, first day of this month
|
|
2129
|
+
|
|
2130
|
+
Args:
|
|
2131
|
+
- `format` (text) — the format of the transformation
|
|
2132
|
+
- `timezone` (text, default `"UTC"`) — the timezone - E.g. UTC, America/Los_Angeles, Australia/Sydney
|
|
2133
|
+
|
|
2134
|
+
```
|
|
2135
|
+
"2023-08-15T20:45:30.000Z"|transform_timestamp:"-7 days":"America/Los_Angeles" // "1691527530000"
|
|
2136
|
+
```
|
|
2137
|
+
|
|
2138
|
+
### `add_secs_to_timestamp` (alias `epochms_add_secs`)
|
|
2139
|
+
|
|
2140
|
+
`epochms → epochms` — Add seconds to a timestamp. (negative values are ok)
|
|
2141
|
+
|
|
2142
|
+
Args:
|
|
2143
|
+
- `seconds` (int)
|
|
2144
|
+
|
|
2145
|
+
```
|
|
2146
|
+
1691527530000|add_secs_to_timestamp:60 // 1691527590000
|
|
2147
|
+
```
|
|
2148
|
+
|
|
2149
|
+
### `add_ms_to_timestamp` (alias `epochms_add_ms`)
|
|
2150
|
+
|
|
2151
|
+
`epochms → epochms` — Add milliseconds to a timestamp. (negative values are ok)
|
|
2152
|
+
|
|
2153
|
+
Args:
|
|
2154
|
+
- `milliseconds` (int)
|
|
2155
|
+
|
|
2156
|
+
```
|
|
2157
|
+
monday|add_ms_to_timestamp:500 // 1758499200500
|
|
2158
|
+
```
|
|
2159
|
+
|
|
2160
|
+
## Related Topics
|
|
2161
|
+
|
|
2162
|
+
| Topic | Use For |
|
|
2163
|
+
|-------|---------|
|
|
2164
|
+
| [expressions](xano_xanoscript_docs({ topic: "expressions" })) | The expression language itself: operators, `$$` filters, anchoring variables, `set` |
|
|
2165
|
+
| [syntax](xano_xanoscript_docs({ topic: "syntax" })) | XanoScript operators, filters, and backtick expression mode |
|
|
2166
|
+
| [syntax/array-filters](xano_xanoscript_docs({ topic: "syntax/array-filters" })) | Expression vs lambda (JS) higher-order filters |
|