Skip to content

function that calculates the rent readjustmente for a given value and date

Notifications You must be signed in to change notification settings

lastro-co/readjustment-calculation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

readjustment-calculation


function that calculates the rent readjustmente for a given value and date

Installation:


You can install using npm with the following command:

Preparing:


You'll have to import the function:

  • import { Calculation } from "calculatorreadjustment/calculation.js";

Using:


Now you're able to call Calculation in your code, the argument is an object containing:

  • index (IGPM or IPCA)
  • baseDate (the date from the start of the calculation)
  • baseValue (the rent that use to be charged on the baseDate)

It returns an object containing the last readjusted value according to the arguments and a calculation memory by year

Examples


(async (calculation) => {
    try {

        const resultIGPM = await calculation({
            index: 'IGPM',
            baseDate: '2019-11-01',
            baseValue: '300.33',
        })
        
        console.log(resultIGPM) // { value: 363.17, memory: []

        const resultIPCA = await calculation({
            index: 'IPCA',
            baseDate: '2015-12-01',
            baseValue: 300.33,
        })
        console.log(resultIPCA) // { value: 370.25, memory: [] }

    } catch (error) {
        console.error(error) // new Error();
    }
})(Calculation)

dependencies:

  • axios

About

function that calculates the rent readjustmente for a given value and date

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages