stringtables
v1.0.5
Published
Create Printable Tables in JavaScript!
Downloads
2
Readme
Make awesome tables that you can console.log() to make logging more professional! Tables use string too! You could use this to generate static pages.
Index
How to install
# install the bin script
npm i stringtables
Examples
// Load in the package
let st = require('stringtables');
// Create a new Table, and pass in table columns as parameters (spaces allowed)
let t = new st.Table(" Col 1 ", " Col 2 ", " Col 3 ", " Fields can be different lengths too! ", "π Uni•code support! ¬");
// Print out a new header for our table
console.log(t.newHeader());
// OUTPUT
// +---------+---------+---------+--------------------------------------+---------------------+
// | Col 1 | Col 2 | Col 3 | Fields can be different lengths too! |π Uni•code support! ¬|
// +---------+---------+---------+--------------------------------------+---------------------+
// Add an entry to our table
console.log(t.newLine(new st.Line("Item 1", "itm2", "col3item", "shortText", "i lik unicod")));
// OUTPUT
// |Item 1 |itm2 |col3item |shortText |i lik unicod |
// Finsih the table
console.log(t.newFooter());
// OUTPUT
// +---------+---------+---------+--------------------------------------+---------------------+
// END RESULT
// +---------+---------+---------+--------------------------------------+---------------------+
// | Col 1 | Col 2 | Col 3 | Fields can be different lengths too! |π Uni•code support! ¬|
// +---------+---------+---------+--------------------------------------+---------------------+
// |Item 1 |itm2 |col3item |shortText |i lik unicod |
// +---------+---------+---------+--------------------------------------+---------------------+
Contributors
- Brian Shao
License
The MIT License
Copyright 2018 Brain Shao
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.