UNPKG

npm-upgrade

Version:

Interactive CLI utility to easily update outdated NPM dependencies

46 lines (45 loc) 1.06 kB
"use strict"; var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); Object.defineProperty(exports, "__esModule", { value: true }); exports.createSimpleTable = createSimpleTable; var _cliTable = _interopRequireDefault(require("cli-table")); const COL_ALIGNS_MAP = { l: 'left', r: 'right', c: 'middle' }; function createSimpleTable(rows, opts = {}) { if (opts.colAligns) { opts.colAligns = opts.colAligns.split('').map(val => COL_ALIGNS_MAP[val]); } const table = new _cliTable.default({ style: { 'padding-left': 2 }, colAligns: ['left', 'right', 'right', 'right', 'middle'], chars: { 'top': '', 'top-mid': '', 'top-left': '', 'top-right': '', 'bottom': '', 'bottom-mid': '', 'bottom-left': '', 'bottom-right': '', 'left': '', 'left-mid': '', 'mid': '', 'mid-mid': '', 'right': '', 'right-mid': '', 'middle': '' }, ...opts }); if (rows) { table.push(...rows); } return table; }