Added wrapper support

The wrapper marks the unprintable characters from each style tag.
This is very useful when debugging or outputing it in different terminals. You can use it to identify the unprintable characters or even to escape them.

Also added tests for it.
Added a description about it to the readme dile.
wq
This commit is contained in:
Felipe 2018-02-04 15:10:22 -02:00
parent 6554030550
commit 503159805f
5 changed files with 65 additions and 3 deletions

7
types/index.d.ts vendored
View file

@ -11,6 +11,12 @@ export const enum Level {
export interface ChalkOptions {
enabled?: boolean;
level?: Level;
wrapper?: Wrapper;
}
export interface Wrapper {
pre: String,
post: String
}
export interface ChalkConstructor {
@ -31,6 +37,7 @@ export interface Chalk {
constructor: ChalkConstructor;
enabled: boolean;
level: Level;
wrapper: Wrapper;
rgb(r: number, g: number, b: number): this;
hsl(h: number, s: number, l: number): this;
hsv(h: number, s: number, v: number): this;