DefinitelyTyped/types/decay/decay-tests.ts
2017-07-25 10:34:23 -07:00

23 lines
667 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);