1.0.1 • Published 7 years ago

extract-html-tag v1.0.1

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

extract-html-tag stability

npm version build status downloads js-standard-style

Extract all tags from html

Usage

var extract = require('extract-html-tag')
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.

License

MIT