Skip to content

Commit

Permalink
funcs: Fix typo add count/0
Browse files Browse the repository at this point in the history
  • Loading branch information
wader committed Sep 12, 2021
1 parent a926c8f commit 96f7a75
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pkg/interp/funcs.jq
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ def chunk: chunk_by(.);
# same as group_by but counts
def count_by(exp):
group_by(exp) | map([(.[0] | exp), length]);
def count: count_by(.);

# helper to build path query/generate functions for tree structures with
# non-unique children, ex: mp4_path
Expand Down Expand Up @@ -211,7 +212,7 @@ def to_radix($base; $table):
def radix($base; $to_table; $from_table):
if . | type == "number" then to_radix($base; $to_table)
elif . | type == "string" then from_radix($base; $from_table)
else error("needs to be number of string")
else error("needs to be number or string")
end;

def radix2: radix(2; "01"; {"0": 0, "1": 1});
Expand Down

0 comments on commit 96f7a75

Please sign in to comment.