code: function isFlatRingClosed(positions, size, startIndex, endIndex) {
    for (let i = 0; i < size; i++) {
      if (positions[startIndex + i] !== positions[endIndex - size + i]) {
        return false;
      }
    }
    return true;
  }
docs: Check if a simple flat array is a closed ring
  @param {Array} positions - array of numbers
  @param {Number} size - size of a position, 2 (xy) or 3 (xyz)
  @param {Number} startIndex - start index of the path in the positions array
  @param {Number} endIndex - end index of the path in the positions array
  @return {Boolean} - true if the simple flat array is a closed ring