Rewrite _assign/2 using $argument syntax

This commit is contained in:
Muh Muhten authored and Nico Williams committed 2019-02-20 20:12:52 -06:00
1 parent 85caac4473
commit 730c730940
1 file changed
+1 -1
+1 -1
View File
@@ -10,7 +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 _assign(paths; value): value as $v | reduce path(paths) as $p (.; setpath($p; $v));
def _assign(paths; $value): reduce path(paths) as $p (.; setpath($p; $value));
def _modify(paths; update): reduce path(paths) as $p (.; label $out | (setpath($p; getpath($p) | update) | ., break $out), delpaths([$p]));
def map_values(f): .[] |= f;