function compare(x, y) {
    if (x === y) {
      return 0;
    }

    return x > y ? 1 : -1;
  }
Compares two elements for sorting purposes.

@private
@param {*} x The left element to compare.
@param {*} y The right element 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