Skip to content

OrderByPipe .toLowerCase function only exists on strings #99

@gtsopour

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions