import isEqual from 'lodash/isEqual';
import isEmpty from './isEmpty';
const getIsSortable = function getIsSortable(a, b, {
  nullFirst = true
} = {}) {
  const aIsEmpty = isEmpty(a);
  const bIsEmpty = isEmpty(b);

  // If they're both falsy, they can't be compared
  if (aIsEmpty && bIsEmpty) {
    return false;
  }

  // If they're both equal, they can't be compared
  if (isEqual(a, b)) {
    return false;
  }

  // If a is falsy, return based on nullFirst
  if (aIsEmpty) {
    return nullFirst ? -1 : 1;
  }

  // If b is falsy, return based on nullFirst
  if (bIsEmpty) {
    return nullFirst ? 1 : -1;
  }

  // If neither are falsy, and are unequal, they can be compared
  return true;
};
export default getIsSortable;