code: function copyNestedRing(target, targetStartIndex, simplePolygon, size) {
    let targetIndex = targetStartIndex;
    const len = simplePolygon.length;
    for (let i = 0; i < len; i++) {
      for (let j = 0; j < size; j++) {
        target[targetIndex++] = simplePolygon[i][j] || 0;
      }
    }
  
    if (!isNestedRingClosed(simplePolygon)) {
      for (let j = 0; j < size; j++) {
        target[targetIndex++] = simplePolygon[0][j] || 0;
      }
    }
    return targetIndex;
  }
docs: Copy a simple polygon coordinates into a flat array, closes the ring if needed.
  @param {Float64Array} target - destination
  @param {Number} targetStartIndex - index in the destination to start copying into
  @param {Array} simplePolygon - array of points
  @param {Number} size - size of a position, 2 (xy) or 3 (xyz)
  @returns {Number} - the index of the write head in the destination