summaryrefslogtreecommitdiffstats
path: root/src/builtin.jq
diff options
context:
space:
mode:
Diffstat (limited to 'src/builtin.jq')
-rw-r--r--src/builtin.jq1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/builtin.jq b/src/builtin.jq
index 1432d993..1a5d1e94 100644
--- a/src/builtin.jq
+++ b/src/builtin.jq
@@ -168,6 +168,7 @@ def until(cond; next):
if cond then . else (next|_until) end;
_until;
def limit($n; exp): if $n < 0 then exp else label $out | foreach exp as $item ([$n, null]; if .[0] < 1 then break $out else [.[0] -1, $item] end; .[1]) end;
+def isempty(g): 0 == ((label $go | g | (1, break $go)) // 0);
def first(g): label $out | g | ., break $out;
def last(g): reduce g as $item (null; $item);
def nth($n; g): if $n < 0 then error("nth doesn't support negative indices") else last(limit($n + 1; g)) end;