Software zum Installieren eines Smart-Mirror Frameworks , zum Nutzen von hochschulrelevanten Informationen, auf einem Raspberry-Pi.
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.

truncateTableData.js 850B

1234567891011121314151617181920212223
  1. "use strict";
  2. var __importDefault = (this && this.__importDefault) || function (mod) {
  3. return (mod && mod.__esModule) ? mod : { "default": mod };
  4. };
  5. Object.defineProperty(exports, "__esModule", { value: true });
  6. exports.truncateTableData = exports.truncateString = void 0;
  7. const lodash_truncate_1 = __importDefault(require("lodash.truncate"));
  8. const truncateString = (input, length) => {
  9. return lodash_truncate_1.default(input, { length,
  10. omission: '…' });
  11. };
  12. exports.truncateString = truncateString;
  13. /**
  14. * @todo Make it work with ASCII content.
  15. */
  16. const truncateTableData = (rows, config) => {
  17. return rows.map((cells) => {
  18. return cells.map((cell, cellIndex) => {
  19. return exports.truncateString(cell, config.columns[cellIndex].truncate);
  20. });
  21. });
  22. };
  23. exports.truncateTableData = truncateTableData;