Skip to content
Myr

fix truncate_stream to match docs

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by J Phani Mahesh · committed by Nico Williams · parent 597c1f6 · Browse files · 1 file+1 added−1 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+1 added−1 removed

  • other:+1 added−1 removed

1 file+1 added−1 removed

modified:src/builtin.jq+1 added-1 removed
208 unmodified lines
209 explode | map( if 97 <= . and . <= 122 then . - 32 else . end) | implode;210211# Streaming utilities212def truncate_stream(stream):213 . as $n | null | stream | . as $input | if (.[0]|length) > $n then setpath([0];$input[0][1:]) else empty end;213 . as $n | null | stream | . as $input | if (.[0]|length) > $n then setpath([0];$input[0][$n:]) else empty end;214def fromstream(i):215 foreach i as $item (216 [null,false,null,false];217 if ($item[0]|length) == 0 then [null,false,.[2],.[3]]
89 unmodified lines