Add default value to sortBy variable
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
e10bdaf115
commit
fa0b06cfdc
1 changed files with 2 additions and 2 deletions
|
@ -10,8 +10,8 @@ const sortable = [
|
|||
'top'
|
||||
];
|
||||
|
||||
export default async function randomBunny(subreddit: string, sortBy?: string): Promise<IReturnResult> {
|
||||
if (!sortBy || !sortable.includes(sortBy)) sortBy = 'hot';
|
||||
export default async function randomBunny(subreddit: string, sortBy: string = 'hot'): Promise<IReturnResult> {
|
||||
if (!sortable.includes(sortBy)) sortBy = 'hot';
|
||||
|
||||
const result = await fetch(`https://reddit.com/r/${subreddit}/${sortBy}.json`);
|
||||
|
||||
|
|
Loading…
Reference in a new issue