Skip to content

Commit 279d875

Browse files
committed
addind validation to the Circle constructor to check the lenght of the array
1 parent 9f3c9ee commit 279d875

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/scoord3d.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,9 @@ class Circle extends Scoord3D {
140140
if (!Array.isArray(coordinates)) {
141141
throw new Error('coordinates of Circle must be an array')
142142
}
143+
if (coordinates.length < 2) {
144+
throw new Error('coordinates of Circle must be an array of length 2')
145+
}
143146
if(coordinates.find(c => c.length !== 3)!== undefined){
144147
throw new Error('coordinates of Circle must be a list or size two with points of length 3')
145148
}

0 commit comments

Comments
 (0)