diff options
author | dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> | 2021-09-06 21:06:22 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-06 21:06:22 +0000 |
commit | 487f208565894f332ca58c13e1b208c3beb9c8c6 (patch) | |
tree | b3209e94cc63658b5430bc1949b80140cc27efe4 /build/cleaners/skyblock/slayers.js | |
parent | 4f03cb71b30978b277ff292dbddeba182117a7cb (diff) | |
download | skyblock-api-487f208565894f332ca58c13e1b208c3beb9c8c6.tar.gz skyblock-api-487f208565894f332ca58c13e1b208c3beb9c8c6.tar.bz2 skyblock-api-487f208565894f332ca58c13e1b208c3beb9c8c6.zip |
Bump node-fetch from 2.6.1 to 3.0.0 (#116)
* Bump node-fetch from 2.6.1 to 3.0.0
Bumps [node-fetch](https://github.com/node-fetch/node-fetch) from 2.6.1 to 3.0.0.
- [Release notes](https://github.com/node-fetch/node-fetch/releases)
- [Changelog](https://github.com/node-fetch/node-fetch/blob/main/docs/CHANGELOG.md)
- [Commits](https://github.com/node-fetch/node-fetch/compare/v2.6.1...v3.0.0)
---
updated-dependencies:
- dependency-name: node-fetch
dependency-type: direct:production
update-type: version-update:semver-major
...
Signed-off-by: dependabot[bot] <support@github.com>
* fix issues with node fetch 3.0
* change module to esnext instead of commonjs
* fix imports and tests
* fix package-lock.json
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: mat <github@matdoes.dev>
Co-authored-by: mat <27899617+mat-1@users.noreply.github.com>
Diffstat (limited to 'build/cleaners/skyblock/slayers.js')
-rw-r--r-- | build/cleaners/skyblock/slayers.js | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/build/cleaners/skyblock/slayers.js b/build/cleaners/skyblock/slayers.js index 8575d43..75894f7 100644 --- a/build/cleaners/skyblock/slayers.js +++ b/build/cleaners/skyblock/slayers.js @@ -1,30 +1,26 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.cleanSlayers = exports.slayerLevels = void 0; -exports.slayerLevels = 5; +export const slayerLevels = 5; const SLAYER_NAMES = { spider: 'tarantula', zombie: 'revenant', wolf: 'sven' }; -function cleanSlayers(data) { - var _a, _b; +export function cleanSlayers(data) { const slayers = []; - const slayersDataRaw = data === null || data === void 0 ? void 0 : data.slayer_bosses; + const slayersDataRaw = data?.slayer_bosses; let totalXp = 0; let totalKills = 0; for (const slayerNameRaw in slayersDataRaw) { const slayerDataRaw = slayersDataRaw[slayerNameRaw]; // convert name provided by api (spider) to the real name (tarantula) const slayerName = SLAYER_NAMES[slayerNameRaw]; - const slayerXp = (_a = slayerDataRaw.xp) !== null && _a !== void 0 ? _a : 0; + const slayerXp = slayerDataRaw.xp ?? 0; let slayerKills = 0; const slayerTiers = []; for (const slayerDataKey in slayerDataRaw) { // if a key starts with boss_kills_tier_ (boss_kills_tier_1), get the last number if (slayerDataKey.startsWith('boss_kills_tier_')) { const slayerTierRaw = parseInt(slayerDataKey.substr('boss_kills_tier_'.length)); - const slayerTierKills = (_b = slayerDataRaw[slayerDataKey]) !== null && _b !== void 0 ? _b : 0; + const slayerTierKills = slayerDataRaw[slayerDataKey] ?? 0; // add 1 since hypixel is using 0 indexed tiers const slayerTier = slayerTierRaw + 1; slayerTiers.push({ @@ -37,7 +33,7 @@ function cleanSlayers(data) { } } // if the slayer tier length is less than the max, add more empty ones - while (slayerTiers.length < exports.slayerLevels) + while (slayerTiers.length < slayerLevels) slayerTiers.push({ tier: slayerTiers.length + 1, kills: 0 @@ -46,7 +42,7 @@ function cleanSlayers(data) { name: slayerName, raw_name: slayerNameRaw, tiers: slayerTiers, - xp: slayerXp !== null && slayerXp !== void 0 ? slayerXp : 0, + xp: slayerXp ?? 0, kills: slayerKills }; slayers.push(slayer); @@ -62,4 +58,3 @@ function cleanSlayers(data) { bosses: slayers }; } -exports.cleanSlayers = cleanSlayers; |