-
Notifications
You must be signed in to change notification settings - Fork 323
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(keyBy): Add keyBy #93
Conversation
@mass2527 is attempting to deploy a commit to the Toss Team on Vercel. A member of the Team first needs to authorize it. |
CodSpeed Performance ReportMerging #93 will degrade performances by 85.09%Comparing Summary
Benchmarks breakdown
|
Thanks for your contribution! Since this is working as expected, I will merge this pull request. Meanwhile, I agree that all keys might not be numbers. I guess we should accept numbers and symbols as keys. Could you open a seperate pull request for that? |
Yes, I am going to make a PR for this. |
This PR resolves #84.
Question and Consideration
For consistency, I referenced the
groupBy
function since it bears similarity tokeyBy
. This is why I used almost the same signature forkeyBy
as forgroupBy
, except for the return type:While referencing, I became curious about why type
K
is restricted tostring
and notPropertyKey
. This restriction requires developers to coerce keys of types such asnumber
intostring
.I believe it would enhance usability if developers using the
keyBy
function did not have to handle type conversions differently based on the key type.Is there a specific reason that I haven't considered?
Benchmark