pretty-columns
- Support colors, chalk and other ansi.
- Compatible with double-byte characters, emoji emoticons.
- Best display when using monospaced fonts.
- Content can only be displayed in a single line, automatically remove "\n" or "\r" from content.
- Multi-line display may be possible. (lazy.. stretched)
npm
Vianpm install pretty-columns
yarn
Viayarn add pretty-columns
Usage
Normally
var pc = ; ;// console.log(pc(input)) will see all structure
Output
var po = output; ;
Inject console
; console;
About Input
String
var input = "A\tB\n1\t2";
Array
var input = 'A''B'12;
Mixed
var input = 'A,B''1,2';
Custom configuration
property | description | default |
---|---|---|
rowSplitSymbol | Row split symbol(when string input given) | "\n" (can be regexp) |
columnSplitSymbol | Column split symbol(when string input given) | "\t" (can be regexp) |
align | Alignment: ['right', 'center', ...] OR 'rc...' |
Filling "left" when insufficient. Ignored when redundant. |
rowSeparation | Rows connector | "\n" |
columnSeparation | Columns connector | " " |
prefix | Prefix at output | "" |
suffix | Suffix at output | "" |
placeholder | Fill white space | " " |
Example
var output = output;var colors = ;var chalk = ; var INPUT = chalkbold colorsbold "domain" "www.google.com" chalk "😘search🐰" "query" colors + "npm 中\n文呢?" "scheme" "https" ; ;