UNPKG

circle-to-polygon

Version:

Receives a Coordinate, a Radius and a Number of edges and aproximates a circle by creating a polygon that fills its area

11 lines (9 loc) 423 B
exports.validateEarthRadius = function validateEarthRadius(earthRadius) { if (typeof earthRadius !== "number") { const ARGUMENT_TYPE = Array.isArray(earthRadius) ? "array" : typeof earthRadius; throw new Error(`ERROR! Earth radius has to be a number but was: ${ARGUMENT_TYPE}`); } if (earthRadius <= 0) { throw new Error(`ERROR! Earth radius has to be a positive number but was: ${earthRadius}`); } };