Made pad function a little easier to use
This commit is contained in:
parent
061e27d92a
commit
0e2d720fdf
@ -62,11 +62,12 @@ export class Logger extends TypedEmitter<LoggerEvents> {
|
|||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
private pad(text: string, length: number, char: string, end = false) {
|
private pad(text: any, length: number, char: string, end = false) {
|
||||||
const l = length - text.length;
|
const t = text.toString();
|
||||||
if(l <= 0) return text;
|
const l = length - t.length;
|
||||||
|
if(l <= 0) return t;
|
||||||
const padding = Array(~~(l / char.length)).fill(char).join('');
|
const padding = Array(~~(l / char.length)).fill(char).join('');
|
||||||
return !end ? padding + text : text + padding;
|
return !end ? padding + t : t + padding;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user