extract-html-class
v1.0.1
Published
Extract all classes from html
Downloads
63
Maintainers
Readme
extract-html-class
Extract all classes from html
Usage
var extract = require('extract-html-class')
var assert = require('assert')
var html = `
<div class="foo bar">
<p class="bin baz">hello planet</p>
</div>
`
var expected = [ 'foo', 'bar', 'bin', 'baz' ]
assert.deepEqual(extract(html), expected, 'array was same')
API
classes = extract(html)
Get an array of classes for the given string. Uses a regex so safe to run on non-html strings too. Returns an empty array if no matches are found.