# us-inflation

> Convert US prices from one year (and month if you want) to another.

Latest version **1.1.0** (published 2018-07-10) · CC-BY-SA license · 0 weekly downloads

## Install

```sh
npm install us-inflation
pnpm add us-inflation
yarn add us-inflation
bun add us-inflation
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.0 |
| Published | 2018-07-10 |
| First published | 2018-07-08 |
| Weekly downloads | 0 |
| License | CC-BY-SA |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 53.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | @jeremiak |
| Maintainers | jeremiak |
| Keywords | inflation, consumer price index, cpi, us cpi, us inflation, bls, bureau of labor statistics |

## Links

- npm: https://www.npmjs.com/package/us-inflation
- Repository: https://gitlab.com/jeremiak/us-inflation
- Issues: https://gitlab.com/jeremiak/us-inflation/issues
- npm.io page: https://npm.io/package/us-inflation

## Recent versions

- 1.1.0 (latest) — 2018-07-10
- 1.0.0 — 2018-07-08

## README

# US inflation

Convert US prices from one year (and month if you want) to another.

[![pipeline status](https://gitlab.com/jeremiak/us-inflation/badges/master/pipeline.svg)](https://gitlab.com/jeremiak/us-inflation/commits/master)

## Usage

```
import inflation from 'us-inflation'

const current = inflation({ year: 1945, amount: 1.23 })
console.log(`$1.23 in 1945 was worth $${current} in 2017`)
```

## Documentation

There is a single function exported by the library that has one required and one optional argument. It returns the converted price.

### `inflation(from, [to])`

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

#### `from`

- `amount` is the nominal price
- `year` is a year between 1913 and 2018
- `month` (optional) if want a more precise measure, you can supply the month the price was observed

#### `to` (optional)

- `year` is a year between 1913 and 2018 and is 2017 (the last full year of data) by default
- `month` (optional) if want a more precise measure, you can supply the month you want the new price for

## Data source

All data comes from the Bureau of Labor Statistics [Consumer Price Index inflation calculator](https://www.bls.gov/data/inflation_calculator.htm) and is therefore limited to years between 1913 and 2018.

## Prior art and motivation

I came across [@dillonchr/inflation](https://www.npmjs.com/package/@dillonchr/inflation) but wanted an implementation that didn't make an HTTP request for every function call and I also wanted to figure out how to calculate inflation using the CPI.

---
_Source: https://npm.io/package/us-inflation · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
