Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

bankers-math

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bankers-math - npm Package Compare versions

Comparing version 0.2.0 to 0.2.1

15

Banker.js

@@ -21,2 +21,17 @@

sum (list) {
return list.length > 0 ? list.reduce((acc, current) => acc + current, 0) : 0
},
avg (list) {
return list.length > 0 ? Services.sum(list) / list.length : 0
},
variance (list) {
let avg = Services.avg(list)
const squareDiffs = list.map((value) => {
const diff = value - avg;
return diff * diff;
})
return Services.toFixedNumber( Math.sqrt( squareDiffs.reduce((acc, current) => acc + current, 0) / list.length ), 6 )
},
defined (value) {

@@ -23,0 +38,0 @@ return value !== undefined && value !== null

4

package.json
{
"name": "bankers-math",
"version": "0.2.0",
"version": "0.2.1",
"description": "Helper function for Bankers' calculus",

@@ -25,3 +25,3 @@ "keywords": [

"devDependencies": {
"jest": "^29.6.2"
"jest": "^29.7.0"
},

@@ -28,0 +28,0 @@ "engines": {

@@ -30,2 +30,5 @@ const Services = require( '../Banker' )

} )
test('Diffraction', async function () {
console.log( Services.variance( [ 100, 120, 80 ] ) )
} )
} )
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc