Skip to content

Feature request: sortByMultiple #45

@rodrigofariow

Description

@rodrigofariow

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 🙏

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions