@webpod/ingrid
TypeScript icon, indicating that this package has built-in type declarations

0.0.0-beta.3 • Public • Published

@webpod/ingrid

A shell-printed tables parser

Usage

There are so many tools for printing tables in the shell, but much less to parse them back.

import { parse } from '@webpod/ingrid'

const table = `
foo bar baz
1 2 3
`
const result = parse(table.trim())
// {foo: ['1'], bar: ['2'], baz: ['3']}

To parse wmic grids, set the format option:

const table = `
foo  bar  baz
1

  2  3

a

  b  c

  d  e
`

const result = parse(table.trim(), {format: 'win'})
/**
 [
   { foo: ['1'], bar: ['2'], baz: ['3'] },
   { foo: ['a'], bar: ['b'], baz: ['c'] },
   { foo: ['a'], bar: ['d'], baz: ['e'] }
 ]
 */

License

MIT

Readme

Keywords

none

Package Sidebar

Install

npm i @webpod/ingrid

Weekly Downloads

1,319

Version

0.0.0-beta.3

License

MIT

Unpacked Size

13.4 kB

Total Files

7

Last publish

Collaborators

  • webpodbot
  • antongolub
  • medv