Cleanup compareAscending and remove hardcoded locale.

This commit is contained in:
John-David Dalton
2018-01-25 23:17:54 -08:00
parent 803c05dc68
commit 47a6d538f5

View File

@@ -20,12 +20,9 @@ function compareAscending(value, other) {
const othIsReflexive = other === other
const othIsSymbol = isSymbol(other)
let val = 0
if (typeof value == 'string') {
val = value.localeCompare(other,'zh')
} else {
val = value - other
}
const val = typeof value == 'string'
? value.localeCompare(other)
: -other
if ((!othIsNull && !othIsSymbol && !valIsSymbol && val > 0) ||
(valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol) ||