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.

29 lines
753 B

4 years ago
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.default = void 0;
  6. var _truncate2 = _interopRequireDefault(require("lodash/truncate"));
  7. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  8. /**
  9. * @todo Make it work with ASCII content.
  10. * @param {table~row[]} rows
  11. * @param {Object} config
  12. * @returns {table~row[]}
  13. */
  14. const truncateTableData = (rows, config) => {
  15. return rows.map(cells => {
  16. return cells.map((content, index) => {
  17. return (0, _truncate2.default)(content, {
  18. length: config.columns[index].truncate
  19. });
  20. });
  21. });
  22. };
  23. var _default = truncateTableData;
  24. exports.default = _default;
  25. //# sourceMappingURL=truncateTableData.js.map