Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

revamp walk/1 #2655

Closed
wants to merge 62 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
eeb08b5
revamp walk/1
pkoppstein Jul 5, 2023
5152602
Increment nlocals when compiling STORE_GLOBAL ops (#2000)
wtlangford Jul 21, 2023
99a77f7
Add a regression test for #2000
itchyny Jul 21, 2023
7c2bf9b
Clarify the Docker image location (close #1864) (#2740)
itchyny Jul 21, 2023
3553a9d
manual.yml: some clarifications plus fixes for markdown bloopers (#2737)
pkoppstein Jul 21, 2023
4732dd8
Remove AppVeyor configuration (#2741)
itchyny Jul 21, 2023
3ed9289
Fail quickly if not in git repository in scripts/version
itchyny Jul 20, 2023
e0e1b22
Enable verbose output of make check
itchyny Jul 21, 2023
649d6b5
Update AUTHOR for the next release
itchyny Jul 22, 2023
c9c45d7
Add tests for --arg, --argjson, and similar options
itchyny Jul 22, 2023
9044f54
Validate manual schema
itchyny Jul 22, 2023
34629ed
Fix manual source code to follow the schema definition
itchyny Jul 22, 2023
5753722
Add importlib_resources dependency for older Python (fix #2753) (#2754)
itchyny Jul 23, 2023
99a381b
Improve --help to mention all the command options
itchyny Jul 22, 2023
123c780
Enable significand on macOS
itchyny Jul 23, 2023
f64ef1a
Fix --stream-errors w/o --stream, and doc+test (close #2748)
nicowilliams Jul 23, 2023
dfdce8c
Add checksum signature of old release artifacts (close #1999)
itchyny Jul 23, 2023
98f709d
Fix stderr to output string with no decoration (fix #2063)
itchyny Jul 23, 2023
1cf6515
Fix try/catch catches more than it should #1859
nicowilliams Jul 24, 2023
ed334b5
Improve manual in various ways (inputs, sort_by, foreach sections, et…
itchyny Jul 24, 2023
cf3c11b
Add compile fuzzer for OSS-Fuzz
DavidKorczynski Jul 24, 2023
8a4f246
Remove all #define _GNU_SOURCE in source files
emanuele6 Jul 24, 2023
97c6d28
Add fuzzer targeting load_file
DavidKorczynski Jul 24, 2023
16ae275
Fix leaks on invalid input for strftime, strflocaltime and mktime
wader Jul 24, 2023
4cc9983
Free expected value on invalid actual for test
wader Jul 24, 2023
54fef09
Make maintainer-mode default to disabled
wader Jul 24, 2023
c4d5ba9
Improve USE_DECNUM check position
itchyny Jul 23, 2023
5300fbd
Add decnum workflow to test building without decNumber support
itchyny Jul 23, 2023
2dbae56
Fix segmentation fault when using jq in threads
thalman Mar 1, 2023
cca0087
Test that jq works in threads
thalman Mar 9, 2023
3305596
Run autoconf -i in the Build step of the scanbuild workflow
emanuele6 Jul 24, 2023
8f49600
builtin.jq: simpler and faster transpose (#2758)
pkoppstein Jul 25, 2023
4705a22
Reorder the command line options in the manual (#2766)
itchyny Jul 25, 2023
bb8221e
Align prompt in help example
wader Jul 25, 2023
a29ac81
Remove deprecated --argfile option
itchyny Jul 25, 2023
a949745
implode: Better invalid input validation and handling
wader Jul 2, 2023
ae95864
Make sure to free default `@text` format on error
emanuele6 Jul 25, 2023
3a1ba0c
Only care about RS when parsing with --seq
emanuele6 Jul 25, 2023
7b72537
builtin.jq: naive abs/0
pkoppstein Jul 25, 2023
13fbe98
manual.yml: remove contingent tests
pkoppstein Jul 25, 2023
a1e791a
Rename --nul-output to --raw-output0, abort on string containing NUL
itchyny Jul 9, 2023
668607e
Enable gamma, drem on macOS
itchyny Jul 26, 2023
4160a36
Commit GPG signatures on release
itchyny Jul 27, 2023
72f147e
Fix release job to create a pull request for signatures
itchyny Jul 27, 2023
b33725c
Fix gh pr create option on release
itchyny Jul 28, 2023
5b9d075
Fix PR creation by specifying the branch on release
itchyny Jul 28, 2023
17889a1
Fix memory leak for { $foo: bar }
emanuele6 Jul 28, 2023
d319eb2
Fix PR creation by using fully qualified refname on release
itchyny Jul 28, 2023
086a156
Allow .[-1] in path expressions
nicowilliams Jul 16, 2023
336c3de
Test negative indices in path expressions
pkoppstein Jul 16, 2023
28af007
Replace NEWS with NEWS.md with more details and examples
wader Jun 2, 2023
70bbd10
NEWS.md: tweaks
pkoppstein Jul 28, 2023
ee2a215
Backfill with references in NEWS.md (#2788)
owenthereal Jul 29, 2023
a6eb055
Fix typo in manual: "-seq" => "--seq"
emanuele6 Jul 29, 2023
c8b30df
Add JQ_FALLTHROUGH and use it to quiet warnings
nicowilliams Jul 10, 2023
f733a15
Use -Wno-cast-function-type to quiet many warnings
nicowilliams Jul 10, 2023
82f7f77
Redirect questions to Discord
owenthereal Jul 29, 2023
4af3f99
Update `bug_report.md` with Discord link
owenthereal Jul 29, 2023
c8e28da
Redesign website (#2628)
itchyny Jul 31, 2023
bdec9c0
revamp walk/1
pkoppstein Jul 5, 2023
4665e81
revamp walk/1: rebase, add test cases
pkoppstein Jul 31, 2023
9afda0a
Merge branch 'walk' of https://github.com/pkoppstein/jq into walk
pkoppstein Jul 31, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 10 additions & 9 deletions src/builtin.jq
Original file line number Diff line number Diff line change
Expand Up @@ -249,17 +249,18 @@ def bsearch($target):
else .[2]
end
end;

#
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer this line to be an empty line rather than an empty comment.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, but someone should probably run: s/^# *$//

# Apply f to composite entities recursively, and to atoms
def walk(f):
. as $in
| if type == "object" then
reduce keys_unsorted[] as $key
( {}; . + { ($key): ($in[$key] | walk(f)) } ) | f
elif type == "array" then map( walk(f) ) | f
else f
end;

def w:
if type == "object"
then map_values(w)
elif type == "array" then map(w)
else .
end
| f;
w;
#
# SQL-ish operators here:
def INDEX(stream; idx_expr):
reduce stream as $row ({}; .[$row|idx_expr|tostring] = $row);
Expand Down
4 changes: 4 additions & 0 deletions tests/jq.test
Original file line number Diff line number Diff line change
Expand Up @@ -1744,3 +1744,7 @@ false
1
1

# Issue #2584
walk(select(IN({}, []) | not))
{"a":1,"b":[]}
{"a":1}