Files
now-deployment/node_modules/now/dist/util/format-dns-table.ts
2019-10-17 12:36:15 +09:00

17 lines
409 B
TypeScript

import chalk from 'chalk';
import table from 'text-table';
import strlen from './strlen';
const HEADER = ['name', 'type', 'value'].map(v => chalk.gray(v));
export default function formatDNSTable(
rows: string[][],
{ extraSpace = '' } = {}
) {
return table([HEADER, ...rows], {
align: ['l', 'l', 'l'],
hsep: ' '.repeat(8),
stringLength: strlen
}).replace(/^(.*)/gm, `${extraSpace}$1`);
}