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

asset-depreciation-calculator

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

asset-depreciation-calculator - npm Package Compare versions

Comparing version 0.0.3 to 0.0.4

13

dist/index.js

@@ -18,7 +18,16 @@ "use strict";

const depreciationAmount = toFixedTwo((purchaseAmount / totalDepreciationYears / MONTHS_IN_YEAR) * monthsLeft);
const percentage = toFixedTwo((depreciationAmount / purchaseAmount) * 100);
const newEndAmount = toFixedTwo(previousEndAmount - depreciationAmount);
// Because of the rounding, even if the calculation is correct, sometimes there is €0.01 left over.
// For example, if total is 3.1, divided by 3 it would be 1.33 / 1.33 / 1.33.
if (newEndAmount === 0.01) {
return {
depreciationAmount: previousEndAmount,
percentage: toFixedTwo((previousEndAmount / purchaseAmount) * 100),
startAmount: previousEndAmount,
endAmount: 0,
};
}
return {
depreciationAmount,
percentage,
percentage: toFixedTwo((depreciationAmount / purchaseAmount) * 100),
startAmount: previousEndAmount,

@@ -25,0 +34,0 @@ endAmount: newEndAmount,

2

package.json
{
"name": "asset-depreciation-calculator",
"version": "0.0.3",
"version": "0.0.4",
"description": "Asset Depreciation Calculator",

@@ -5,0 +5,0 @@ "keywords": [

Sorry, the diff of this file is not supported yet

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