bankers-math
Advanced tools
Comparing version 0.2.3 to 0.2.4
@@ -41,7 +41,11 @@ | ||
const squareDiffs = list.map((value) => { | ||
const diff = value - avg; | ||
return diff * diff; | ||
}) | ||
let variance = Services.toFixedNumber( Math.sqrt( squareDiffs.reduce((acc, current) => acc + current, 0) / list.length ), decimalPlaces ) | ||
let variance = 0 | ||
if (list.length > 0) { | ||
const squareDiffs = list.map((value) => { | ||
const diff = value - avg; | ||
return diff * diff; | ||
}) | ||
variance = Services.toFixedNumber( Math.sqrt( squareDiffs.reduce((acc, current) => acc + current, 0) / list.length ), decimalPlaces ) | ||
} | ||
return { | ||
@@ -48,0 +52,0 @@ sum, |
{ | ||
"name": "bankers-math", | ||
"version": "0.2.3", | ||
"version": "0.2.4", | ||
"description": "Helper function for Bankers' calculus", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
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
12371
334