Sha256: aa42111b6dcd8d3e591719577c3903a7c5b98db9f7e62e39e4401bf124132ba7

Contents?: true

Size: 328 Bytes

Versions: 23

Compression:

Stored size: 328 Bytes

Contents

import stringWidth from 'string-width';

/**
 * Calculates width of each cell contents.
 *
 * @param {string[]} cells
 * @returns {number[]}
 */
export default (cells) => {
  return cells.map((value) => {
    return Math.max(
      ...value.split('\n').map((line) => {
        return stringWidth(line);
      })
    );
  });
};

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
trusty-cms-5.0.7 node_modules/table/dist/calculateCellWidthIndex.js.flow
trusty-cms-5.0.6 node_modules/table/dist/calculateCellWidthIndex.js.flow
trusty-cms-5.0.5 node_modules/table/dist/calculateCellWidthIndex.js.flow
trusty-cms-5.0.4 node_modules/table/dist/calculateCellWidthIndex.js.flow
trusty-cms-5.0.3 node_modules/table/dist/calculateCellWidthIndex.js.flow
trusty-cms-5.0.2 node_modules/table/dist/calculateCellWidthIndex.js.flow
trusty-cms-5.0.1 node_modules/table/dist/calculateCellWidthIndex.js.flow
trusty-cms-4.3.5 node_modules/table/dist/calculateCellWidthIndex.js.flow
trusty-cms-5.0.0 node_modules/table/dist/calculateCellWidthIndex.js.flow
trusty-cms-4.3.4 node_modules/table/dist/calculateCellWidthIndex.js.flow
trusty-cms-4.3.3 node_modules/table/dist/calculateCellWidthIndex.js.flow
trusty-cms-4.3.2 node_modules/table/dist/calculateCellWidthIndex.js.flow
trusty-cms-4.3.1 node_modules/table/dist/calculateCellWidthIndex.js.flow
trusty-cms-4.3 node_modules/table/dist/calculateCellWidthIndex.js.flow
trusty-cms-4.2.3 node_modules/table/dist/calculateCellWidthIndex.js.flow
trusty-cms-4.2.2 node_modules/table/dist/calculateCellWidthIndex.js.flow
trusty-cms-4.2.1 node_modules/table/dist/calculateCellWidthIndex.js.flow
trusty-cms-4.2 node_modules/table/dist/calculateCellWidthIndex.js.flow
trusty-cms-4.1.9 node_modules/table/dist/calculateCellWidthIndex.js.flow
trusty-cms-4.1.8 node_modules/table/dist/calculateCellWidthIndex.js.flow