walk/1
This commit is contained in:
1 parent
c426d494f0
commit
16d0e528aa
2 files changed
+38
No files matched your search
@@ -1640,7 +1640,18 @@ static const char* const jq_builtins[] = {
|
||||
" else .[2]"
|
||||
" end"
|
||||
" end;",
|
||||
|
||||
// # Apply f to composite entities recursively, and to atoms
|
||||
"def walk(f):"
|
||||
" . as $in"
|
||||
" | if type == \"object\" then"
|
||||
" reduce keys[] as $key"
|
||||
" ( {}; . + { ($key): ($in[$key] | walk(f)) } ) | f"
|
||||
" elif type == \"array\" then map( walk(f) ) | f"
|
||||
" else f"
|
||||
" end;",
|
||||
};
|
||||
|
||||
#undef LIBM_DDD_NO
|
||||
#undef LIBM_DD_NO
|
||||
#undef LIBM_DDD
|
||||
|
||||
Reference in new issue
Block a user