mirror of
https://github.com/stedolan/jq.git
synced 2024-05-11 05:55:39 +00:00
#285 add and builtins
This commit is contained in:
@@ -678,6 +678,8 @@ static const char* const jq_builtins[] = {
|
||||
"def reverse: [.[length - 1 - range(0;length)]];",
|
||||
"def index(i): .[i][0];",
|
||||
"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\" or . == \"object\");",
|
||||
};
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user