jsonify-my-table

Convert a HTML table to JSON
git clone http://git.hanabi.in/repos/jsonify-my-table.git
Log | Files | Refs | LICENSE

commit cf996e5efcea287b47da51e286cc61e7e6380ca9
parent b0ce64be839780288da8d2a997e2f529900c26e9
Author: Agastya Chandrakant <acagastya@outlook.com>
Date:   Thu, 13 Jun 2019 15:55:07 +0530

Update table2json.min.js
Diffstat:
Mtable2json.min.js | 22+---------------------
1 file changed, 1 insertion(+), 21 deletions(-)

diff --git a/table2json.min.js b/table2json.min.js @@ -1,21 +1 @@ -class table2json { - constructor(e) { - if (((this.table = document.getElementById(e)), !this.table)) - return (this.error = !0), void console.error("Table not found."); - this.headers = []; - for (let e = 0; e < this.table.rows[0].cells.length; e += 1) - this.headers.push(this.table.rows[0].cells[e].innerText); - if (this.headers.length > new Set(this.headers).size) - return (this.error = !0), void console.error("Headers repeat."); - this.res = []; - for (let e = 1; e < this.table.rows.length; e += 1) { - let t = []; - for (let s = 0; s < this.table.rows[e].cells.length; s += 1) - t.push(this.table.rows[e].cells[s].innerText); - let s = {}; - this.headers.forEach((e, r) => (s = { ...s, [e.valueOf()]: t[r] })), - this.res.push(s); - } - } -} -exports.table2json = table2json; +class table2json{constructor(e){if(this.table=document.getElementById(e),!this.table)return this.error=!0,void console.error("Table not found.");this.headers=[];for(let e=0;e<this.table.rows[0].cells.length;e+=1)this.headers.push(this.table.rows[0].cells[e].innerText);if(this.headers.length>new Set(this.headers).size)return this.error=!0,void console.error("Headers repeat.");this.res=[];for(let e=1;e<this.table.rows.length;e+=1){let t=[];for(let s=0;s<this.table.rows[e].cells.length;s+=1)t.push(this.table.rows[e].cells[s].innerText);let s={};this.headers.forEach((e,r)=>s={...s,[e.valueOf()]:t[r]}),this.res.push(s)}}}exports.table2json=table2json;