@xano/xanoscript-language-server 12.4.0 → 12.6.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/onHover/filters.md
CHANGED
|
@@ -2831,6 +2831,119 @@ Reduces the array to a single value using the code block to combine each element
|
|
|
2831
2831
|
|
|
2832
2832
|
Result: `25`
|
|
2833
2833
|
|
|
2834
|
+
# lambda_map
|
|
2835
|
+
|
|
2836
|
+
Like `map`, but the transform is written as a string of JS/TS code instead of an inline XanoScript expression. An optional final argument sets a timeout (in seconds).
|
|
2837
|
+
|
|
2838
|
+
```xs
|
|
2839
|
+
[1,2,3]|lambda_map:"return $this * 2":10
|
|
2840
|
+
```
|
|
2841
|
+
|
|
2842
|
+
Result: `[2,4,6]`
|
|
2843
|
+
|
|
2844
|
+
Context variables:
|
|
2845
|
+
|
|
2846
|
+
- `$this` - the element of the array being processed.
|
|
2847
|
+
- `$index` - the numerical index of the element of the array being processed.
|
|
2848
|
+
- `$parent` - the entire array with all of its elements.
|
|
2849
|
+
|
|
2850
|
+
# lambda_filter
|
|
2851
|
+
|
|
2852
|
+
Like `filter`, but the predicate is written as a string of JS/TS code. Return a truthy value to keep the element. An optional final argument sets a timeout (in seconds).
|
|
2853
|
+
|
|
2854
|
+
```xs
|
|
2855
|
+
[1,2,3,4]|lambda_filter:"return $this % 2":10
|
|
2856
|
+
```
|
|
2857
|
+
|
|
2858
|
+
Result: `[1,3]`
|
|
2859
|
+
|
|
2860
|
+
Context variables:
|
|
2861
|
+
|
|
2862
|
+
- `$this` - the element of the array being processed.
|
|
2863
|
+
- `$index` - the numerical index of the element of the array being processed.
|
|
2864
|
+
- `$parent` - the entire array with all of its elements.
|
|
2865
|
+
|
|
2866
|
+
# lambda_some
|
|
2867
|
+
|
|
2868
|
+
Like `some`, but the predicate is written as a string of JS/TS code. An optional final argument sets a timeout (in seconds).
|
|
2869
|
+
|
|
2870
|
+
```xs
|
|
2871
|
+
[1,2,3]|lambda_some:"return $this > 2":10
|
|
2872
|
+
```
|
|
2873
|
+
|
|
2874
|
+
Result: `true`
|
|
2875
|
+
|
|
2876
|
+
Context variables:
|
|
2877
|
+
|
|
2878
|
+
- `$this` - the element of the array being processed.
|
|
2879
|
+
- `$index` - the numerical index of the element of the array being processed.
|
|
2880
|
+
- `$parent` - the entire array with all of its elements.
|
|
2881
|
+
|
|
2882
|
+
# lambda_every
|
|
2883
|
+
|
|
2884
|
+
Like `every`, but the predicate is written as a string of JS/TS code. An optional final argument sets a timeout (in seconds).
|
|
2885
|
+
|
|
2886
|
+
```xs
|
|
2887
|
+
[2,4,6]|lambda_every:"return $this % 2 === 0":10
|
|
2888
|
+
```
|
|
2889
|
+
|
|
2890
|
+
Result: `true`
|
|
2891
|
+
|
|
2892
|
+
Context variables:
|
|
2893
|
+
|
|
2894
|
+
- `$this` - the element of the array being processed.
|
|
2895
|
+
- `$index` - the numerical index of the element of the array being processed.
|
|
2896
|
+
- `$parent` - the entire array with all of its elements.
|
|
2897
|
+
|
|
2898
|
+
# lambda_find
|
|
2899
|
+
|
|
2900
|
+
Like `find`, but the predicate is written as a string of JS/TS code. An optional final argument sets a timeout (in seconds).
|
|
2901
|
+
|
|
2902
|
+
```xs
|
|
2903
|
+
[1,2,3,8,9]|lambda_find:"return $this === 8":10
|
|
2904
|
+
```
|
|
2905
|
+
|
|
2906
|
+
Result: `8`
|
|
2907
|
+
|
|
2908
|
+
Context variables:
|
|
2909
|
+
|
|
2910
|
+
- `$this` - the element of the array being processed.
|
|
2911
|
+
- `$index` - the numerical index of the element of the array being processed.
|
|
2912
|
+
- `$parent` - the entire array with all of its elements.
|
|
2913
|
+
|
|
2914
|
+
# lambda_findIndex
|
|
2915
|
+
|
|
2916
|
+
Like `findIndex`, but the predicate is written as a string of JS/TS code. An optional final argument sets a timeout (in seconds).
|
|
2917
|
+
|
|
2918
|
+
```xs
|
|
2919
|
+
[1,2,3,8,9]|lambda_findIndex:"return $this === 8":10
|
|
2920
|
+
```
|
|
2921
|
+
|
|
2922
|
+
Result: `3`
|
|
2923
|
+
|
|
2924
|
+
Context variables:
|
|
2925
|
+
|
|
2926
|
+
- `$this` - the element of the array being processed.
|
|
2927
|
+
- `$index` - the numerical index of the element of the array being processed.
|
|
2928
|
+
- `$parent` - the entire array with all of its elements.
|
|
2929
|
+
|
|
2930
|
+
# lambda_reduce
|
|
2931
|
+
|
|
2932
|
+
Like `reduce`, but the reducer is written as a string of JS/TS code. Takes an initial value before the code block, and an optional final argument that sets a timeout (in seconds).
|
|
2933
|
+
|
|
2934
|
+
```xs
|
|
2935
|
+
[1,2,3,4,5]|lambda_reduce:[]:"return [...$result, $this + 1];":10
|
|
2936
|
+
```
|
|
2937
|
+
|
|
2938
|
+
Result: `[2,3,4,5,6]`
|
|
2939
|
+
|
|
2940
|
+
Context variables:
|
|
2941
|
+
|
|
2942
|
+
- `$this` - the element of the array being processed.
|
|
2943
|
+
- `$index` - the numerical index of the element of the array being processed.
|
|
2944
|
+
- `$parent` - the entire array with all of its elements.
|
|
2945
|
+
- `$result` - the result of the previous iteration, or the initial value on the first iteration.
|
|
2946
|
+
|
|
2834
2947
|
# pick
|
|
2835
2948
|
|
|
2836
2949
|
Pick keys from the object to create a new object of just those keys.
|
package/package.json
CHANGED
|
@@ -27,6 +27,7 @@ export function dbAddFn($) {
|
|
|
27
27
|
data: { "[string]": "[expression]" },
|
|
28
28
|
"description?": "[string]",
|
|
29
29
|
"disabled?": "[boolean]",
|
|
30
|
+
"enforce_hidden_fields?": "[boolean]",
|
|
30
31
|
"addon?": [addonSchema],
|
|
31
32
|
"mock?": { "![string]": "[expression]" },
|
|
32
33
|
"output?": ["[string]"],
|
|
@@ -31,6 +31,7 @@ export function dbEditFn($) {
|
|
|
31
31
|
data: { "[string]": "[expression]" },
|
|
32
32
|
"description?": "[string]",
|
|
33
33
|
"disabled?": "[boolean]",
|
|
34
|
+
"enforce_hidden_fields?": "[boolean]",
|
|
34
35
|
"output?": ["[string]"],
|
|
35
36
|
"addon?": [addonSchema],
|
|
36
37
|
"mock?": { "![string]": "[expression]" },
|
|
@@ -279,6 +279,17 @@ export const filterNames = [
|
|
|
279
279
|
"find",
|
|
280
280
|
"findIndex",
|
|
281
281
|
"reduce",
|
|
282
|
+
// Lambda variants of the array filters above. Instead of an inline XanoScript
|
|
283
|
+
// expression, they take a string of JS/TS code, e.g.
|
|
284
|
+
// $set|lambda_map:"return $this * 2"
|
|
285
|
+
// $set|lambda_reduce:[]:"return [...$result, $this + 1];":10
|
|
286
|
+
"lambda_map",
|
|
287
|
+
"lambda_filter",
|
|
288
|
+
"lambda_some",
|
|
289
|
+
"lambda_every",
|
|
290
|
+
"lambda_find",
|
|
291
|
+
"lambda_findIndex",
|
|
292
|
+
"lambda_reduce",
|
|
282
293
|
"pick",
|
|
283
294
|
"unpick",
|
|
284
295
|
"text_unescape",
|