-
Notifications
You must be signed in to change notification settings - Fork 17
/
array_filter.json
96 lines (96 loc) · 3.51 KB
/
array_filter.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
{
"id": "array_filter",
"summary": "Filter an array based on a condition",
"description": "Filters the array elements based on a logical expression so that afterwards an array is returned that only contains the values, indices and/or labels conforming to the condition.",
"categories": [
"arrays",
"filter"
],
"parameters": [
{
"name": "data",
"description": "An array.",
"schema": {
"type": "array",
"items": {
"description": "Any data type is allowed."
}
}
},
{
"name": "condition",
"description": "A condition that is evaluated against each value, index and/or label in the array. Only the array elements for which the condition returns `true` are preserved.",
"schema": {
"type": "object",
"subtype": "process-graph",
"parameters": [
{
"name": "x",
"description": "The value of the current element being processed.",
"schema": {
"description": "Any data type."
}
},
{
"name": "index",
"description": "The zero-based index of the current element being processed.",
"schema": {
"type": "integer",
"minimum": 0
}
},
{
"name": "label",
"description": "The label of the current element being processed. Only populated for labeled arrays.",
"schema": [
{
"type": "number"
},
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"optional": true
},
{
"name": "context",
"description": "Additional data passed by the user.",
"schema": {
"description": "Any data type."
},
"optional": true,
"default": null
}
],
"returns": {
"description": "`true` if the value should be kept in the array, otherwise `false`.",
"schema": {
"type": "boolean"
}
}
}
},
{
"name": "context",
"description": "Additional data to be passed to the condition.",
"schema": {
"description": "Any data type."
},
"optional": true,
"default": null
}
],
"returns": {
"description": "An array filtered by the specified condition. The number of elements are less than or equal compared to the original array.",
"schema": {
"type": "array",
"items": {
"description": "Any data type is allowed."
}
}
}
}