Ohm-Management - Projektarbeit B-ME
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

alignTableData.js 901B

1234567891011121314151617181920212223242526272829303132333435
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.default = void 0;
  6. var _stringWidth = _interopRequireDefault(require("string-width"));
  7. var _alignString = _interopRequireDefault(require("./alignString"));
  8. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  9. /**
  10. * @param {table~row[]} rows
  11. * @param {Object} config
  12. * @returns {table~row[]}
  13. */
  14. const alignTableData = (rows, config) => {
  15. return rows.map(cells => {
  16. return cells.map((value, index1) => {
  17. const column = config.columns[index1];
  18. if ((0, _stringWidth.default)(value) === column.width) {
  19. return value;
  20. } else {
  21. return (0, _alignString.default)(value, column.width, column.alignment);
  22. }
  23. });
  24. });
  25. };
  26. var _default = alignTableData;
  27. exports.default = _default;
  28. //# sourceMappingURL=alignTableData.js.map