asset-depreciation-calculator
Advanced tools
Comparing version 1.0.1 to 1.1.0
@@ -18,3 +18,3 @@ "use strict"; | ||
const assertDepreciationYears = (years) => { | ||
if (isNaN(years) || years < 1 || years % 1 !== 0) { // Check if years is integer, not float. | ||
if (isNaN(years) || years < 0 || years % 1 !== 0) { // Check if years is integer, not float. | ||
throw new TypeError('`totalDepreciationYears` is invalid.'); | ||
@@ -54,2 +54,12 @@ } | ||
let monthsLeftInLastYear = 0; | ||
if (totalDepreciationYears === 0) { | ||
return [{ | ||
year: purchaseYear, | ||
depreciationMonths: 0, | ||
depreciationAmount: purchaseAmount, | ||
percentage: 1, | ||
startAmount: purchaseAmount, | ||
endAmount: 0, | ||
}]; | ||
} | ||
for (let index = 0; index < totalDepreciationYears; index++) { | ||
@@ -56,0 +66,0 @@ // Current year |
{ | ||
"name": "asset-depreciation-calculator", | ||
"version": "1.0.1", | ||
"version": "1.1.0", | ||
"description": "Asset Depreciation Calculator", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
Sorry, the diff of this file is not supported yet
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
30094
428