0.0.14 • Published 3 years ago

array-to-html v0.0.14

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

Array to Html

Convert an array of objects to a simple html table, list or DOMElement.

Install

NPM

$ npm i array-to-html

Use

Array to Table

Sample

const { arrayToTable } = require('array-to-html');

// array collection
const tableArray = [
  {
    Name: 'Jack',
    Age: 40,
  },
  {
    Name: 'Maria',
    Age: 35,
  },  
];

// the magic
const tableHtml = arrayToTable(tableArray);
// output
console.log(tableHtml);

Output

Options

OptionsTypeDescription
minifyBooleanCompress HTML, remove spaces and breaks
fake_styleBooleanInsert styles
columns_sizeNumeric ArrayPercent array 25, 25, 0, 50
headerArrayHeader property, label, width
// array collection
const tableArray = [ ... ];

// options
const options = {
  minify: true, 
  fake_style: true,
  columns_size: [70, 30], // 70%. 30% (two columns)
  header: [
    {
      property: 'Name',
      label: 'N-A-M-E',
      width: 70, // 70%
    }
  ]
}
// the magic
const tableHtml = arrayToTable(tableArray, options);

ToDo

  • Table DOMElement
  • Array to List

License

The MIT License.

Author

0.0.14

3 years ago

0.0.13

3 years ago

0.0.12

3 years ago

0.0.11

3 years ago

0.0.10

3 years ago

0.0.9

3 years ago

0.0.8

3 years ago

0.0.7

3 years ago

0.0.6

3 years ago

0.0.5

3 years ago

0.0.4

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago