function format(coordinate, template, fractionDigits) {
  if (coordinate) {
    return template
      .replace('{x}', coordinate[0].toFixed(fractionDigits))
      .replace('{y}', coordinate[1].toFixed(fractionDigits));
  }
  return '';
}
Transforms the given {@link module:ol/coordinate~Coordinate} to a string
using the given string template. The strings `{x}` and `{y}` in the template
will be replaced with the first and second coordinate values respectively.

Example without specifying the fractional digits:

    import {format} from 'ol/coordinate.js';

    const coord = [7.85, 47.983333];
    const template = 'Coordinate is ({x}|{y}).';
    const out = format(coord, template);
    // out is now 'Coordinate is (8|48).'

Example explicitly specifying the fractional digits:

    import {format} from 'ol/coordinate.js';

    const coord = [7.85, 47.983333];
    const template = 'Coordinate is ({x}|{y}).';
    const out = format(coord, template, 2);
    // out is now 'Coordinate is (7.85|47.98).'

@param {Coordinate} coordinate Coordinate.
@param {string} template A template string with `{x}` and `{y}` placeholders
    that will be replaced by first and second coordinate values.
@param {number} [fractionDigits] The number of digits to include
   after the decimal point. Default is `0`.
@return {string} Formatted coordinate.
@api