本文整理汇总了TypeScript中cli-table.toString函数的典型用法代码示例。如果您正苦于以下问题:TypeScript toString函数的具体用法?TypeScript toString怎么用?TypeScript toString使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了toString函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: resultsTable
function resultsTable(rows) {
let result = "No results";
if(rows.length) {
let headers = Object.keys(rows[0]).filter((header) => header !== "__id");
var table = new Table({head: headers});
for(let row of rows) {
let tableRow = [];
for(let field of headers) {
tableRow.push(row[field]);
}
table.push(tableRow);
}
result = table.toString();
}
return result;
}
示例2: Table
}).then(body => {
let table = new Table({
chars: { 'mid': '', 'left-mid': '', 'mid-mid': '', 'right-mid': '' },
colWidths: [26, 30, 15, 10],
head: ['Id', 'Name', 'Size', 'Accesses'],
});
for (let file of body) {
file.size = file.size ? filesize(file.size) : 'None';
table.push([
file._id, file.name, file.size, file.accesses || 'none',
]);
}
console.log(table.toString());
resolve();
}, err => {
示例3: Table
instance.on('done', (result) => {
let table = new Table({
head: ['name', 'average', 'min', 'max']
});
table.push(
["Latency", result.latency.average, result.latency.min, result.latency.max],
["Req/Sec", result.requests.average, result.requests.min, result.requests.max]
);
console.log(table.toString());
setTimeout(() => {
child.removeAllListeners();
child.kill();
process.exit(0);
}, 10)
});