Skip to content

Fix groupBy dropping __proto__ groups - #448

Open
yuxino wants to merge 1 commit into
antonmedv:masterfrom
yuxino:fix/group-by-prototype-key
Open

yuxino wants to merge 1 commit into
antonmedv:masterfrom
yuxino:fix/group-by-prototype-key

Conversation

@yuxino

@yuxino yuxino commented Nov 12, 2026

Copy link
Copy Markdown

groupBy silently drops items whose grouping value is __proto__, in both the Go and npm CLIs. For example:

echo '[{"key":"__proto__","id":1},{"key":"ok","id":2}]' | fx 'groupBy("key")'

This currently returns only the ok group. The fix preserves both groups by creating each group as an own data property, while keeping the existing object prototype.

Regression tests cover repeated __proto__ values with both field-name and callback selectors. Verified the Go and npm test suites, go vet, and the actual CLI output before and after the fix.

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