text-table
's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.Name | Version | Size | License | Type | Vulnerabilities |
---|
Text-Table is an npm package specifically designed to create borderless text table strings that are ideal for printing to stdout. This JavaScript library provides an easy and straightforward way to generate structured, reader-friendly console output.
To use the Text-Table package, you should first install it using npm with the command: npm install text-table
. After installation, you can import it in your JavaScript file using require('text-table')
.
Here are some code usage examples for how to work with text-table:
Default Alignment
var table = require('text-table');
var t = table([
[ 'master', '0123456789abcdef' ],
[ 'staging', 'fedcba9876543210' ]
]);
console.log(t);
Left-Right Alignment
var table = require('text-table');
var t = table([
[ 'beep', '1024' ],
[ 'boop', '33450' ],
[ 'foo', '1006' ],
[ 'bar', '45' ]
], { align: [ 'l', 'r' ] });
console.log(t);
Centered Alignment
var table = require('text-table');
var t = table([
[ 'beep', '1024', 'xyz' ],
[ 'boop', '3388450', 'tuv' ],
[ 'foo', '10106', 'qrstuv' ],
[ 'bar', '45', 'lmno' ]
], { align: [ 'l', 'c', 'l' ] });
console.log(t);
These code snippets generate a well-structured text table with respective alignments in your console.
The documentation for the Text-Table package can be found at its GitHub repository: git://github.com/substack/text-table.git. The README file present there provides all the necessary information about the package, including its usage, installation, and possible options you can apply to customize the output.