summaryrefslogtreecommitdiffstats
path: root/builtin.c
diff options
context:
space:
mode:
authorNicolas Williams <nico@cryptonector.com>2015-01-13 18:57:35 -0600
committerNicolas Williams <nico@cryptonector.com>2015-01-14 01:32:25 -0600
commit97602456e32487d5fe5f7ecff3a0fddee8882d87 (patch)
tree2d0cf58e160fcbb7a87f87fcfc3240ee4919453f /builtin.c
parent8b5ff40402ab2d0f16f42207b0f475636483d288 (diff)
join/1: respect empty strings (fix #668)
Diffstat (limited to 'builtin.c')
-rw-r--r--builtin.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/builtin.c b/builtin.c
index 3a7a89c7..a9c64d8e 100644
--- a/builtin.c
+++ b/builtin.c
@@ -1065,7 +1065,7 @@ static const char* const jq_builtins[] = {
"def scalars: select(. == null or . == true or . == false or type == \"number\" or type == \"string\");",
"def scalars_or_empty: select(. == null or . == true or . == false or type == \"number\" or type == \"string\" or ((type==\"array\" or type==\"object\") and length==0));",
"def leaf_paths: paths(scalars);",
- "def join($x): reduce .[] as $i (\"\"; . + (if . == \"\" then $i else $x + $i end));",
+ "def join($x): reduce .[] as $i (null; (.//\"\") + (if . == null then $i else $x + $i end));",
"def flatten: reduce .[] as $i ([]; if $i | type == \"array\" then . + ($i | flatten) else . + [$i] end);",
"def flatten($x): reduce .[] as $i ([]; if $i | type == \"array\" and $x > 0 then . + ($i | flatten($x-1)) else . + [$i] end);",
"def range($x): range(0;$x);",