SIGN IN SIGN UP

Fix jq to_entries on arrays and tonumber on empty strings (#384)

* Fix jq to_entries on arrays and tonumber on empty strings

Two silent divergences from real jq in the query engine:

- `to_entries` on an array returned `null`, so `to_entries[]` silently
  produced no output (exit 0). Real jq is keys_unsorted-based and yields
  numeric-key entries for arrays — and this engine's own `keys` builtin
  already supports arrays the same way.
- `tonumber` on `""` (or whitespace-only strings) returned 0 because
  `Number("")` is 0 in JS. Real jq errors; silently coercing empty cells
  to 0 masks data-quality problems in aggregations.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* Extract makeEntry helper for entry construction

The array branch made it the third copy of the same
Object.create(null) + safeSet key/value block (to_entries object path
and with_entries being the other two).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* Apply biome formatting to makeEntry signature

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* Drop explanatory comments; rationale lives in the PR description

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* Add changeset

* test(jq): cover entry limits and numeric whitespace boundaries

---------

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Co-authored-by: Hiroki Osame <hiroki.osame@gmail.com>
W
Wei Tao committed
e0cca16192e8ab62754b4272b7338467cc05ea92
Parent: d91dce8
Committed by GitHub <noreply@github.com> on 10/1/2026, 10:41:37 AM