Skip to main content

Inflation calculator

Works with
This package works with Bun
This package works with Cloudflare Workers
This package works with Node.js
This package works with Deno
This package works with Browsers
JSR Score
100%
Published
2 months ago

Inflation calculator

Features

  • convert amount across years
  • support both directions, old to new or new to old
  • support currency replacements
  • has built-in data sets

Usage

import { Inflation } from "@vwkd/inflation";
import { currencyReplacements, inflationRates } from "@vwkd/inflation/de";

const inflationDe = new Inflation(inflationRates, currencyReplacements);

const nominalAmount = 100;
const fromYear = 1999;
const toYear = 2023;
const realAmount = inflationDe.adjust(nominalAmount, fromYear, toYear);

console.log(realAmount); // 79.96

Add Package

deno add @vwkd/inflation

Import symbol

import * as mod from "@vwkd/inflation";

Add Package

npx jsr add @vwkd/inflation

Import symbol

import * as mod from "@vwkd/inflation";

Add Package

yarn dlx jsr add @vwkd/inflation

Import symbol

import * as mod from "@vwkd/inflation";

Add Package

pnpm dlx jsr add @vwkd/inflation

Import symbol

import * as mod from "@vwkd/inflation";

Add Package

bunx jsr add @vwkd/inflation

Import symbol

import * as mod from "@vwkd/inflation";