Fix default sort algorithm (#268)

This commit is contained in:
Aaron Schwartz
2017-05-12 11:42:13 -06:00
committed by Tanner Linsley
parent 49c5a3d5e1
commit 95164311fa
+4 -4
View File
@@ -32,11 +32,11 @@ export default {
},
defaultSortMethod: (a, b) => {
// force null and undefined to the bottom
a = (a === null || a === undefined) ? -Infinity : a
b = (b === null || b === undefined) ? -Infinity : b
a = (a === null || a === undefined) ? '' : a
b = (b === null || b === undefined) ? '' : b
// force any string values to lowercase
a = a === 'string' ? a.toLowerCase() : a
b = b === 'string' ? b.toLowerCase() : b
a = typeof a === 'string' ? a.toLowerCase() : a
b = typeof b === 'string' ? b.toLowerCase() : b
// Return either 1 or -1 to indicate a sort priority
if (a > b) {
return 1