当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript table.getBorderCharacters函数代码示例

本文整理汇总了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}`)
  }

}
开发者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: 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
开发者ID:akfish,项目名称:node-vibrant,代码行数:31,代码来源:helper.ts


注:本文中的table.getBorderCharacters函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。