JSPM

weighted-mean

1.0.2
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 3804
  • Score
    100M100P100Q160691F
  • License MIT

Calculates the weighted mean of an array of numbers

Package Exports

  • weighted-mean

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (weighted-mean) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

weighted-mean

NPM version Downloads Build Status Coverage Status Dependency status Dev Dependency status

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.