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/util.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/util.js')
-rw-r--r-- | build/util.js | 29 |
1 files changed, 10 insertions, 19 deletions
diff --git a/build/util.js b/build/util.js index c0bbd42..e78e390 100644 --- a/build/util.js +++ b/build/util.js @@ -1,26 +1,20 @@ -"use strict"; /** * Random utility functions that are not related to Hypixel */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.isUuid = exports.sleep = exports.colorCodeFromName = exports.minecraftColorCodes = exports.shuffle = exports.jsonToQuery = exports.undashUuid = void 0; -function undashUuid(uuid) { +export function undashUuid(uuid) { return uuid.replace(/-/g, '').toLowerCase(); } -exports.undashUuid = undashUuid; -function jsonToQuery(data) { +export function jsonToQuery(data) { return Object.entries(data || {}).map(e => e.join('=')).join('&'); } -exports.jsonToQuery = jsonToQuery; -function shuffle(a) { +export function shuffle(a) { for (let i = a.length - 1; i > 0; i--) { const j = Math.floor(Math.random() * (i + 1)); [a[i], a[j]] = [a[j], a[i]]; } return a; } -exports.shuffle = shuffle; -exports.minecraftColorCodes = { +export const minecraftColorCodes = { '0': '#000000', '1': '#0000be', '2': '#00be00', @@ -59,21 +53,18 @@ exports.minecraftColorCodes = { * For example: blue -> 9 * @param colorName The name of the color (blue, red, aqua, etc) */ -function colorCodeFromName(colorName) { - const hexColor = exports.minecraftColorCodes[colorName.toLowerCase()]; - for (const key in exports.minecraftColorCodes) { - const value = exports.minecraftColorCodes[key]; +export function colorCodeFromName(colorName) { + const hexColor = minecraftColorCodes[colorName.toLowerCase()]; + for (const key in minecraftColorCodes) { + const value = minecraftColorCodes[key]; if (key.length === 1 && value === hexColor) return key; } } -exports.colorCodeFromName = colorCodeFromName; -async function sleep(ms) { +export async function sleep(ms) { await new Promise(resolve => setTimeout(resolve, ms)); } -exports.sleep = sleep; /** Returns whether a string is a UUID4 (Minecraft uuid) */ -function isUuid(string) { +export function isUuid(string) { return undashUuid(string).length === 32; } -exports.isUuid = isUuid; |