Closed itchyny closed 2 years ago
This PR fixes split/1 to work with empty string. This filter is semantically same as string division so I refactored not to duplicate code.
split/1
❯ jq -nc '"abc" | split("b", "")' ["a","c"] ["a","b","c"] ❯ jq -nc '"abc" / ("b", "")' ["a","c"] ["a","b","c"] ❯ xq -nc '"abc" | split("b", "")' ["a","c"] ["abc"] # oops! ❯ xq -nc '"abc" / ("b", "")' ["a","c"] ["a","b","c"] # ok! ❯ xq --version xq 0.2.9-f33b40cf049d2ef44a4fa0f75f92efc9255fda62
Looks good, thank you!
This PR fixes
split/1
to work with empty string. This filter is semantically same as string division so I refactored not to duplicate code.