function wrapX(coordinate, projection) {
  if (projection.canWrapX()) {
    const worldWidth = getWidth(projection.getExtent());
    const worldsAway = getWorldsAway(coordinate, projection, worldWidth);
    if (worldsAway) {
      coordinate[0] -= worldsAway * worldWidth;
    }
  }
  return coordinate;
}
Modifies the provided coordinate in-place to be within the real world
extent. The lower projection extent boundary is inclusive, the upper one
exclusive.

@param {Coordinate} coordinate Coordinate.
@param {import("./proj/Projection.js").default} projection Projection.
@return {Coordinate} The coordinate within the real world extent.