1.1.0 • Published 6 years ago

totable v1.1.0

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

ToTable

A tiny library that generates html tables from arrays of objects.

No funny businesses, no dependencies, no transpilation, just ~50 lines of vanilla js.

Demo Fiddle

NPM

npm i --save totable

CDN

<script src="https://cdn.rawgit.com/Olian04/ToTable/d126873e/src/ToTable.js"></script>

ToTable(arrayOfObjects)

const ToTable = require('totable');

const html = ToTable([
  { firstname: 'Oliver', lastname: 'Twist', age: 14 },
  { firstname: 'Charles', lastname: 'Darwin', age: 78 },
  { firstname: 'Steven', lastname: 'Hawken', age: 50 }
]);

ToTable(arrayOfColumnNames, arrayOfObjects)

const ToTable = require('totable');

const html = ToTable(['lastname', 'age'], [
  { firstname: 'Oliver', lastname: 'Twist', age: 14 },
  { firstname: 'Charles', lastname: 'Darwin', age: 78 },
  { firstname: 'Steven', lastname: 'Hawken', age: 50 }
]);

ToTable(objectOfColumnNameMappings, arrayOfObjects)

const ToTable = require('totable');

const html = ToTable({
  firstname: 'name',
  age: 'age'
}, [
  { firstname: 'Oliver', lastname: 'Twist', age: 14 },
  { firstname: 'Charles', lastname: 'Darwin', age: 78 },
  { firstname: 'Steven', lastname: 'Hawken', age: 50 }
]);
1.1.0

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.0

6 years ago

1.0.1

9 years ago