bit-bin
Version:
<a href="https://opensource.org/licenses/Apache-2.0"><img alt="apache" src="https://img.shields.io/badge/License-Apache%202.0-blue.svg"></a> <a href="https://github.com/teambit/bit/blob/master/CONTRIBUTING.md"><img alt="prs" src="https://img.shields.io/b
49 lines (37 loc) • 1.1 kB
JavaScript
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = formatDiagnosesList;
function _chalk() {
const data = _interopRequireDefault(require("chalk"));
_chalk = function () {
return data;
};
return data;
}
function _table() {
const data = require("table");
_table = function () {
return data;
};
return data;
}
// const NAME_COLUMN_WIDTH = 100;
// const DESCRIPTION_COLUMN_WIDTH = 30;
const tableColumnConfig = {
columnDefault: {
alignment: 'left'
}
};
function createRow(diagnosis) {
return [diagnosis.category, diagnosis.name, diagnosis.description];
}
function formatDiagnosesList(diagnosesList) {
const header = [_chalk().default.bold('category'), _chalk().default.bold('name'), _chalk().default.bold('description')];
const rows = diagnosesList.map(createRow); // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!
rows.unshift(header);
const output = (0, _table().table)(rows, tableColumnConfig);
return output;
}
;