function genericComparator(a, b) {
  if (typeof a === 'string') {
    a = a.toLowerCase();
  }
  if (typeof b === 'string') {
    b = b.toLowerCase();
  }
  if (a > b) {
    return 1;
  } else if (a < b) {
    return -1;
  }
  return 0;
}
Ascending sorting comparator for generic inputs
 Note: string comparison is case insenstitive

@param {Object} a The first item to be compared.
@param {Object} b The second item to be compared.
@return {number} -1,0,1.