code: function classifyRings(rings) {
    const len = rings.length;
  
    if (len <= 1) return [rings];
  
    const polygons = [];
    let polygon;
    let ccw;
  
    for (let i = 0; i < len; i++) {
      const area = signedArea(rings[i]);
      if (area === 0) {
        continue;
      }
  
      if (ccw === undefined) {
        ccw = area < 0;
      }
  
      if (ccw === area < 0) {
        if (polygon) {
          polygons.push(polygon);
        }
        polygon = [rings[i]];
      } else {
        polygon.push(rings[i]);
      }
    }
    if (polygon) {
      polygons.push(polygon);
    }
  
    return polygons;
  }
docs: classifies an array of rings into polygons with outer rings and holes