isMultiPointInPoly variables oneInside is never used
qugemingzizhemefeijin opened this issue · comments
小橙子在北京 commented
turf/packages/turf-boolean-within
/index.ts
The following code:
function isMultiPointInPoly(multiPoint: MultiPoint, polygon: Polygon) {
var output = true;
var oneInside = false;
var isInside = false;
for (var i = 0; i < multiPoint.coordinates.length; i++) {
isInside = booleanPointInPolygon(multiPoint.coordinates[i], polygon);
if (!isInside) {
output = false;
break;
}
if (!oneInside) {
// this variables Should be oneInside ???
isInside = booleanPointInPolygon(multiPoint.coordinates[i], polygon, {
ignoreBoundary: true,
});
}
}
return output && isInside;
}
this code variable oneInside Whether it is not used。
James Milner commented
Looking at this I agree that the code path seems slightly illogical in that !oneInside
will always run as the variable is never reassigned. I'd need to probably look at the PR / gitblame / unit tests to understand the intent.
James Beard commented