diff options
Diffstat (limited to 'src/builtin.jq')
-rw-r--r-- | src/builtin.jq | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/builtin.jq b/src/builtin.jq index c6085552..0d42efd9 100644 --- a/src/builtin.jq +++ b/src/builtin.jq @@ -260,6 +260,12 @@ def walk(f): else f end; +# stream should be a stream of dot-paths +def pick(stream): + . as $in + | reduce path(stream) as $a (null; + setpath($a; $in|getpath($a)) ); + # SQL-ish operators here: def INDEX(stream; idx_expr): reduce stream as $row ({}; .[$row|idx_expr|tostring] = $row); |