Socket
Socket
Sign inDemoInstall

extract-html-class

Package Overview
Dependencies
0
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    extract-html-class

Extract all classes from html


Version published
Maintainers
1
Install size
5.92 kB
Created

Readme

Source

extract-html-class stability

npm version build status downloads js-standard-style

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.

License

MIT

Keywords

FAQs

Last updated on 09 Jul 2017

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc