From 8b41415b071225c8ff25cb7938ed19e258cc8827 Mon Sep 17 00:00:00 2001 From: Santiago Lapresta Date: Mon, 17 Feb 2014 04:01:32 +0100 Subject: Added `all` and `any` builtins --- builtin.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'builtin.c') diff --git a/builtin.c b/builtin.c index aac993db..ddf66d00 100644 --- a/builtin.c +++ b/builtin.c @@ -680,6 +680,8 @@ static const char* const jq_builtins[] = { "def rindex(i): .[i][-1:][0];", "def paths: path(recurse(if (type|. == \"array\" or . == \"object\") then .[] else empty end))|select(length > 0);", "def leaf_paths: . as $dot|paths|select(. as $p|$dot|getpath($p)|type|. != \"array\" and . != \"object\");", + "def any: reduce .[] as $i (false; . or $i);", + "def all: reduce .[] as $i (true; . and $i);", }; -- cgit v1.2.3