Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// Optional parameters
options = options || {};
if (!isObject(options)) throw new Error('options is invalid');
// validation
if (!center) throw new Error('center is required');
if (bearing1 === undefined || bearing1 === null) throw new Error('bearing1 is required');
if (bearing2 === undefined || bearing2 === null) throw new Error('bearing2 is required');
if (!radius) throw new Error('radius is required');
if (typeof options !== 'object') throw new Error('options must be an object');
if (convertAngleTo360(bearing1) === convertAngleTo360(bearing2)) {
return circle(center, radius, options);
}
var coords = getCoords(center);
var arc = lineArc(center, radius, bearing1, bearing2, options);
var sliceCoords = [[coords]];
coordEach(arc, function (currentCoords) {
sliceCoords[0].push(currentCoords);
});
sliceCoords[0].push(coords);
return polygon(sliceCoords);
}