function quantizeArray(
  flatCoordinates,
  offset,
  ends,
  stride,
  tolerance,
  simplifiedFlatCoordinates,
  simplifiedOffset,
  simplifiedEnds,
) {
  for (let i = 0, ii = ends.length; i < ii; ++i) {
    const end = ends[i];
    simplifiedOffset = quantize(
      flatCoordinates,
      offset,
      end,
      stride,
      tolerance,
      simplifiedFlatCoordinates,
      simplifiedOffset,
    );
    simplifiedEnds.push(simplifiedOffset);
    offset = end;
  }
  return simplifiedOffset;
}
@param {Array<number>} flatCoordinates Flat coordinates.
@param {number} offset Offset.
@param {Array<number>} ends Ends.
@param {number} stride Stride.
@param {number} tolerance Tolerance.
@param {Array<number>} simplifiedFlatCoordinates Simplified flat
    coordinates.
@param {number} simplifiedOffset Simplified offset.
@param {Array<number>} simplifiedEnds Simplified ends.
@return {number} Simplified offset.