1.0.5 • Published 5 years ago

tagged-table v1.0.5

Weekly downloads
7
License
MIT
Repository
github
Last release
5 years ago

Tagged-Table

Tagged-Table allows you to write tables in JavaScript using ES2015 tagged templates that compile down to arrays of objects.

Install

npm i -S tagged-table;

Usage

This:

import taggedTable from 'tagged-table';

const data = taggedTable`
  id   | name   | value      | date
  ${1} | first  | ${false}   | 1/1/1970
  ${2} | second | ${true}    | 1/1/2000
  ${3} | third  | ${false}   | 3/5/2005
`;

Will become this:

[
  { id: 1, name: 'first', value: false, date: '1/1/1970' },
  { id: 2, name: 'second', value: true, date: '1/1/2000' },
  { id: 3, name: 'third', value: false, date: '3/5/2005' }
]

Strings don't need interpolation, but don't leave a cell empty. Use ${undefined} instead.

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago