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

10 lines (8 loc) 305 B
exports.validateRadius = function validateRadius(radius) { if (typeof radius !== "number") { throw new Error(`ERROR! Radius has to be a positive number but was: ${typeof radius}`); } if (radius <= 0) { throw new Error(`ERROR! Radius has to be a positive number but was: ${radius}`); } };