function compare(a, b) {
  invariant(typeof a === typeof b, '"a" and "b" must be of the same type');

  if (a > b) {
    return 1;
  } else if (a < b) {
    return -1;
  } else {
    return 0;
  }
}
Returns the ordering of `a` and `b`.

@param {string|number} a
@param {string|number} b
@returns {number} -1, 0 or 1 to indicate whether `a` is less than, equal to,
or greater than `b`, respectively