JSPM

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

Calculate percentile for given array of values

Package Exports

  • percentile

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 (percentile) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

percentile

npm license github-issues travis-status coveralls commitizen friendly

Calculate percentile for given array of values.

Install

npm install percentile

Usage

// With simple values
var percentile = require('percentile');
console.log(percentile(80, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10])); // 8

// With complex values
var percentile = require('percentile');
var result = percentile(
    80,
    [
        { val: 1 }, { val: 2 }, { val: 3 }, { val: 4 }, { val: 5 },
        { val: 6 }, { val: 7 }, { val: 8 }, { val: 9 }, { val: 10 }
    ],
    function (item) { // function to extract value from object
        return item.val;
    }
);
console.log(result); // 8

Author

Stanislav Sysoev d4rkr00t@gmail.com https://github.com/d4rkr00t

License

Contributing

Contributing are highly welcome! This repos is commitizen friendly — please read about it here.