code: function validate(polygon) {
    polygon = (polygon && polygon.positions) || polygon;
    if (!Array.isArray(polygon) && !ArrayBuffer.isView(polygon)) {
      throw new Error('invalid polygon');
    }
  }
docs: 4 data formats are supported: Simple Polygon: an array of points Complex Polygon: an array of array of points (array of rings) with the first ring representing the outer hull and other rings representing holes Simple Flat: an array of numbers (flattened "simple polygon") Complex Flat: {position: array<number>, holeIndices: array<number>} (flattened "complex polygon") 
  Ensure a polygon is valid format
  @param {Array|Object} polygon