Added all and any builtins

This commit is contained in:
Santiago Lapresta committed 2014-02-17 04:01:32 +01:00
1 parent 1fa55a3fae
commit 8b41415b07
2 files changed
+42

No files matched your search

+2
View File
@@ -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);",
};