builtin.jq: naive abs/0

manual.yml explains that the def is naive, and mentions fabs, etc.
This commit is contained in:
pkoppstein authored and Nico Williams committed 2023-07-25 23:43:57 -05:00
1 parent 3a1ba0c42d
commit 7b725378b9
5 files changed
+53

No files matched your search

+1
View File
@@ -10,6 +10,7 @@ def max_by(f): _max_by_impl(map([f]));
def min_by(f): _min_by_impl(map([f]));
def add: reduce .[] as $x (null; . + $x);
def del(f): delpaths([path(f)]);
def abs: if . < 0 then - . else . end;
def _assign(paths; $value): reduce path(paths) as $p (.; setpath($p; $value));
def _modify(paths; update):
reduce path(paths) as $p ([., []];