0.0.1 • Published 10 years ago

table-ize v0.0.1

Weekly downloads
2
License
MIT
Repository
github
Last release
10 years ago

table-ize

Build Status Code Climate David DM

Turn markdown style(ish) table syntax to an array of objects.

Install

npm install table-ize

Example

tableize() turns a string like this:

| one | two | three |
| a   | b   | c     |
| d   | e   | f     |

To this:

[
  {one: "a", two: "b", three: "c"},
  {one: "d", two: "e", three: "f"}
]

Use tableize.rowsObject(), you can also create a single object by using the first column as the key and second column as the value.

| one   | a |
| two   | b |
| three | c |

Gives you:

{
  one: "a",
  two: "b",
  three: "c"
}

License

MIT