Skip to content

_.sortBy and _.orderBy with multiple iteratees treats numbers as strings #5872

@CrossTheDev

Description

@CrossTheDev

When you need to sort by multiple iteratees and one of those values is a number, that value is sorted incorrectly.

Array sorted by "int" AND "str" results in incorrect order (10 and 11 before 2):

[
{"int":10,"str":"b"},
{"int":11,"str":"g"},
{"int":2,"str":"a"},
{"int":2,"str":"c"},
{"int":3,"str":"a"},
{"int":4,"str":"f"}
]

https://embed.plnkr.co/PYPPZa0TQulod2CcwDIm/

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions