Line | Hits | Source |
---|---|---|
1 | 1 | 'use strict'; |
2 | ||
3 | 1 | function rank(votes, timestamp) { |
4 | ||
5 | 8 | var order = Math.log(Math.max(votes, 1)); // 0 votes -> 1 vote |
6 | 8 | var delta = timestamp - rank.epoch; |
7 | ||
8 | 8 | return order + (delta / rank.baseTime); |
9 | ||
10 | } | |
11 | ||
12 | 1 | rank.epoch = new Date(1970, 1, 1).getTime(); |
13 | 1 | rank.baseTime = 12 * 60 * 60 * 1000; // 12 hours |
14 | ||
15 | 1 | module.exports = rank; |