/ cloudformation-templates / node_modules / aws-cdk / node_modules / table / dist / truncateTableData.js
truncateTableData.js
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;