-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathj.cue
35 lines (34 loc) · 805 Bytes
/
j.cue
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
package jCue
#Patch: {
#Input: {...}
#Output: {
for k, v in #Input
let _is_list = bool & ((v & [...]) != _|_)
let _is_struct = bool & ((v & {...}) != _|_)
let _is_complex = bool & (_is_list || _is_struct) {
if !_is_complex {"\(k)": *v | _}
if _is_complex {
if _is_struct {
"\(k)": *{{#Patch & {#Input: v}}.#Output} | _
}
if _is_list {
"\(k)": {{#Patch & {#Input: v}}.#Output}
}
}
}, ...
}
} | {
#Input: [...]
#Output: [
for v in #Input
let _is_list = bool & ((v & [...]) != _|_)
let _is_struct = bool & ((v & {...}) != _|_)
let _is_complex = bool & (_is_list || _is_struct) {
if !_is_complex {*v | _}
if _is_complex {
if _is_struct {*{{#Patch & {#Input: v}}.#Output} | _}
if _is_list {{#Patch & {#Input: v}}.#Output}
}
},
]
}