mirror of
https://github.com/wader/fq.git
synced 2024-11-27 06:04:47 +03:00
12 lines
368 B
Plaintext
12 lines
368 B
Plaintext
def _bencode_torepr:
|
|
if .type == "string" then .value | tovalue
|
|
elif .type == "integer" then .value | tovalue
|
|
elif .type == "list" then .values | map(_bencode_torepr)
|
|
elif .type == "dictionary" then
|
|
( .pairs
|
|
| map({key: (.key | _bencode_torepr), value: (.value | _bencode_torepr)})
|
|
| from_entries
|
|
)
|
|
else error("unknown type \(.type)")
|
|
end;
|