extract-html-tag

1.0.1 • Public • Published

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

Package Sidebar

Install

npm i extract-html-tag

Weekly Downloads

17

Version

1.0.1

License

MIT

Last publish

Collaborators

  • yoshuawuyts