本文整理汇总了TypeScript中table.table函数的典型用法代码示例。如果您正苦于以下问题:TypeScript table函数的具体用法?TypeScript table怎么用?TypeScript table使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了table函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: async
export default async (props: ProjectsProps, env: SystemEnvironment): Promise<void> => {
const {resolver, out} = env
try {
const projects = await fetchProjects(resolver)
const currentProjectId = resolver.exists(graphcoolProjectFileName) ?
readProjectIdFromProjectFile(resolver, graphcoolProjectFileName) :
null
const data = projects.map(project => {
const isCurrentProject = currentProjectId !== null && (currentProjectId === project.projectId || currentProjectId === project.alias)
return [isCurrentProject ? '*' : ' ', `${project.alias || project.projectId} `, project.name, regionEnumToOption(project.region)]
})
const output = table(data, {
border: getBorderCharacters('void'),
columnDefault: {
paddingLeft: '0',
paddingRight: '2',
},
drawHorizontalLine: () => false,
}).trimRight()
out.write(output)
} catch (e) {
throw new Error(`${couldNotFetchProjectsMessage} ${e.message}`)
}
}
开发者ID:sadeeqaji,项目名称:graphcool-cli,代码行数:31,代码来源:projects.ts
示例2:
import * as table from 'table';
const border: table.JoinStruct = table.getBorderCharacters('norc');
const data = [
['first name', 'last name'],
['jane', 'doe'],
['john', 'doe']
];
const config: table.TableUserConfig = {
border,
columnCount: 1,
drawHorizontalLine: () => true
};
table.table(data, config);
开发者ID:Dru89,项目名称:DefinitelyTyped,代码行数:17,代码来源:table-tests.ts
示例3:
const displayColorDiffTable = (diff: string[][]) => {
console.log(table(diff, TABLE_OPTS))
}
开发者ID:akfish,项目名称:node-vibrant,代码行数:3,代码来源:helper.ts
注:本文中的table.table函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论