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.1.5 to 0.1.6

26

Banker.js

@@ -6,2 +6,3 @@

const E = 1e-8
const DIFFRA_EQ = 'Equilibrium'
const DIFFRA_PROPORT = 'Proportionality'

@@ -17,2 +18,3 @@ const DIFFRA_PAYOFF = 'Payoff'

NA,
DIFFRA_EQ
DIFFRA_PROPORT,

@@ -74,11 +76,17 @@ DIFFRA_PAYOFF,

if ( normalisationMethod && normalisationMethod !== NA && feeTotal > amount ) {
if ( normalisationMethod === DIFFRA_PROPORT ) {
feeValues = Services.divide( amount, feeValues, rounding )
} else if ( normalisationMethod === DIFFRA_PAYOFF ) {
let toCut = feeTotal - amount
for (let i = feeValues.length - 1; toCut > 0 && i >= 0; ++i) {
let tc = toCut <= feeValues[i] ? toCut : feeValues[i]
feeValues[i] -= tc
toCut -= tc
if ( normalisationMethod && normalisationMethod !== NA ) {
if (feeTotal < amount) {
if ( normalisationMethod === DIFFRA_EQ )
feeValues = Services.divide( amount, feeValues, rounding )
}
else if (feeTotal > amount) {
if ( normalisationMethod === DIFFRA_PROPORT ) {
feeValues = Services.divide( amount, feeValues, rounding )
} else if ( normalisationMethod === DIFFRA_PAYOFF ) {
let toCut = feeTotal - amount
for (let i = feeValues.length - 1; toCut > 0 && i >= 0; ++i) {
let tc = toCut <= feeValues[i] ? toCut : feeValues[i]
feeValues[i] -= tc
toCut -= tc
}
}

@@ -85,0 +93,0 @@ }

{
"name": "bankers-math",
"version": "0.1.5",
"version": "0.1.6",
"description": "Helper function for Bankers' calculus",

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

"devDependencies": {
"jest": "^27.4.7"
"jest": "^27.5.1"
},

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

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