weighted-mean

Calculates the weighted mean of an array of numbers

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
weighted-mean
361.0.26 years ago7 years agoMinified + gzip package size for weighted-mean in KB

Readme

weighted-mean
!NPM versionnpm-imagenpm-url !Downloadsdownloads-imagenpm-url !Build Statustravis-imagetravis-url !Coverage Statuscoveralls-imagecoveralls-url !Dependency statusdavid-dm-imagedavid-dm-url !Dev Dependency statusdavid-dm-dev-imagedavid-dm-dev-url
Calculates the weighted mean of an array of numbers.

Installation

$ npm install weighted-mean - NPM
$ bower install weighted-mean - bower
The browser file is named index.umd.js which supports CommonJS, AMD and globals (weightedMean). If you want to run this module on old browsers, you must include es5-shim.

Usage

The example bellow is based on nodejs.
const weightedMean = require('weighted-mean');

const mean = weightedMean([
    [100, 2],   // 100 is the value, 2 is the weight
    [50, 4],
    [25, 1],
]);

Tests

$ npm test

License

Released under the MIT License.