1.3.7 • Published 7 years ago

html-to-object v1.3.7

Weekly downloads
15
License
MIT
Repository
github
Last release
7 years ago

html-to-object

A lightweight HTML parser for JavaScript that converts your native HTML code into an Array of JavaScript Objects.

Install

$ npm install --save html-to-object

Usage

const h2o = require('html-to-object');

const results = h2o('path/to/file.html', [options]);

Options

build (default: false)

Returns the parsed elements as prebuilt DOM nodes to easily append them to the page.

const fs = require('fs');
const h2o = require('html-to-object');

const results = h2o('path/to/file.html', { build: true });

targetIsFile (default: true)

In case of preloaded .html file content.

const fs = require('fs');
const h2o = require('html-to-object');

const html = fs.readFileSync('path/to/file.html', 'utf8');
const results = h2o(html, { targetIsFile: false });

attributesAsObject (default: false)

Will define the attributes property of each element as an Object instead of an Array.

const h2o = require('html-to-object');

const results = h2o('path/to/file.html', { attributesAsObject: true });

License

MIT © Max Sandelin

1.3.7

7 years ago

1.3.6

7 years ago

1.3.5

7 years ago

1.3.3

7 years ago

1.3.2

7 years ago

1.3.1

7 years ago

1.3.0

7 years ago

1.2.1

7 years ago

1.2.0

7 years ago

1.1.2

7 years ago

1.1.1

7 years ago

1.1.0

7 years ago

1.0.5

7 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago