New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

discordjs-colors-bundle

Package Overview
Dependencies
Maintainers
2
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

discordjs-colors-bundle - npm Package Compare versions

Comparing version 2.0.0 to 2.0.1

2

package.json
{
"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 };
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc