1.0.4 • Published 7 months ago
halflife-array v1.0.4
halflife-array
Creates an array of the halflife of something as it decreases over time.
Installation
npm i halflife-array
yarn add halflife-array
Usage
- readingAmount: The initial value
- halflifeMinutes: The halflife in minutes, default: 300 (5 hours)
- intervalMinutes: The interval to represent in the array, i.e. each array value is 10 minutes after the one before
- amountLimit: The value to stop calculating the value at
const halflifeArray = require('halflife-array');
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...