discordjs-colors-bundle
Advanced tools
Comparing version 2.0.0 to 2.0.1
{ | ||
"name": "discordjs-colors-bundle", | ||
"version": "2.0.0", | ||
"version": "2.0.1", | ||
"description": "Tons of colors for your DiscordJS bot's embed", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
@@ -9,9 +9,11 @@ function getRandomHexColor() { | ||
} | ||
/** | ||
* | ||
* @param {string} hexCode | ||
* @returns {number} number | ||
*/ | ||
function CustomHex(hexCode) { | ||
var prefix = "0x"; | ||
var hCode = hexCode.toString(); | ||
hCode.replace(/#/g, prefix); | ||
return parseInt(hCode); | ||
var hCode = hexCode.toString().replace(/^#/, prefix); | ||
return parseInt(hCode, 16); | ||
} | ||
@@ -240,20 +242,30 @@ | ||
function AmountError(message) { | ||
/** | ||
* | ||
* @param {prefixInput} prefix | ||
* @param {...any} message | ||
* @returns {ColorNameError} ColorNamesError | ||
*/ | ||
function ColorNameError(prefix, ...message) { | ||
Error.call(this); | ||
this.message = `[InvalidAmount]: ${message}`; | ||
this.name = "AmountError"; | ||
this.message = `[${prefix}]: ${message.join(" ")}`; | ||
this.name = "ColorNameError"; | ||
if (Error.captureStackTrace) { | ||
Error.captureStackTrace(this, AmountError); | ||
Error.captureStackTrace(this, ColorNameError); | ||
} | ||
} | ||
AmountError.prototype = Object.create(Error.prototype); | ||
ColorNameError.prototype = Object.create(Error.prototype); | ||
function colorNames(colors) { | ||
if (typeof colors === "undefined") { | ||
throw new Error("No colors object provided."); | ||
throw new ColorNameError("NoObjectProvided", "No colors object provided."); | ||
} | ||
if (typeof colors !== "object") { | ||
throw new TypeError(` | ||
Expected colors to be an "object" but got "${typeof colors}" instead.`); | ||
throw new ColorNameError( | ||
"TypeError", | ||
` | ||
Expected colors to be an "object" but got "${typeof colors}" instead.` | ||
); | ||
} | ||
@@ -278,2 +290,8 @@ var colorNames = Object.keys(colors); | ||
/** | ||
* | ||
* @param {HexValueInput} hexValue | ||
* @returns {ansiCode} ansiCode | ||
*/ | ||
function hexToAnsi(hexValue) { | ||
@@ -280,0 +298,0 @@ var hexString = hexValue.toString(16).padStart(6, "0"); |
declare function getRandomHexColor(): number; | ||
/** | ||
* | ||
* @param {string} hexCode | ||
* @returns {number} number | ||
*/ | ||
declare function CustomHex(hexCode: string): number; | ||
declare interface DiscordColors { | ||
[key: number]: number; | ||
interface Colors { | ||
[key: string]: number; | ||
} | ||
/** | ||
* - The color object for Discord.js | ||
* - It has more than 50 colors | ||
* - It only works with Discord.js | ||
*/ | ||
declare const colors: Colors; | ||
interface ColorsObject { | ||
obj: object; | ||
} | ||
declare function colorNames(obj: ColorsObject): string; | ||
declare const colors: DiscordColors; | ||
export { getRandomHexColor, CustomHex, colors, colorNames }; | ||
export { getRandomHexColor, CustomHex, colors }; |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
10895
319
0