function extend(extent1, extent2) {
  if (extent2[0] < extent1[0]) {
    extent1[0] = extent2[0];
  }
  if (extent2[2] > extent1[2]) {
    extent1[2] = extent2[2];
  }
  if (extent2[1] < extent1[1]) {
    extent1[1] = extent2[1];
  }
  if (extent2[3] > extent1[3]) {
    extent1[3] = extent2[3];
  }
  return extent1;
}
Modify an extent to include another extent.
@param {Extent} extent1 The extent to be modified.
@param {Extent} extent2 The extent that will be included in the first.
@return {Extent} A reference to the first (extended) extent.
@api