contribs/gmf/src/objectediting/coordinate.js
function toXY(coordinates, nesting) {
  if (nesting === 0) {
    return /** @type {Array<T>} */(coordinatesToXY0(/** @type {Coordinate} */(coordinates)));
  } else {
    for (let i = 0, ii = coordinates.length; i < ii; i++) {
      // @ts-ignore: TypeScript is not able to do recurtion with deferent type in generic
      coordinates[i] = toXY(coordinates[i], nesting - 1);
    }
  }
  return coordinates;
}
function toXY(coordinates, nesting) {
  if (nesting === 0) {
    return /** @type {Array<T>} */(coordinatesToXY0(/** @type {Coordinate} */(coordinates)));
  } else {
    for (let i = 0, ii = coordinates.length; i < ii; i++) {
      // @ts-ignore: TypeScript is not able to do recurtion with deferent type in generic
      coordinates[i] = toXY(coordinates[i], nesting - 1);
    }
  }
  return coordinates;
}
function toXY ( coordinates , nesting ) { if ( nesting === 0 ) { return /** @type {Array<T>} */ ( coordinatesToXY0 ( /** @type {Coordinate} */ ( coordinates ) ) ) ; } else { for ( let i = 0 , ii = coordinates . length ; i < ii ; i ++ ) { // @ts-ignore: TypeScript is not able to do recurtion with deferent type in generic coordinates [ i ] = toXY ( coordinates [ i ] , nesting - 1 ) ; } } return coordinates ; }
Convert a given coordinate or list of coordinates of any 'nesting' level
to XY, i.e. remove any extra dimensions to the coordinates and keep only 2.

@template {number|Coordinate|Array<Coordinate>|Array<Array<Coordinate>>} T
@param {Array<T>} coordinates Coordinates
@param {number} nesting Nesting level.
@return {Array<T>} Converted coordinates.
@private
@hidden
Convert a given coordinate or list of coordinates of any nesting level to XY i . e . remove any extra dimensions to the coordinates and keep only 2 .