Skip to content
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

Feature request: sortByMultiple #45

Open
rodrigofariow opened this issue Sep 20, 2022 · 1 comment
Open

Feature request: sortByMultiple #45

rodrigofariow opened this issue Sep 20, 2022 · 1 comment
Labels

Comments

@rodrigofariow
Copy link

Hi there! :)

I was looking for something like lodash's sortBy with multiple accessors, e.g:

sortBy(users, [user => user.name, user => user.age]);

Why?
I know this could be implemented using the existing A.sortBy function but after 2 accessors it becomes tedious and prone to error. Lodash implementation might also not be the fastest possible.

Would something like sortByMultiple be on the roadmap for ts-belt?

Api suggestion:

function sortByMultiple<A, B>(xs: Array<A>, sortFns: Array<(_1: A) => B>): Array<A>
function sortByMultiple<A, B>(sortFns: Array<(_1: A) => B>): (xs: Array<A>) => Array<A>

Thank you for your time 🙏

@mobily
Copy link
Owner

mobily commented Dec 5, 2022

reference: #58

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants