Skip to content

Commit

Permalink
fix: interval formatting helper in node 12 (#200)
Browse files Browse the repository at this point in the history
  • Loading branch information
chadian authored and RasPhilCo committed Dec 19, 2019
1 parent 5faf352 commit 346b0d8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion .travis.yml
@@ -1,6 +1,7 @@
language: node_js
node_js:
- "8.1.3"
- "10.18.0"
- "12.14.0"
env:
- CXX=g++-4.9
addons:
Expand Down
3 changes: 2 additions & 1 deletion lib/shared.js
Expand Up @@ -112,7 +112,8 @@ function formatIntervalFromMilliseconds (milliseconds) {
minute: (60 * 1000),
second: 1000
}
let intervals = Object.keys(multipliers).sort((interval) => -multipliers[interval])
let intervals = Object.keys(multipliers)
.sort((intervalA, intervalB) => multipliers[intervalB] - multipliers[intervalA])
let values = intervals.reduce((accum, interval) => { accum[interval] = 0; return accum }, {})
let smallest = multipliers[intervals[intervals.length - 1]]

Expand Down

0 comments on commit 346b0d8

Please sign in to comment.