@santi100/coloring-lib
Advanced tools
Comparing version 1.0.2 to 1.0.3
declare type Color = 'black' | 'red' | 'green' | 'yellow' | 'blue' | 'magenta' | 'cyan' | 'white' | 'bold'; | ||
declare type Effect = 'bold' | 'blink' | 'conceal'; | ||
declare type Parameter = Color | Effect; | ||
@@ -8,14 +10,4 @@ /** | ||
*/ | ||
declare function coloring(string: string, color: Color): string; | ||
/* declare namespace Coloring { | ||
export const black: () => string; | ||
export const red: () => string; | ||
export const green: () => string; | ||
export const yellow: () => string; | ||
export const blue: () => string; | ||
export const magenta: () => string; | ||
export const cyan: () => string; | ||
export const white: () => string; | ||
export const bold: () => string; | ||
} */ | ||
declare function coloring(string: string, color: Parameter): string; | ||
declare class Coloring { | ||
@@ -22,0 +14,0 @@ black(text: string): Coloring; |
declare type Color = 'black' | 'red' | 'green' | 'yellow' | 'blue' | 'magenta' | 'cyan' | 'white' | | ||
'bold' | 'blink' | 'conceal'; | ||
declare type Effect = 'bold' | 'blink' | 'conceal'; | ||
declare type Parameter = Color | Effect; | ||
declare type ParameterArray = Parameter[]; | ||
@@ -16,3 +18,3 @@ /** | ||
*/ | ||
declare function coloring(string: string, color: [Color, ...Effect]): string; | ||
declare function coloring(string: string, color: ParameterArray): string; | ||
@@ -33,3 +35,3 @@ declare class Coloring { | ||
} | ||
export { coloring, Coloring, type Color, type Effect }; | ||
export { coloring, Coloring, type Color, type Effect, type Parameter, type ParameterArray }; | ||
export default coloring; |
@@ -17,3 +17,7 @@ // @ts-check | ||
function coloring(string, color) { | ||
assertType(color, 'string'); assert(Array.isArray(color)); | ||
assertType(color, 'string'); assert(Array.isArray(color), { | ||
expected: true, | ||
actual: Array.isArray(color), | ||
operator: 'Array.isArray()' | ||
}); | ||
if (typeof color === 'string') | ||
@@ -20,0 +24,0 @@ return `${COLORS[color.toLowerCase()]}${string}\x1b[0m`; |
{ | ||
"name": "@santi100/coloring-lib", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"repository": { | ||
"url": "https://github.com/santi100a/coloring-lib" | ||
}, | ||
"main": "index.js", | ||
"license": "Other", | ||
"dependencies": { | ||
"@santi100/assertion-lib": "^1.0.1" | ||
"@santi100/assertion-lib": "^1.0.2" | ||
}, | ||
"type": "module" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
8582
36
205