code: function limitBounds(bounds) {
      // acceptable ranges for each number in a bounding box
      var lon = [-180, 180], lat = [-90, 90], limits = [lon, lat, lon, lat];
      return bounds.map(function(_, i) {
          return Math.max(limits[i][0], Math.min(limits[i][1], _));
      });
  }
docs: Limit a bounding box to the [-180, -90, 180, 90] limits
  of WGS84. We permit greater bounds for input data, since sometimes
  GeoJSON and unusual shapefiles feature them, but we can't tile
  beyond these bounds in XYZ, so we limit them.
  
  This method does not mutate its input, and it strongly expects
  that its input is a valid type.
  
  @param {Array<Number>} bounds
  @returns {Array<Number} bounds