-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdivider.js
43 lines (40 loc) · 1.08 KB
/
divider.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
let border = require("./border.json");
let chalk = require("chalk");
let dividerObject = function (num, defaultColor) {
this.length = num;
this.color = defaultColor;
let {
vertical,
horizontal
} = border;
this.printTop = function () {
console.log(
chalk[`${this.color}`](
horizontal.repeat(this.length)
)
);
};
this.printBottom = function () {
console.log(
chalk[`${this.color}`](
horizontal.repeat(this.length)
)
);
};
this.printLine = function () {
console.log(
chalk[`${this.color}`](horizontal.repeat(this.length))
);
};
this.printVertical = function () {
console.log(chalk[`${this.color}`](vertical.repeat(this.length)));
};
this.containString = function (string, color) {
return (
chalk[`${this.color}`](vertical) +
color(string.padEnd(this.length)) +
chalk[`${this.color}`](vertical)
);
};
};
module.exports = dividerObject;