from_entries is broken (fix #767)

This commit is contained in:
Nicolas Williams committed 2015-04-23 18:25:32 -05:00
1 parent 6906d291c5
commit fcfacb932d
1 file changed
+1 -1
+1 -1
View File
@@ -1258,7 +1258,7 @@ static const char* const jq_builtins[] = {
"def recurse_down: recurse;", "def recurse_down: recurse;",
"def to_entries: [keys_unsorted[] as $k | {key: $k, value: .[$k]}];", "def to_entries: [keys_unsorted[] as $k | {key: $k, value: .[$k]}];",
"def from_entries: map({(.key // .Key // .Name): (.value // .Value)}) | add | .//={};", "def from_entries: map({(.key // .Key // .Name): (if has(\"value\") then .value else .Value end)}) | add | .//={};",
"def with_entries(f): to_entries | map(f) | from_entries;", "def with_entries(f): to_entries | map(f) | from_entries;",
"def reverse: [.[length - 1 - range(0;length)]];", "def reverse: [.[length - 1 - range(0;length)]];",
"def indices($i): if type == \"array\" and ($i|type) == \"array\" then .[$i]" "def indices($i): if type == \"array\" and ($i|type) == \"array\" then .[$i]"