Socket
Socket
Sign inDemoInstall

cli-table-2-json

Package Overview
Dependencies
3
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    cli-table-2-json

Convert command line table output into json object


Version published
Weekly downloads
6.8K
decreased by-15.7%
Maintainers
1
Install size
2.99 MB
Created
Weekly downloads
 

Readme

Source

cli-table-2-json

Convert command line table output into json object

NPM NPM

Installation

npm install cli-table-2-json

Then:

var cliTable2Json = require('cli-table-2-json');

Usage:

var lines = ['NAME      ACTIVE   DRIVER      STATE     URL                         SWARM',
              'consul1   -        amazonec2   Running   tcp://54.175.200.212:2376   ',
              'consul2   -        amazonec2   Running   tcp://52.23.236.38:2376     ',
              'consul3   -        amazonec2   Running   tcp://54.85.111.241:2376    ',
              ''];

var result = cliTable2Json.cliTable2Json(lines);
console.log(result);

//[{
//  name: 'consul1',
//  active: '-',
//  driver: 'amazonec2',
//  state: 'Running',
//  url: 'tcp://54.175.200.212:2376',
//  swarm: ''
//},
//  {
//    name: 'consul2',
//    active: '-',
//    driver: 'amazonec2',
//    state: 'Running',
//    url: 'tcp://52.23.236.38:2376',
//    swarm: ''
//  },
//  {
//    name: 'consul3',
//    active: '-',
//    driver: 'amazonec2',
//    state: 'Running',
//    url: 'tcp://54.85.111.241:2376',
//    swarm: ''
//  }]


Typescript

import { cliTable2Json } from 'cli-table-2-json';

var lines = ['NAME      ACTIVE   DRIVER      STATE     URL                         SWARM',
  'consul1   -        amazonec2   Running   tcp://54.175.200.212:2376   ',
  'consul2   -        amazonec2   Running   tcp://52.23.236.38:2376     ',
  'consul3   -        amazonec2   Running   tcp://54.85.111.241:2376    ',
  ''];

var result = cliTable2Json(lines);
console.log(result);

Keywords

FAQs

Last updated on 31 Jul 2019

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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