code: function getValidInterval([min, max]) {
    let [validMin, validMax] = [min, max];
  
    // exchange
    if (min > max) {
      [validMin, validMax] = [max, min];
    }
  
    return [validMin, validMax];
  }
docs: Calculate a interval of a minimum value and a maximum value
  
  @param  {Number} min       The minimum value
  @param  {Number} max       The maximum value
  @return {Array} An interval