src/sorto.js
function getComparator(sortOrder) {
  if (typeof sortOrder === 'function') {
    return sortOrder;
  }

  const comparators = {
    [ASC]: ascendingSort,
    [DESC]: descendingSort,
    [ASC_LENGTH]: lengthSort,
    [DESC_LENGTH]: lengthReverseSort
  };

  return comparators[sortOrder];
}
function getComparator(sortOrder) {
  if (typeof sortOrder === 'function') {
    return sortOrder;
  }

  const comparators = {
    [ASC]: ascendingSort,
    [DESC]: descendingSort,
    [ASC_LENGTH]: lengthSort,
    [DESC_LENGTH]: lengthReverseSort
  };

  return comparators[sortOrder];
}
function getComparator ( sortOrder ) { if ( typeof sortOrder === 'function' ) { return sortOrder ; } const comparators = { [ ASC ] : ascendingSort , [ DESC ] : descendingSort , [ ASC_LENGTH ] : lengthSort , [ DESC_LENGTH ] : lengthReverseSort } ; return comparators [ sortOrder ] ; }
Returns appropriate comparator as per the sort string.
If a function is supplied, it returns the function itself.

@param {String|Function} sortOrder
@returns {Function}
Returns appropriate comparator as per the sort string . If a function is supplied it returns the function itself .