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.

27 lines
689 B

4 years ago
  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. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  8. /**
  9. * Calculates width of each cell contents.
  10. *
  11. * @param {string[]} cells
  12. * @returns {number[]}
  13. */
  14. const calculateCellWidthIndex = cells => {
  15. return cells.map(value => {
  16. return Math.max(...value.split('\n').map(line => {
  17. return (0, _stringWidth.default)(line);
  18. }));
  19. });
  20. };
  21. var _default = calculateCellWidthIndex;
  22. exports.default = _default;
  23. //# sourceMappingURL=calculateCellWidthIndex.js.map