UNPKG

630 BJavaScriptView Raw
1"use strict";
2
3const formatDuplicates = require("./format-duplicates");
4const formatVersions = require("./format-versions");
5
6function formatProblems(data) {
7 const duplicates = formatDuplicates(data.duplicates);
8 const versions = formatVersions(data.versions);
9
10 if (!duplicates && !versions) {
11 return "{green-fg}No problems detected!{/}";
12 }
13 if (duplicates && !versions) {
14 return `{green-fg}No version skews!{/}\n\n${duplicates}`;
15 }
16 if (!duplicates && versions) {
17 return `{green-fg}No duplicate files!{/}\n\n${versions}`;
18 }
19
20 return `${duplicates}\n${versions}`;
21}
22
23module.exports = { formatProblems };