當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。