summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoritchyny <itchyny@cybozu.co.jp>2023-07-07 22:26:25 +0900
committerNico Williams <nico@cryptonector.com>2023-07-07 10:53:40 -0500
commit0ecededefa242f36c09a8d90ea34e51e8834ed0d (patch)
tree4d5b7412af5425e50f1a44bc749458261d8e9c91
parent6944d81bc874da1ada15cbb340d020b32f9f90bd (diff)
Remove deprecated filters: leaf_paths, recurse_down
-rw-r--r--docs/content/manual/manual.yml11
-rw-r--r--src/builtin.jq2
-rw-r--r--tests/jq.test4
3 files changed, 2 insertions, 15 deletions
diff --git a/docs/content/manual/manual.yml b/docs/content/manual/manual.yml
index d7cceadd..1a82ec96 100644
--- a/docs/content/manual/manual.yml
+++ b/docs/content/manual/manual.yml
@@ -1141,7 +1141,7 @@ sections:
input: 'null'
output: ['"{\"file\":\"<top-level>\",\"line\":1}"']
- - title: "`paths`, `paths(node_filter)`, `leaf_paths`"
+ - title: "`paths`, `paths(node_filter)`"
body: |
`paths` outputs the paths to all the elements in its input
@@ -1152,9 +1152,6 @@ sections:
That is, `paths(numbers)` outputs the paths to all numeric
values.
- `leaf_paths` is an alias of `paths(scalars)`; `leaf_paths` is
- *deprecated* and will be removed in the next major release.
-
examples:
- program: '[paths]'
input: '[1,[[],{"a":2}]]'
@@ -1738,7 +1735,7 @@ sections:
output: ['24']
- - title: "`recurse(f)`, `recurse`, `recurse(f; condition)`, `recurse_down`"
+ - title: "`recurse(f)`, `recurse`, `recurse(f; condition)`"
body: |
The `recurse(f)` function allows you to search through a
@@ -1772,10 +1769,6 @@ sections:
to generate all the integers, at least in principle, one
could write `recurse(.+1; true)`.
- For legacy reasons, `recurse_down` exists as an alias to
- calling `recurse` without arguments. This alias is considered
- *deprecated* and will be removed in the next major release.
-
The recursive calls in `recurse` will not consume additional
memory whenever `f` produces at most a single output for each
input.
diff --git a/src/builtin.jq b/src/builtin.jq
index 483ddcc4..f9e5f1ea 100644
--- a/src/builtin.jq
+++ b/src/builtin.jq
@@ -36,7 +36,6 @@ def map_values(f): .[] |= f;
def recurse(f): def r: ., (f | r); r;
def recurse(f; cond): def r: ., (f | select(cond) | r); r;
def recurse: recurse(.[]?);
-def recurse_down: recurse;
def to_entries: [keys_unsorted[] as $k | {key: $k, value: .[$k]}];
def from_entries: map({(.key // .Key // .name // .Name): (if has("value") then .value else .Value end)}) | add | .//={};
@@ -62,7 +61,6 @@ def strings: select(type == "string");
def nulls: select(. == null);
def values: select(. != null);
def scalars: select(type|. != "array" and . != "object");
-def leaf_paths: paths(scalars);
def join($x): reduce .[] as $i (null;
(if .==null then "" else .+$x end) +
($i | if type=="boolean" or type=="number" then tostring else .//"" end)
diff --git a/tests/jq.test b/tests/jq.test
index 8a7ccc0e..308a4e6b 100644
--- a/tests/jq.test
+++ b/tests/jq.test
@@ -952,10 +952,6 @@ path(.a[path(.b)[0]])
[1,[[],{"a":2}]]
[[0],[1],[1,0],[1,1],[1,1,"a"]]
-[leaf_paths]
-[1,[[],{"a":2}]]
-[[0],[1,1,"a"]]
-
["foo",1] as $p | getpath($p), setpath($p; 20), delpaths([$p])
{"bar": 42, "foo": ["a", "b", "c", "d"]}
"b"