]> granicus.if.org Git - jq/commitdiff
fix truncate_stream to match docs
authorJ Phani Mahesh <github@phanimahesh.me>
Tue, 7 Feb 2017 08:44:29 +0000 (14:14 +0530)
committerNico Williams <nico@cryptonector.com>
Wed, 8 Feb 2017 03:30:55 +0000 (21:30 -0600)
src/builtin.jq

index f7c6e9b773837a680ceff6aa4db5db7dffa810c5..f01280a734a7cab02069450875d3fe63626aee57 100644 (file)
@@ -210,7 +210,7 @@ def ascii_upcase:
 
 # Streaming utilities
 def truncate_stream(stream):
-  . as $n | null | stream | . as $input | if (.[0]|length) > $n then setpath([0];$input[0][1:]) else empty end;
+  . as $n | null | stream | . as $input | if (.[0]|length) > $n then setpath([0];$input[0][$n:]) else empty end;
 def fromstream(i):
   foreach i as $item (
     [null,false,null,false];