From 5a863bf0103ccd82edf32cfe4c37ed92783a224d Mon Sep 17 00:00:00 2001 From: Nicolas Williams Date: Sun, 6 Jul 2014 03:24:29 -0500 Subject: Add `foreach` and `limit` --- builtin.c | 1 + 1 file changed, 1 insertion(+) (limited to 'builtin.c') diff --git a/builtin.c b/builtin.c index 6af99898..bda2c9ea 100644 --- a/builtin.c +++ b/builtin.c @@ -963,6 +963,7 @@ static const char* const jq_builtins[] = { " def _while: " " if cond then ., (update | _while) else empty end; " " _while;", + "def limit(n; exp): if n < 0 then exp else foreach exp as $item ([n, null]; if .[0] < 1 then empty else [.[0] -1, $item] end; .[1]) end;", }; #undef LIBM_DD -- cgit v1.2.3