function insidePolygon (location, polygon) {
  if (!polygon || !Array.isArray(polygon)) {
    throw new TypeError('Invalid polygon. Array with locations expected')
  }
  if (polygon.length === 0) {
    throw new TypeError('Invalid polygon. Non-empty Array expected')
  }

  return pointInPolygon(toLonLatTuple(location), polygon.map(toLonLatTuple))
}
/**
 * Test whether a location lies inside a given polygon
 * @param {Location} location 
 * @param {Location[]} polygon  
 * @return {boolean} Returns true when the location is inside the bounding box
 *                   or on the edge.
 */
Test whether a location lies inside a given polygon
@param {Location} location
@param {Location[]} polygon
@return {boolean} Returns true when the location is inside the bounding box
or on the edge.
Test whether a location lies inside a given polygon @param { Location } location @param { Location [] } polygon @return { boolean } Returns true when the location is inside the bounding box or on the edge .
function insidePolygon (location, polygon) {
  if (!polygon || !Array.isArray(polygon)) {
    throw new TypeError('Invalid polygon. Array with locations expected')
  }
  if (polygon.length === 0) {
    throw new TypeError('Invalid polygon. Non-empty Array expected')
  }
  return pointInPolygon(toLonLatTuple(location), polygon.map(toLonLatTuple))
}
function insidePolygon ( location , polygon ) { if ( ! polygon || ! Array . isArray ( polygon ) ) { throw new TypeError ( 'Invalid polygon. Array with locations expected' ) } if ( polygon . length === 0 ) { throw new TypeError ( 'Invalid polygon. Non-empty Array expected' ) } return pointInPolygon ( toLonLatTuple ( location ) , polygon . map ( toLonLatTuple ) ) }
Test whether a location lies inside a given polygon
 @param {Location} location
 @param {Location[]} polygon
 @return {boolean} Returns true when the location is inside the bounding box
                   or on the edge.
Test whether a location lies inside a given polygon @param { Location } location @param { Location [] } polygon @return { boolean } Returns true when the location is inside the bounding box or on the edge .