1 | "use strict";
|
2 |
|
3 | Object.defineProperty(exports, "__esModule", {
|
4 | value: true
|
5 | });
|
6 | exports.sectionHeader = exports.listItem = void 0;
|
7 |
|
8 | var _colors = _interopRequireDefault(require("colors"));
|
9 |
|
10 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
11 |
|
12 | const bulletPoint = ` • `;
|
13 | const arrow = ` └> `;
|
14 | const genericRowPad = ` `;
|
15 |
|
16 | const shouldNewLine = condition => condition ? '\n' : '';
|
17 |
|
18 | const createListItem = values => {
|
19 | const [first, second, ...rest] = values;
|
20 | let value = `${bulletPoint}${first}${shouldNewLine(!!second)}`;
|
21 |
|
22 | if (second) {
|
23 | value += `${arrow}${second}${shouldNewLine(rest.length > 0)}`;
|
24 | }
|
25 |
|
26 | if (rest.length > 0) {
|
27 | rest.forEach((r, i) => {
|
28 | value += `${genericRowPad}${r}${shouldNewLine(i !== rest.length - 1)}`;
|
29 | });
|
30 | }
|
31 |
|
32 | return _colors.default.bold(value);
|
33 | };
|
34 |
|
35 | const listItem = (...values) => {
|
36 | const validItems = values.map(o => {
|
37 | if (!o) return '';
|
38 | return o;
|
39 | }).filter(o => !!o);
|
40 | console.log(createListItem(validItems));
|
41 | };
|
42 |
|
43 | exports.listItem = listItem;
|
44 |
|
45 | const sectionHeader = title => {
|
46 | console.log(_colors.default.green(`===> ${_colors.default.bold(title)} <===`));
|
47 | };
|
48 |
|
49 | exports.sectionHeader = sectionHeader; |
\ | No newline at end of file |