1.0.5 • Published 3 years ago

index-inflation-calculator v1.0.5

Weekly downloads
13
License
MIT
Repository
github
Last release
3 years ago

Index inflation calculator

The index-inflation-calculator package is a tool to calculate upcomming year values of given purchase year and amount.

Installation

Use the package manager npm to install index-inflation-calculator package.

npm index-inflation-calculator -s

Usage

const indexInflationCalculator = require('index-inflation-calculator');
const previousYearsData = [
    {year: 2010, rates: [107.2, 106.5, 106.5, 106.2]},
    {year: 2013, rates: [101]},  
];
const indexCalculator = new indexInflationCalculator(previousYearsData);
const returnOnBoughtHouse = indexCalculator.calculate(250000, 2025);
console.dir(returnOnBoughtHouse, { depth: null });

You can add an array or single value to split quarter results or yearly results in the rates value, Years must be unique. The rates are percentage based.

Examples

const indexInflationCalculator = require('index-inflation-calculator');
const previousYearsData = [
    {year: 2010, rates: [107.2, 106.5, 106.5, 106.2]},
    {year: 2013, rates: [101]},  
];
const indexCalculator = new indexInflationCalculator(previousYearsData);
const returnOnBoughtHouse = indexCalculator.calculate(250000, 2025);
console.dir(returnOnBoughtHouse, { depth: null });
//This log will be : 
// {
//     years: 4,
//     results: {
//       total: 290221.393284,
//       yearlyTotals: [
//         { year: 2021, total: 259500 },
//         { year: 2022, total: 269361 },
//         { year: 2023, total: 279596.718 },
//         { year: 2024, total: 290221.393284 }
//       ]
//     }
//   }

License

MIT