Skip to content

Commit

Permalink
Merge pull request #2 from goto-bus-stop/add-2.5-and-97.5
Browse files Browse the repository at this point in the history
Add 2.5 and 97.5 percentiles
  • Loading branch information
mcollina authored Jul 20, 2018
2 parents cf08484 + 3ccbf23 commit a69bd9f
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 4,566 deletions.
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package-lock=false
4 changes: 3 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
'use strict'

const percentiles = module.exports.percentiles = [
2.5,
50,
75,
90,
97.5,
99,
99.9,
99.99,
Expand All @@ -29,7 +31,7 @@ module.exports.histAsObj = function (hist, total) {

module.exports.addPercentiles = function (hist, result) {
percentiles.forEach(function (perc) {
const key = ('p' + perc).replace('.', '')
const key = ('p' + perc).replace('.', '_')
if (typeof hist.percentile === 'function') {
result[key] = hist.percentile(perc)
} else if (typeof hist.getValueAtPercentile === 'function') {
Expand Down
Loading

0 comments on commit a69bd9f

Please sign in to comment.