Hacker News new | past | comments | ask | show | jobs | submit login

It looks like they are also creating a "groupByToMap" for that reason. See: https://github.com/tc39/proposal-array-grouping

Property keys can also be symbol objects and it seems like that's supported by the groupBy function in addition to strings, see: https://tc39.es/proposal-array-grouping/




I wonder if groupBy should have had some sort of into argument. Otherwise, we may end up with four groupBy methods. groupBy, groupByToMap, groupByToWeakMap and groupByToRecord (should records land).

Edit: this has already been discussed https://github.com/tc39/proposal-array-grouping/issues/3


updated the post with groupByToMap, Thanks for pointing that out.


Ah fair enough!




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: