Compare commits

...

5 commits

Author SHA1 Message Date
90515ddae5 Update dependency np to v8
All checks were successful
continuous-integration/drone/push Build is passing
2023-07-09 23:03:52 +00:00
f67e001cf0 v2.1.3
All checks were successful
continuous-integration/drone/push Build is passing
2023-07-03 17:55:46 +01:00
8e268a0cc3 Upgrade semver to 7.5.2
All checks were successful
continuous-integration/drone/push Build is passing
2023-07-03 17:54:05 +01:00
d3d921b3c8 v2.1.2
All checks were successful
continuous-integration/drone/push Build is passing
2023-05-29 16:52:13 +01:00
e766a42235 Fix bug where the randomiser would pick -1
All checks were successful
continuous-integration/drone/push Build is passing
This was caused by the randomiser using the wrong brackets.

We needed the maximum index of the length - 1, but the randomiser would
take the 1 AFTER randomising, adding brackets made it do this BEFORE.
2023-05-29 16:48:01 +01:00
4 changed files with 1041 additions and 537 deletions

7
.gitignore vendored
View file

@ -1,3 +1,4 @@
node_modules
dist
yarn-error.log
node_modules/
dist/
coverage/
yarn-error.log

View file

@ -1,6 +1,6 @@
{
"name": "random-bunny",
"version": "2.1.1",
"version": "2.1.3",
"description": "Get a random subreddit image url",
"license": "MIT",
"author": "Vylpes",
@ -42,14 +42,15 @@
"eslint": "^8.35.0",
"jest": "^29.4.3",
"jest-mock-extended": "^3.0.3",
"np": "^7.7.0",
"np": "^8.0.0",
"ts-jest": "^29.0.5",
"ts-mockito": "^2.6.1",
"ts-node": "^10.9.1",
"typescript": "^5.0.0"
},
"resolutions": {
"np/**/got": "^11.8.5"
"np/**/got": "^11.8.5",
"**/semver": "^7.5.2"
},
"files": [
"dist"

View file

@ -41,8 +41,8 @@ export default async function randomBunny(subreddit: string, sortBy?: string): P
return {
IsSuccess: false,
};
} else if (dataWithImages.length > 1) {
random = Math.floor((Math.random() * dataWithImages.length - 1) + 0); // Between 0 and (size - 1)
} else {
random = Math.floor((Math.random() * (dataWithImages.length - 1)) + 0); // Between 0 and (size - 1)
}
const randomSelect = dataWithImages[random];

1560
yarn.lock

File diff suppressed because it is too large Load diff