code: function compare(x, y, fn) {
      if (typeof fn === "function") {
        return compare(fn(x), fn(y));
      }
  
      if (x === y) {
        return 0;
      }
  
      return x > y ? 1 : -1;
    }
docs: Compares two elements for sorting purposes.
  
  @private
  @param {*} x The left element to compare.
  @param {*} y The right element to compare.
  @param {Function=} fn An optional function to call on each element, to get
  the values to compare.
  @returns {number} 1 if x > y, -1 if x < y, or 0 if x and y are equal.
  
  @examples
  compare(1, 2)     // => -1
  compare(1, 1)     // => 0
  compare(2, 1)     // => 1
  compare('a', 'b') // => -1