code: function copyFlatRing(target, targetStartIndex, positions, size, srcStartIndex = 0, srcEndIndex) {
    srcEndIndex = srcEndIndex || positions.length;
    const srcLength = srcEndIndex - srcStartIndex;
    if (srcLength <= 0) {
      return targetStartIndex;
    }
    let targetIndex = targetStartIndex;
  
    for (let i = 0; i < srcLength; i++) {
      target[targetIndex++] = positions[srcStartIndex + i];
    }
  
    if (!isFlatRingClosed(positions, size, srcStartIndex, srcEndIndex)) {
      for (let i = 0; i < size; i++) {
        target[targetIndex++] = positions[srcStartIndex + i];
      }
    }
    return targetIndex;
  }
docs: Copy a simple flat array into another flat array, closes the ring if needed.
  @param {Float64Array} target - destination
  @param {Number} targetStartIndex - index in the destination to start copying into
  @param {Array} positions - array of numbers
  @param {Number} size - size of a position, 2 (xy) or 3 (xyz)
  @param {Number} [srcStartIndex] - start index of the path in the positions array
  @param {Number} [srcEndIndex] - end index of the path in the positions array
  @returns {Number} - the index of the write head in the destination