Compare commits
2 commits
e7620ccd42
...
d3d921b3c8
Author | SHA1 | Date | |
---|---|---|---|
d3d921b3c8 | |||
e766a42235 |
3 changed files with 7 additions and 6 deletions
7
.gitignore
vendored
7
.gitignore
vendored
|
@ -1,3 +1,4 @@
|
||||||
node_modules
|
node_modules/
|
||||||
dist
|
dist/
|
||||||
yarn-error.log
|
coverage/
|
||||||
|
yarn-error.log
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "random-bunny",
|
"name": "random-bunny",
|
||||||
"version": "2.1.1",
|
"version": "2.1.2",
|
||||||
"description": "Get a random subreddit image url",
|
"description": "Get a random subreddit image url",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"author": "Vylpes",
|
"author": "Vylpes",
|
||||||
|
|
|
@ -41,8 +41,8 @@ export default async function randomBunny(subreddit: string, sortBy?: string): P
|
||||||
return {
|
return {
|
||||||
IsSuccess: false,
|
IsSuccess: false,
|
||||||
};
|
};
|
||||||
} else if (dataWithImages.length > 1) {
|
} else {
|
||||||
random = Math.floor((Math.random() * dataWithImages.length - 1) + 0); // Between 0 and (size - 1)
|
random = Math.floor((Math.random() * (dataWithImages.length - 1)) + 0); // Between 0 and (size - 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
const randomSelect = dataWithImages[random];
|
const randomSelect = dataWithImages[random];
|
||||||
|
|
Loading…
Reference in a new issue