-
Notifications
You must be signed in to change notification settings - Fork 17
/
array_apply.json
95 lines (95 loc) · 3.51 KB
/
array_apply.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
{
"id": "array_apply",
"summary": "Apply a process to each array element",
"description": "Applies a process to each individual value in the array. This is basically what other languages call either a `for each` loop or a `map` function.",
"categories": [
"arrays"
],
"parameters": [
{
"name": "data",
"description": "An array.",
"schema": {
"type": "array",
"items": {
"description": "Any data type is allowed."
}
}
},
{
"name": "process",
"description": "A process that accepts and returns a single value and is applied on each individual value in the array. The process may consist of multiple sub-processes and could, for example, consist of processes such as ``absolute()`` or ``linear_scale_range()``.",
"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": "The value to be set in the new array.",
"schema": {
"description": "Any data type."
}
}
}
},
{
"name": "context",
"description": "Additional data to be passed to the process.",
"schema": {
"description": "Any data type."
},
"optional": true,
"default": null
}
],
"returns": {
"description": "An array with the newly computed values. The number of elements are the same as for the original array.",
"schema": {
"type": "array",
"items": {
"description": "Any data type is allowed."
}
}
}
}