Compare commits

..

5 commits

Author SHA1 Message Date
RenovateBot 031ad992ed Update dependency got to v13
All checks were successful
continuous-integration/drone/push Build is passing
2023-07-09 23:03:40 +00:00
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 19 additions and 27 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",
@ -49,7 +49,8 @@
"typescript": "^5.0.0"
},
"resolutions": {
"np/**/got": "^13.0.0"
"np/**/got": "^13.0.0",
"**/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];

View file

@ -654,9 +654,9 @@
integrity sha512-t09vSN3MdfsyCHoFcTRCH/iUtG7OJ0CsjzB8cjAmKc/va/kIgeDI/TxsigdncE/4be734m0cvIYwNaV4i2XqAw==
"@sindresorhus/is@^5.2.0":
version "5.3.0"
resolved "https://registry.yarnpkg.com/@sindresorhus/is/-/is-5.3.0.tgz#0ec9264cf54a527671d990eb874e030b55b70dcc"
integrity sha512-CX6t4SYQ37lzxicAqsBtxA3OseeoVrh9cSJ5PFYam0GksYlupRfy1A+Q4aYD3zvcfECLc0zO2u+ZnR2UYKvCrw==
version "5.4.1"
resolved "https://registry.yarnpkg.com/@sindresorhus/is/-/is-5.4.1.tgz#c4383ce702fb90531c3d310506bab89e70427c53"
integrity sha512-axlrvsHlHlFmKKMEg4VyvMzFr93JWJj4eIfXY1STVuO2fsImCa7ncaiG5gC8HKOX590AW5RtRsC41/B+OfrSqw==
"@sinonjs/commons@^3.0.0":
version "3.0.0"
@ -1237,9 +1237,9 @@ cacheable-request@7.0.2:
responselike "^2.0.0"
cacheable-request@^10.2.8:
version "10.2.10"
resolved "https://registry.yarnpkg.com/cacheable-request/-/cacheable-request-10.2.10.tgz#1785984a9a4ddec8dd01792232cca474be49a8af"
integrity sha512-v6WB+Epm/qO4Hdlio/sfUn69r5Shgh39SsE9DSd4bIezP0mblOlObI+I0kUEM7J0JFc+I7pSeMeYaOYtX1N/VQ==
version "10.2.12"
resolved "https://registry.yarnpkg.com/cacheable-request/-/cacheable-request-10.2.12.tgz#05b97a3199d1ee65c360eb45c5af6191faa3ab6b"
integrity sha512-qtWGB5kn2OLjx47pYUkWicyOpK1vy9XZhq8yRTXOy+KAmjjESSRLx6SiExnnaGGUP1NM6/vmygMu0fGylNh9tw==
dependencies:
"@types/http-cache-semantics" "^4.0.1"
get-stream "^6.0.1"
@ -3873,23 +3873,13 @@ semver-diff@^3.1.1:
dependencies:
semver "^6.3.0"
"semver@2 || 3 || 4 || 5":
version "5.7.1"
resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.1.tgz#a954f931aeba508d307bbf069eff0c01c96116f7"
integrity sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==
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==
"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 "7.5.3"
resolved "https://registry.yarnpkg.com/semver/-/semver-7.5.3.tgz#161ce8c2c6b4b3bdca6caadc9fa3317a4c4fe88e"
integrity sha512-QBlUtyVk/5EeHbi7X0fw6liDZc7BBmEaSYn01fMU1OUYbf6GPsbTtd8WmnqbI20SeycoHSeiybkE/q1Q+qlThQ==
dependencies:
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:
version "2.0.0"
resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-2.0.0.tgz#ccd0af4f8835fbdc265b82461aaf0c36663f34ea"