Socket
Socket
Sign inDemoInstall

json-table

Package Overview
Dependencies
3
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.0.1 to 0.0.2

16

libs/index.js

@@ -7,4 +7,5 @@ var fs = require('fs');

function JsonTb(item) {
function JsonTb(item, config) {
var that = this;
config = config || {};

@@ -19,3 +20,3 @@ if(!item){

this.mkbody(item, function(err, result) {
that.whole(function(err_whole, table) {
that.whole(config, function(err_whole, table) {
that.show(table);

@@ -29,3 +30,3 @@ })

this.mkbody(parse, function(err, result) {
that.whole(function(err_whole, table) {
that.whole(config, function(err_whole, table) {
that.show(table);

@@ -81,8 +82,9 @@ })

// make a whole table
JsonTb.prototype.whole = function(callback) {
JsonTb.prototype.whole = function(config, callback) {
var that = this;
var table_obj = config
table_obj.head = that.head;
var table = new Table({
head: that.head
});
var table = new Table(table_obj);

@@ -89,0 +91,0 @@ async.each(that.body, function(item, cb) {

{
"name": "json-table",
"version": "0.0.1",
"version": "0.0.2",
"description": "Json table is an easy way to preview your json data in table",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -24,8 +24,19 @@ # json table

```
var json_tb_out = new json_tb('sample.json')
var json_tb_out = new json_tb('sample.json', {
chars: { 'top': '═' , 'top-mid': '╤' , 'top-left': '╔' , 'top-right': '╗'
, 'bottom': '═' , 'bottom-mid': '╧' , 'bottom-left': '╚' , 'bottom-right': '╝'
, 'left': '║' , 'left-mid': '╟' , 'mid': '─' , 'mid-mid': '┼'
, 'right': '║' , 'right-mid': '╢' , 'middle': '│' }
})
```
or
```
var json_tb_out = new json_tb(<JSON object>);
```
- Arguments:
* the first argument can be a json file or a json object
* json file, or json object (json): the first argument can be a json file or a json object
* configure of the table (object): see detail in https://github.com/LearnBoost/cli-table
## Example

@@ -32,0 +43,0 @@

@@ -27,3 +27,9 @@ var json_tb = require('..');

}]
var json_tb_out = new json_tb(test_json)
var json_tb_out = new json_tb(test_json,
{
chars: { 'top': '═' , 'top-mid': '╤' , 'top-left': '╔' , 'top-right': '╗'
, 'bottom': '═' , 'bottom-mid': '╧' , 'bottom-left': '╚' , 'bottom-right': '╝'
, 'left': '║' , 'left-mid': '╟' , 'mid': '─' , 'mid-mid': '┼'
, 'right': '║' , 'right-mid': '╢' , 'middle': '│' }
})
//var json_tb_path = new json_tb(__dirname + '/sample.json');
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc