padTableData.js 621 B

12345678910111213141516
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. exports.padTableData = exports.padString = void 0;
  4. const padString = (input, paddingLeft, paddingRight) => {
  5. return ' '.repeat(paddingLeft) + input + ' '.repeat(paddingRight);
  6. };
  7. exports.padString = padString;
  8. const padTableData = (rows, config) => {
  9. return rows.map((cells) => {
  10. return cells.map((cell, cellIndex) => {
  11. const { paddingLeft, paddingRight } = config.columns[cellIndex];
  12. return exports.padString(cell, paddingLeft, paddingRight);
  13. });
  14. });
  15. };
  16. exports.padTableData = padTableData;