0.0.3 • Published 9 months ago

html-tables-to-json v0.0.3

Weekly downloads
-
License
MIT
Repository
github
Last release
9 months ago

Installation

$ npm install html-tables-to-json

Usage

import { CheerioTableParser } from "html-tables-to-json"

const tableParser = new CheerioTableParser()
const result = tableParser.parse(
  `
  <table>
    <tbody>
      <tr>
        <th>header 1</th>
        <th>header 2</th>
      </tr>
      <tr>
        <td>cell 1</td>
        <td>cell 2</td>
        <td>cell 3</td>
      </tr>
      <tr>
        <td colspan="2">cell 4</td>
      </tr>
    </tbody>
  </table>
  `
)

console.log(result[0])
// => output
// [
//  ["header 1", "header 2"],
//  ["cell 1", "cell 2", "cell 3"],
//  ["cell 4", "cell 4"],
// ]
0.0.3

9 months ago

0.0.2

9 months ago

0.0.1

9 months ago