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>
Hi there! :)
I was looking for something like lodash's
sortBy
with multiple accessors, e.g: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:
Thank you for your time 🙏