Feature/7 migrate to typescript #21

Merged
Vylpes merged 6 commits from feature/7-migrate-to-typescript into develop 2021-12-02 10:36:16 +00:00
Showing only changes of commit dbf1d03524 - Show all commits

View file

@ -8,8 +8,8 @@ const sortable = [
'top'
];
export default async function randomBunny(subreddit: string, sortBy: string, maxTries = 100): Promise<IFetchResult> {
if (!sortable.includes(sortBy)) sortBy = 'hot';
export default async function randomBunny(subreddit: string, sortBy?: string, maxTries = 100): Promise<IFetchResult> {
if (!sortBy || !sortable.includes(sortBy)) sortBy = 'hot';
const result = await fetch(`https://reddit.com/r/${subreddit}/${sortBy}.json`);