本文整理汇总了TypeScript中cli-table.push函数的典型用法代码示例。如果您正苦于以下问题:TypeScript push函数的具体用法?TypeScript push怎么用?TypeScript push使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了push函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: table
export function table(log: ILogLevels, options: ILogTableOptions = {}) {
const { head = [], colWidths = [] } = options;
const t = new Table({
head: compact(head),
colWidths,
});
const api: ILogTable = {
/**
* Adds a new row to the table.
*/
add(columns: Array<string | number | undefined>) {
t.push(columns.map(row => (row === undefined ? '' : row.toString())));
return api;
},
/**
* Converts the table to a string.
*/
toString() {
return t.toString();
},
/**
* Logs the table to the console.
*/
log() {
log.info(api.toString());
return api;
},
};
return api;
}
示例2:
customers.forEach((customer: any) => {
table.push([
customer.id,
customer.companyProfile.companyName,
customer.companyProfile.domain,
customer.companyProfile.tenantId
]);
});
示例3: logLeenaConfiguration
function logLeenaConfiguration (leenaConfiguration) : void {
var table = new Table ({ });
table.push (
// Header
[
chalk.bold.green ('Service'),
chalk.bold.green ('IP/Path'),
chalk.bold.green ('Port')
],
// Watcher info
[
'Watcher',
leenaConfiguration.browserSync.watcher.server,
[
'{',
leenaConfiguration.browserSync.watcher.port,
', ',
leenaConfiguration.browserSync.watcher.uiPort,
'}'
].join ('')
],
// Web server info
[
'Web Server',
leenaConfiguration.browserSync.webServer.server,
[
'{',
leenaConfiguration.browserSync.webServer.port,
', ',
leenaConfiguration.browserSync.webServer.uiPort,
'}'
].join ('')
],
// Chrome tester server info
[
'Chrome Tester Server',
leenaConfiguration.chromeTester.testerServer.hostname,
leenaConfiguration.chromeTester.testerServer.port
],
// Chrome remote protocol info
[
'Chrome Remote Protocol',
leenaConfiguration.chromeTester.debuggingProtocol.hostname,
leenaConfiguration.chromeTester.debuggingProtocol.port
]
);
console.log (table.toString ());
}
示例4: 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;
}
示例5: 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 => {
示例6: 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)
});
示例7:
domainList.forEach((item) => {
table.push(item)
})