calculateCellWidthIndex.js 499 B

1234567891011121314151617181920212223
  1. 'use strict';
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. var _stringWidth = require('string-width');
  6. var _stringWidth2 = _interopRequireDefault(_stringWidth);
  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. exports.default = cells => {
  15. return cells.map(value => {
  16. return (0, _stringWidth2.default)(value);
  17. });
  18. };