# halflife-array

Creates an array of the halflife of something as it decreases over time.

## Installation

```npm i halflife-array```

```yarn add halflife-array```


## CommonJS Import

```
const halflifeArray = require('halflife-array');
```

## ESM Import

```
import halflifeArray from 'halflife-array'
```


## Usage

* **readingAmount**: The initial value, default: 100
* **halflifeMinutes**: The halflife in minutes, default: 300 (5 hours)
* **intervalMinutes**: The interval in minutes between each array value, default: 10, i.e. each array value is 10 minutes after the one before
* **amountLimit**: The lower bound - calculation stops when the value drops below this, default: 0.5

```
const readingAmount = 100;
const halflifeMinutes = 300;
const intervalMinutes = 10; 
const amountLimit = 0.5;
const array = halflifeArray(readingAmount, halflifeMinutes, intervalMinutes, amountLimit);

console.log(array);
```

Which would create an array like this...

[100, 98.33333333333333, 96.66666666666667, 95, 93.33333333333333, 91.66666666666667, 90, ... , 0.5078125, 0.4947916666666667]

