Simple and efficient implementation of walk/1 (#2795)

This commit is contained in:
pkoppstein authored and GitHub committed 2023-08-01 07:54:21 +09:00
1 parent 0f80921268
commit 4d4c17ca6a
2 files changed
+27 -7

No files matched your search

+19
View File
@@ -1975,3 +1975,22 @@ implode|explode
map(try implode catch .)
[123,["a"],[nan]]
["implode input must be an array","string (\"a\") can't be imploded, unicode codepoint needs to be numeric","number (null) can't be imploded, unicode codepoint needs to be numeric"]
# walk
walk(.)
{"x":0}
{"x":0}
walk(1)
{"x":0}
1
# The following is a regression test, not a requirement:
[walk(.,1)]
{"x":0}
[{"x":0},1]
# Issue #2584
walk(select(IN({}, []) | not))
{"a":1,"b":[]}
{"a":1}