README
Parse and return stats for a given html string.
Installation
npm i -S dom-stats
Usage
const domStats = require('dom-stats')
const stats = domStats('<span id="foo"><i class="hi" id="foo"</i></span>')
console.log(stats)
// {
// totalTags: 2,
// totalClasses: 1,
// totalIds: 2,
// averageClassCount: 0.5,
// duplicateIds: ['foo'],
// duplicateIdsCount: 1,
// tagCounts: { span: 1, a: 1 }
// }
License
MIT
Related
- https://github.com/cheeriojs/cheerio
- https://github.com/johnotander/is-present
- https://github.com/sindresorhus/html-tags
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request
Crafted with <3 by John Otander (@4lpine).
This package was initially generated with yeoman and the p generator.