Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/natancabral/tables2json
Convert an HTML tables node to a javascript object or array. Client-Side
https://github.com/natancabral/tables2json
client-side dom html-table-to-json table-to-json table2json
Last synced: 13 days ago
JSON representation
Convert an HTML tables node to a javascript object or array. Client-Side
- Host: GitHub
- URL: https://github.com/natancabral/tables2json
- Owner: natancabral
- Created: 2021-06-22T05:32:47.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2022-07-28T15:23:26.000Z (over 2 years ago)
- Last Synced: 2024-03-24T05:42:54.238Z (11 months ago)
- Topics: client-side, dom, html-table-to-json, table-to-json, table2json
- Language: JavaScript
- Homepage:
- Size: 30.3 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# tables2json
Convert an HTML tables node to a javascript object or array.
## Install
```bash
npm install tables2json
```## Update version
```bash
npm install tables2json@latest
```## Require / Import
```js
const { oneTable2json, allTables2json } = require("tables2json");
// import { oneTable2json, allTables2json } from "tables2json";
```
```js
const tables2json = require("tables2json");
// import tables2json from "tables2json";
```## Use
```js
const tables2json = require("tables2json");
// get element by id
const table = tables2json.one('table_id'); // object
// get all tables
const tables = tables2json.all(); // array
console.log( table, tables );
``````js
const { oneTable2Json, allTables2Json } = require("tables2json");
// get element by id
const table = oneTable2Json('table_id'); // object
// get all tables
const tables = allTables2Json(); // array
console.log( table, tables );
``````js
// return
{
headers: [],
rows: [],
}
// usable to pdfkit-table
// https://www.npmjs.com/package/pdfkit-table
// https://github.com/natancabral/pdfkit-table#readme
```## Changelogs
### 0.0.6
+ void when table content is empty
### 0.0.1
+ initial functions
+ **Thank you, contributors!**## License
Copyright (c) Natan Cabral
Licensed under the MIT license.## Author
Natan Cabral
[email protected]
https://github.com/natancabral/