1 import stringWidth from 'string-width';
2 import alignString from './alignString';
5 * @param {table~row[]} rows
6 * @param {object} config
7 * @returns {table~row[]}
9 export default (rows, config) => {
10 return rows.map((cells) => {
11 return cells.map((value, index1) => {
12 const column = config.columns[index1];
14 if (stringWidth(value) === column.width) {
17 return alignString(value, column.width, column.alignment);