Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

json-table

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

json-table - npm Package Compare versions

Comparing version 0.0.2 to 0.1.0

.travis.yml

20

libs/index.js

@@ -7,3 +7,8 @@ var fs = require('fs');

function JsonTb(item, config) {
function JsonTb(item, config, cb) {
if(arguments.length == 2) {
cb = config;
config = null;
}
var that = this;

@@ -20,4 +25,7 @@ config = config || {};

this.mkbody(item, function(err, result) {
if(err) throw new Error(err);
that.whole(config, function(err_whole, table) {
that.show(table);
if(err) throw new Error(err_whole);
that.table = table;
cb(that)
})

@@ -30,4 +38,7 @@ });

this.mkbody(parse, function(err, result) {
if(err) throw new Error(err);
that.whole(config, function(err_whole, table) {
that.show(table);
if(err) throw new Error(err_whole);
that.table = table
cb(that)
})

@@ -104,4 +115,5 @@ });

JsonTb.prototype.show = function(table) {
JsonTb.prototype.show = function() {
var table = this.table;
console.log(table.toString());
}

12

package.json
{
"name": "json-table",
"version": "0.0.2",
"version": "0.1.0",
"description": "Json table is an easy way to preview your json data in table",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"test": "./node_modules/.bin/mocha"
},
"keywords": [
"table",
"json"
],
"repository": {

@@ -22,3 +26,7 @@ "type": "git",

"async": "~0.2.10"
},
"devDependencies": {
"should": "~3.1.2",
"mocha": "~1.17.1"
}
}
# json table
[![Build Status](https://travis-ci.org/DataGarage/node-json-table.png?branch=master)](https://travis-ci.org/DataGarage/node-json-table)
Json table is an easy way to preview your json data in table

@@ -23,3 +25,3 @@

```
```javascript
var json_tb_out = new json_tb('sample.json', {

@@ -30,14 +32,18 @@ chars: { 'top': '═' , 'top-mid': '╤' , 'top-left': '╔' , 'top-right': '╗'

, 'right': '║' , 'right-mid': '╢' , 'middle': '│' }
}, function(table) {
table.show() // **have to call show() function to print out the table**
})
```
or
```javascript
var json_tb_out = new json_tb(<JSON object>, config, callback);
```
var json_tb_out = new json_tb(<JSON object>);
```
- Arguments:
* 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
* **json file, or json object (json)** : the first argument can be a json file or a json object
* **configure of the table (object)** : `optional` see detail in https://github.com/LearnBoost/cli-table
* **callback (function)** : callback function
## Example

@@ -47,3 +53,3 @@

```
```json
[{

@@ -50,0 +56,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc