Skip to content

OrderByPipe .toLowerCase function only exists on strings #99

Description

@gtsopour

For some reason and on specific cases only, I was receiving that t.toLowerCase() is not functioning. I managed to overpass this issue by editing the following:

if((isNaN(parseFloat(a)) || !isFinite(a)) || (isNaN(parseFloat(b)) || !isFinite(b))){
//Isn't a number so lowercase the string to properly compare
if(a.toString().toLowerCase() < b.toString().toLowerCase()) return -1;
if(a.toString().toLowerCase() > b.toString().toLowerCase()) return 1;
}
else{
//Parse strings as numbers to compare properly
if(parseFloat(a) < parseFloat(b)) return -1;
if(parseFloat(a) > parseFloat(b)) return 1;
}

Could you please check that?

Best
George

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

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