Inconsistent api between sortBy and uniqBy
I noticed this difference between the sortBy and uniqBy (and maybe other functions) where the sortBy takes an array and either a list op properties or a list of mapper functions But uniqBy only takes a mapper function
Is there a reason for this?
Or could we extend the uniqBy api to:
uniqBy(T[], keyof T | (item: T) => U)
- items: same as before
- second argument:
- either a property name string
- or a mapper function that returns the value to check for uniqueness
In my code this would quite often make it easier to read since i wouldn't always need a mapper arrow function.
@bertyhell Thanks for raising this issue!
I’ve opened a PR #1534 that extends uniqBy to also accept a property key in addition to the selector function..
When you have a moment, could you please take a look at the PR and let me know if the API shape looks good to you?
@Yeom-JinHo that look perfect to me 👍