This PR makes it possible to pass either an object or a number to numberOfSegements. When passed as an object, the value of the key numberOfSegments will be used. Identical polygons will be returned when passing a number or passing an object.
This will close #13 and opens up for the possibility to add more options for the creation of the polygon.
If error should be thrown, then add that functionallity. If error should not be thrown, add && !Array.isArray to else if (typeof options === "object") condition for getNumberOfSegments().
This PR makes it possible to pass either an
object
or anumber
tonumberOfSegements
. When passed as an object, the value of the keynumberOfSegments
will be used. Identical polygons will be returned when passing a number or passing an object.This will close #13 and opens up for the possibility to add more options for the creation of the polygon.
TODO: Check if error should be thrown whennumberOfSegemnts
is an array, or if it should keep current behavior ( see this post https://github.com/gabzim/circle-to-polygon/issues/9#issuecomment-583929409 )If error should be thrown, then add that functionallity. If error should not be thrown, add&& !Array.isArray
toelse if (typeof options === "object")
condition forgetNumberOfSegments()
.