nodestringtable
v1.0.2
Published
A fork of the console.table and cli_table NodeJS source code which returns strings, and works in web browsers.
Downloads
23
Readme
nodeStringTable
A fork of the console.table
and cli_table.js
NodeJS source code which returns Strings, and works in web browsers.
This module works almost exactly like the NodeJS console.table
, with the main difference being that it returns a string rather than logging it to the console.
Usage
You can use the table function exactly like the NodeJS console.table
, but you must store the result as a string.
When using the web browser bundles, the module is available via the nsTable
global.
const nsTable = require("nodestringtable");
const tabularData = {
firstName: "John",
lastName: "Smith"
}
const table = nsTable(tabularData);
/* Creates a String table like this:
┌───────────┬─────────┐
│ (index) │ Values │
├───────────┼─────────┤
│ firstName │ 'John' │
│ lastName │ 'Smith' │
└───────────┴─────────┘
*/
Building for Browsers
Bundle index.js
with Browserify in standalone mode, which should include a copy of the NodeJS util
module to be used inside this module. The main bundle (nsTable.js
) and an UglifyJS2 minified version (nsTable.min.js
) will be saved to the dist
directory.
You can just run the included NPM script which does this:
npm run bundle