@turf/center-mean
Advanced tools
Comparing version 5.0.0 to 5.0.1
15
main.js
@@ -47,11 +47,10 @@ 'use strict'; | ||
weightValue = Number(weightValue); | ||
if (weightValue < 0) throw new Error('weight value must be positive for feature index ' + featureIndex); | ||
meta.coordEach(geom, function (coord) { | ||
sumXs += coord[0] * weightValue; | ||
sumYs += coord[1] * weightValue; | ||
sumNs += weightValue; | ||
}); | ||
if (weightValue > 0) { | ||
meta.coordEach(geom, function (coord) { | ||
sumXs += coord[0] * weightValue; | ||
sumYs += coord[1] * weightValue; | ||
sumNs += weightValue; | ||
}); | ||
} | ||
}); | ||
// if (sumNs) sumNs = 1; | ||
if (sumNs === 0) throw new Error('sum of weights equals zero'); | ||
return helpers.point([sumXs / sumNs, sumYs / sumNs], properties); | ||
@@ -58,0 +57,0 @@ } |
{ | ||
"name": "@turf/center-mean", | ||
"version": "5.0.0", | ||
"version": "5.0.1", | ||
"description": "turf center-mean module", | ||
@@ -5,0 +5,0 @@ "main": "main", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
9121
117