Compare commits

..

4 commits

Author SHA1 Message Date
Ethan Lane f67e001cf0 v2.1.3
All checks were successful
continuous-integration/drone/push Build is passing
2023-07-03 17:55:46 +01:00
Ethan Lane 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
Ethan Lane d3d921b3c8 v2.1.2
All checks were successful
continuous-integration/drone/push Build is passing
2023-05-29 16:52:13 +01:00
Ethan Lane 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 13 additions and 21 deletions

5
.gitignore vendored
View file

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

View file

@ -1,6 +1,6 @@
{ {
"name": "random-bunny", "name": "random-bunny",
"version": "2.1.1", "version": "2.1.3",
"description": "Get a random subreddit image url", "description": "Get a random subreddit image url",
"license": "MIT", "license": "MIT",
"author": "Vylpes", "author": "Vylpes",
@ -49,7 +49,8 @@
"typescript": "^5.0.0" "typescript": "^5.0.0"
}, },
"resolutions": { "resolutions": {
"np/**/got": "^11.8.5" "np/**/got": "^11.8.5",
"**/semver": "^7.5.2"
}, },
"files": [ "files": [
"dist" "dist"

View file

@ -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];

View file

@ -3841,23 +3841,13 @@ semver-diff@^3.1.1:
dependencies: dependencies:
semver "^6.3.0" semver "^6.3.0"
"semver@2 || 3 || 4 || 5": "semver@2 || 3 || 4 || 5", semver@7.x, semver@^6.0.0, semver@^6.2.0, semver@^6.3.0, semver@^7.3.4, semver@^7.3.5, semver@^7.3.7, semver@^7.5.2:
version "5.7.1" version "7.5.3"
resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.1.tgz#a954f931aeba508d307bbf069eff0c01c96116f7" resolved "https://registry.yarnpkg.com/semver/-/semver-7.5.3.tgz#161ce8c2c6b4b3bdca6caadc9fa3317a4c4fe88e"
integrity sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ== integrity sha512-QBlUtyVk/5EeHbi7X0fw6liDZc7BBmEaSYn01fMU1OUYbf6GPsbTtd8WmnqbI20SeycoHSeiybkE/q1Q+qlThQ==
semver@7.x, semver@^7.3.4, semver@^7.3.5, semver@^7.3.7:
version "7.5.1"
resolved "https://registry.yarnpkg.com/semver/-/semver-7.5.1.tgz#c90c4d631cf74720e46b21c1d37ea07edfab91ec"
integrity sha512-Wvss5ivl8TMRZXXESstBA4uR5iXgEN/VC5/sOcuXdVLzcdkz4HWetIoRfG5gb5X+ij/G9rw9YoGn3QoQ8OCSpw==
dependencies: dependencies:
lru-cache "^6.0.0" lru-cache "^6.0.0"
semver@^6.0.0, semver@^6.2.0, semver@^6.3.0:
version "6.3.0"
resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.0.tgz#ee0a64c8af5e8ceea67687b133761e1becbd1d3d"
integrity sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==
shebang-command@^2.0.0: shebang-command@^2.0.0:
version "2.0.0" version "2.0.0"
resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-2.0.0.tgz#ccd0af4f8835fbdc265b82461aaf0c36663f34ea" resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-2.0.0.tgz#ccd0af4f8835fbdc265b82461aaf0c36663f34ea"