1.1.0 • Published 8 years ago
incremental-average v1.1.0
incremental-average
I use this library to help me deal with incremental averaging
How to use
Install
Regular npm install
npm install incremental-average --saveUse
incrementalAverage will return an object that has the following interface:
add()- will receive one or many numbers as parameters, add them tot he average, and will return the average.getAverage()- will return the averagegetIncrement()- will return the n position of the last incremented number
import incrementalAverage from 'incremental-average'
const ia = incrementalAverage();
const averageOfOneToFive = ia.add(1,2,3,4,5); // 3
const averageOfOneToTen = ia.add(6,7,8,9,10); // 5.5Alternative use
import incrementalAverage from 'incremental-average'
const ia = incrementalAverage(1,2,3,4,5);
const averageOfOneToFive = ia.getAverage(); // 3
const averageOfOneToTen = ia.add(6,7,8,9,10); // 5.5