2.5.8 • Published 6 months ago

pln-inflation v2.5.8

Weekly downloads
-
License
CC0 1.0
Repository
github
Last release
6 months ago

PLN inflation

NPMJS registry package version Snyk Package Health Score

Convert prices in Polish złoty (ISO 4217 code 'PLN') from one year (and month) to another.

Konwertuj ceny w złotówkach (zł; kod ISO 4217 'PLN') pod kątem rocznej i miesięcznej inflacji.

Usage

const pln = require('pln-inflation');

Annual inflation

// Let's assume it's 2022
let current = pln.annual_inflation({ year: 1995, amount: 10 });
console.log(`10 zł in 1995 was worth ${current} zł in 2022`);

let pis = pln.inflation({ year: 2015, amount: 10 }, { year: 2019 }); // 'inflation()' also works
console.log(`10 zł in 2015 was worth ${pis} zł in 2019`);

Monthly inflation

// Let's assume it's August 2022
let current = pln.monthly_inflation({ year: 1995, month: 1, amount: 10 }); 
console.log(`10 zł in January 1995 was worth ${current} zł in August 2022`);

let kwasniewski = pln.monthly_inflation({ year: 1995, month: 12, amount: 10 }, { year: 2005, month: 12});
console.log(`10 zł in December 1995 was worth ${kwasniewski} zł in December 2005`);

Documentation

There are three functions exported by the library:

  • annual_inflation (inflation also works);
  • monthly_inflation
  • latest_cpi

First two return the converted price.

annual_inflation(from, [to])

The required from argument and the optional to argument are similar objects.

from

  • year is a year ≥1995
  • amount is the nominal price

to (optional)

monthly_inflation(from, [to])

This function is very similiar to annual_inflation, but allows conversion with month accuracy.

from

  • year is a year ≥1995
  • month is a numerical represention of a month (1-12)
  • amount is the nominal price

to (optional)

latest_cpi()

This function returns an object containing two properties, which are also objects:

  • yearly has two properties:
    • year_id is the last year of yearly inflation data
    • value is the CPI for the aforementioned year
  • monthly has three properties:
    • year_id is the last year of monthly inflation data
    • month_id is a numerical represention of the last month of monthly inflation data (1-12)
    • value is the CPI for the aforementioned month
const latest = pln.latest_cpi();

let month = latest.monthly.month_id;
let year = latest.monthly.year_id;

console.log(`This package currently offers conversion from 1995-01 to ${year}-${month}`);

Data source

All data comes from the Statistics Poland (Polish: Główny Urząd Statystyczny) and is therefore limited to years past 1950. However, due to redenomination of Polish złoty in 1995 this package is currently limited to years from 1995.

Prior art and motivation

2.5.8

6 months ago

2.5.7

7 months ago

2.5.6

8 months ago

2.5.2

12 months ago

2.5.4

10 months ago

2.5.3

11 months ago

2.5.5

9 months ago

2.5.0

12 months ago

2.4.0

1 year ago

2.5.1

12 months ago

2.3.3

1 year ago

2.3.2

1 year ago

2.3.1

1 year ago

2.2.4

1 year ago

2.2.1

1 year ago

2.2.0

2 years ago

2.2.3

1 year ago

2.2.2

1 year ago

2.2.1-a

1 year ago

1.0.7-a

2 years ago

2.1.0

2 years ago

2.0.1

2 years ago

2.0.0

2 years ago

1.0.6-b

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.6-a

2 years ago

1.0.4-c

2 years ago

1.0.2

2 years ago

1.0.4-a

2 years ago

1.0.3-b

2 years ago

1.0.3-d

2 years ago

1.0.3-c

2 years ago

1.0.4

2 years ago

1.0.1

3 years ago

1.0.0

3 years ago

0.0.5-alpha

3 years ago