arraysort.js revision 761e9178cfaf5a97357730120fe13b8171aeb2eb
Y.ArraySort = {
/**
* Comparator function for simple case-insensitive string sorting.
*
* @method compare
* @param a {Object} First sort argument.
* @param b {Object} Second sort argument.
* @param desc {Boolean} True if sort direction is descending, false if
* sort direction is ascending.
* @return {Boolean} Return -1 when a < b. Return 0 when a = b.
* Return 1 when a > b.
*/
if(!ISVALUE(a)) {
if(!ISVALUE(b)) {
return 0;
}
else {
return 1;
}
}
else if(!ISVALUE(b)) {
return -1;
}
if(ISSTRING(a)) {
a = a.toLowerCase();
}
if(ISSTRING(b)) {
b = b.toLowerCase();
}
if(a < b) {
}
else if (a > b) {
}
else {
return 0;
}
}
};