🚀 DAY 5 OF LAUNCH WEEK:Introducing Webhook Events for Alert Changes.Learn more →
Socket
Book a DemoInstallSign in
Socket

match-html

Package Overview
Dependencies
Maintainers
2
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install
Package was removed
Sorry, it seems this package was removed from the registry

match-html

Check html consistency according to a model

unpublished
latest
npmnpm
Version
1.3.2
Version published
Maintainers
2
Created
Source

match-html

Check HTML consistency according to a model

Usage

Ok, here it goes:

import matchHTML from 'match-html'
// or const matchHTML = require('mach-html')

const model = `
  <header>
    <h1 acceptTags="h2|h3|h4"></h1>
  </header>
  <main class="content" attribute="value" >
    <nav childCount="2"> 
      <a></a>
      <a></a>
    </nav>
  </main>
  <footer>
    <span acceptTags="*"></span>
  </footer>
`

const isValid = matchHTML(model, input) // true or false

p.s: matchHTML handles whitespace

Parameters

Parameters are simply reserved HTML attributes. These are:

  • childCount: how many childs the node should have
  • acceptTags: which tags the node can be; delimit with |; * = any tag

p.s: Any other attribute that is not listed above will take place in the attribute matching

Keywords

html

FAQs

Package last updated on 26 Jan 2017

Did you know?

Socket

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