Skip to content

refactor: rewrite get_query_strings with URLSearchParams#56

Merged
jacaudi merged 3 commits into
mainfrom
refactor/query-strings-rewrite
Apr 12, 2026
Merged

refactor: rewrite get_query_strings with URLSearchParams#56
jacaudi merged 3 commits into
mainfrom
refactor/query-strings-rewrite

Conversation

@jacaudi
Copy link
Copy Markdown
Owner

@jacaudi jacaudi commented Apr 12, 2026

Summary

  • Replace hand-rolled get_query_strings parser (broken closure, dead return_as_array branch) with a 9-line URLSearchParams-based implementation preserving all coercion semantics (empty/null/true/false/integer).
  • Add 11 table-driven unit tests covering every coercion branch, including the ?flag= edge case the old code got wrong.
  • Drop the dead false argument from the sole caller in init.js.

Test plan

  • docker run --rm -v $(pwd):/work -w /work node:22-alpine sh -c "node scripts/build.js && node --test app/tests/test-*.js" — 177/177 passing
  • No return_as_array references remain in src/
  • All callers use zero-arg get_query_strings()
  • ?flag= now correctly returns { flag: true } (previously { flag: '' })

🤖 Generated with Claude Code

@jacaudi jacaudi merged commit 7b6cd60 into main Apr 12, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant