本文整理汇总了TypeScript中table.getBorderCharacters函数的典型用法代码示例。如果您正苦于以下问题:TypeScript getBorderCharacters函数的具体用法?TypeScript getBorderCharacters怎么用?TypeScript getBorderCharacters使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getBorderCharacters函数的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}`)
}
}
示例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);
示例3: require
import { expect } from 'chai'
import { VibrantStatic } from '../../typing'
import Builder from '../../builder'
import path = require('path')
import { Palette, Swatch } from '../../color'
import util = require('../../util')
import _ = require('lodash')
import {
TestSample, SamplePathKey
} from './data'
import { table, getBorderCharacters } from 'table'
const TABLE_OPTS = {
border: getBorderCharacters('void')
}
const displayColorDiffTable = (diff: string[][]) => {
console.log(table(diff, TABLE_OPTS))
}
const assertPalette = (reference: Palette, palette: Palette) => {
expect(palette, 'palette should be returned').not.to.be.null
let failCount = 0
const compare = (name: string, expected: Swatch, actual: Swatch) => {
let result = {
status: 'N/A',
diff: -1