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.1 to 0.0.2

9

dist/index.d.ts

@@ -1,2 +0,2 @@

export declare type Result = {
declare type DepreciationResult = {
year: number;

@@ -9,3 +9,8 @@ depreciationMonths: number;

};
declare const calculateDepreciation: (purchaseAmount: number, purchaseDate: string, totalDepreciationYears: number) => Result[];
declare type DepreciationInputs = {
purchaseAmount: number;
purchaseDate: Date;
totalDepreciationYears: number;
};
declare const calculateDepreciation: ({ purchaseAmount, purchaseDate, totalDepreciationYears, }: DepreciationInputs) => DepreciationResult[];
export default calculateDepreciation;

@@ -10,7 +10,2 @@ "use strict";

};
const assertPurchaseDate = (dateString) => {
if (isNaN(new Date(dateString).valueOf())) {
throw new TypeError('`purchaseDate` is invalid.');
}
};
const assertDepreciationYears = (years) => {

@@ -33,5 +28,4 @@ if (years < 1) {

};
const calculateDepreciation = (purchaseAmount, purchaseDate, totalDepreciationYears) => {
const calculateDepreciation = ({ purchaseAmount, purchaseDate, totalDepreciationYears, }) => {
assertPurchaseAmount(purchaseAmount);
assertPurchaseDate(purchaseDate);
assertDepreciationYears(totalDepreciationYears);

@@ -38,0 +32,0 @@ const purchaseMonth = new Date(purchaseDate).getMonth() + 1;

{
"name": "asset-depreciation-calculator",
"version": "0.0.1",
"version": "0.0.2",
"description": "Asset Depreciation Calculator",

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

@@ -16,7 +16,7 @@ # asset-depreciation-calculator

calculateDepreciation(
20000,
"2016-08-01",
5,
)
calculateDepreciation({
purchaseAmount: 20000,
purchaseDate: new Date("2016-08-01"),
totalDepreciationYears: 5,
})
// => [{

@@ -69,3 +69,3 @@ // year: 2016,

### calculateDepreciation(purchaseAmount, purchaseDate, totalDepreciationYears)
### calculateDepreciation({ purchaseAmount, purchaseDate, totalDepreciationYears })

@@ -78,3 +78,3 @@ #### purchaseAmount

Type: `string` - should be a correct date string. For example: "2016-08-01"
Type: `Date`

@@ -81,0 +81,0 @@ #### totalDepreciationYears

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