1 | "use strict";
|
2 | var __importDefault = (this && this.__importDefault) || function (mod) {
|
3 | return (mod && mod.__esModule) ? mod : { "default": mod };
|
4 | };
|
5 | Object.defineProperty(exports, "__esModule", { value: true });
|
6 | const chalk_1 = __importDefault(require("chalk"));
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 | function format(input, debug = false) {
|
14 | const defaultInput = Object.assign({ type: undefined, scope: undefined, subject: undefined, body: undefined, footer: undefined }, input);
|
15 | const results = debug
|
16 | ? Object.entries(defaultInput).reduce((registry, [name, value]) => {
|
17 | registry[name] =
|
18 | value === undefined ? chalk_1.default.grey(`<${name}>`) : chalk_1.default.bold(value);
|
19 | return registry;
|
20 | }, {})
|
21 | : defaultInput;
|
22 |
|
23 | const { type, scope, subject, body, footer } = results;
|
24 | return [
|
25 | `${type || ''}${scope ? `(${scope})` : ''}${type || scope ? ':' : ''} ${subject || ''}`,
|
26 | body,
|
27 | footer,
|
28 | ]
|
29 | .filter(Boolean)
|
30 | .join('\n');
|
31 | }
|
32 | exports.default = format;
|
33 |
|
\ | No newline at end of file |