Fil / d3-geo-voronoi

Voronoi / Delaunay tessellations on the sphere
ISC License
229 stars 24 forks source link

Fix double assign of sites. #21

Closed martinfrances107 closed 4 years ago

martinfrances107 commented 4 years ago

This is a common error.. and my PR can be read interpreted as a readability improvement request rather than an bug report.

Looking at test/geo-voronoi-test.js

As the sites variable in scope is a file level variable... plus the fact that it is defined twice, it means it is always overwritten before being used.

From looking at this in the debugger I can say this ...

A) It is ineffectually defined first as a 2-point array B) Redefined as a 3 point array C) Used in all test methods as a 3 point array. no matter the relative position on the test method.

The confusion is that

1) sites is needlessly defined twice 2) That the casual reader might assume the 2-point definition is actually being used in some tests.

Anyway a semi trivial issue .. I just want to make the code more readable.