Socket
Socket
Sign inDemoInstall

extract-html-id

Package Overview
Dependencies
0
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    extract-html-id

Extract all ids from html


Version published
Maintainers
1
Install size
5.84 kB
Created

Readme

Source

extract-html-id stability

npm version build status downloads js-standard-style

Extract all ids from html

Usage

var extract = require('extract-html-id')
var assert = require('assert')

var html = `
  <div id="foo">
    <p id="bar">hello planet</p>
  </div>
`
var expected = [ 'foo', 'bar']
assert.deepEqual(extract(html), expected, 'array was same')

API

ids = extract(html)

Get an array of ids for the given string. Uses a regex so safe to run on non-html strings too. Returns the first ID per DOM element. Returns an empty array if no matches are found.

License

MIT

Keywords

FAQs

Last updated on 03 Oct 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