diff options
author | mat <github@matdoes.dev> | 2021-12-30 16:18:57 -0600 |
---|---|---|
committer | mat <github@matdoes.dev> | 2021-12-30 16:18:57 -0600 |
commit | 342d31e99d1fbd7bcc941e34bb2a175382f3e26e (patch) | |
tree | c735fa67652d49386d3b55b42567ea3ebd57c5c4 /build/util.js | |
parent | f7d1263ea669968a4b69d80cede9b77f240de4b6 (diff) | |
download | skyblock-api-342d31e99d1fbd7bcc941e34bb2a175382f3e26e.tar.gz skyblock-api-342d31e99d1fbd7bcc941e34bb2a175382f3e26e.tar.bz2 skyblock-api-342d31e99d1fbd7bcc941e34bb2a175382f3e26e.zip |
remove build folder
Diffstat (limited to 'build/util.js')
-rw-r--r-- | build/util.js | 70 |
1 files changed, 0 insertions, 70 deletions
diff --git a/build/util.js b/build/util.js deleted file mode 100644 index e78e390..0000000 --- a/build/util.js +++ /dev/null @@ -1,70 +0,0 @@ -/** - * Random utility functions that are not related to Hypixel - */ -export function undashUuid(uuid) { - return uuid.replace(/-/g, '').toLowerCase(); -} -export function jsonToQuery(data) { - return Object.entries(data || {}).map(e => e.join('=')).join('&'); -} -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; -} -export const minecraftColorCodes = { - '0': '#000000', - '1': '#0000be', - '2': '#00be00', - '3': '#00bebe', - '4': '#be0000', - '5': '#be00be', - '6': '#ffaa00', - '7': '#bebebe', - '8': '#3f3f3f', - '9': '#3f3ffe', - 'a': '#3ffe3f', - 'b': '#3ffefe', - 'c': '#fe3f3f', - 'd': '#fe3ffe', - 'e': '#fefe3f', - 'f': '#ffffff', - 'black': '#000000', - 'dark_blue': '#0000be', - 'dark_green': '#00be00', - 'dark_aqua': '#00bebe', - 'dark_red': '#be0000', - 'dark_purple': '#be00be', - 'gold': '#ffaa00', - 'gray': '#bebebe', - 'dark_gray': '#3f3f3f', - 'blue': '#3f3ffe', - 'green': '#3ffe3f', - 'aqua': '#3ffefe', - 'red': '#fe3f3f', - 'light_purple': '#fe3ffe', - 'yellow': '#fefe3f', - 'white': '#ffffff', -}; -/** - * Converts a color name to the code - * For example: blue -> 9 - * @param colorName The name of the color (blue, red, aqua, etc) - */ -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; - } -} -export async function sleep(ms) { - await new Promise(resolve => setTimeout(resolve, ms)); -} -/** Returns whether a string is a UUID4 (Minecraft uuid) */ -export function isUuid(string) { - return undashUuid(string).length === 32; -} |