Files
DefinitelyTyped/decay/decay-tests.ts
Eric Naeseth 8c6804beec Add types for decay (#13982)
Add an optional extended description…
2017-01-13 11:40:42 -08:00

22 lines
664 B
TypeScript

import {redditHot, hackerHot, wilsonScore} from 'decay';
const upvotes = 42;
const downvotes = 12;
const posted = new Date(2017, 1, 1);
let score: number;
let redditCalculator = redditHot();
score = redditCalculator(upvotes, downvotes, posted);
redditCalculator = redditHot(10000);
score = redditCalculator(upvotes, downvotes, posted);
let hackerCalculator = hackerHot();
score = hackerCalculator(upvotes, posted);
hackerCalculator = hackerHot(1.6);
score = hackerCalculator(upvotes, posted);
let wilsonCalculator = wilsonScore();
score = wilsonCalculator(upvotes, downvotes);
wilsonCalculator = wilsonScore(1.0);
score = wilsonCalculator(upvotes, downvotes);