Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upGitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
FIX: groupBy breaking under certain conditions #153
Conversation
Stronger type checking
Stronger type checking.
Stronger type checking. If the value of prop is something like "valueOf", or "watch", then by the previous logic, the elm wouldn't be grouped at all, since reult[prop] would be a function, and wouldn't have the property "push".
The "groupBy" function can be asked to group by property names such as "valueOf", or other properties implicitly defined in the empty object.
Without this check, a new array isn't created (since the value of the property is a function, not null), and when time comes to push the element into the array, the code will throw an error, saying that result.push is undefined.
The other two (countBy, repeat) are just for readabilty