You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

cli-table-2-json

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cli-table-2-json

Convert command line table output into json object

1.0.13
latest
Source
npmnpm
Version published
Weekly downloads
8.6K
-1.93%
Maintainers
1
Weekly downloads
 
Created
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

table

FAQs

Package last updated on 31 Jul 2019

Did you know?

Socket

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