function linearRingsAreOriented(
  flatCoordinates,
  offset,
  ends,
  stride,
  right,
) {
  right = right !== undefined ? right : false;
  for (let i = 0, ii = ends.length; i < ii; ++i) {
    const end = ends[i];
    const isClockwise = linearRingIsClockwise(
      flatCoordinates,
      offset,
      end,
      stride,
    );
    if (i === 0) {
      if ((right && isClockwise) || (!right && !isClockwise)) {
        return false;
      }
    } else {
      if ((right && !isClockwise) || (!right && isClockwise)) {
        return false;
      }
    }
    offset = end;
  }
  return true;
}
Determines if linear rings are oriented.  By default, left-hand orientation
is tested (first ring must be clockwise, remaining rings counter-clockwise).
To test for right-hand orientation, use the `right` argument.

@param {Array<number>} flatCoordinates Flat coordinates.
@param {number} offset Offset.
@param {Array<number>} ends Array of end indexes.
@param {number} stride Stride.
@param {boolean} [right] Test for right-hand orientation
    (counter-clockwise exterior ring and clockwise interior rings).
@return {boolean} Rings are correctly oriented.