0.0.14 • Published 2 years ago

array-to-html v0.0.14

Weekly downloads
-
License
MIT
Repository
github
Last release
2 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

2 years ago

0.0.13

2 years ago

0.0.12

2 years ago

0.0.11

2 years ago

0.0.10

2 years ago

0.0.9

2 years ago

0.0.8

2 years ago

0.0.7

2 years ago

0.0.6

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago