is-html
TypeScript icon, indicating that this package has built-in type declarations

3.1.0 • Public • Published

is-html

Check if a string is HTML

You should not use this for any kind of validation, sanitation, or XSS checks.

Install

npm install is-html

Usage

import isHtml from 'is-html';

isHtml('<p>I am HTML</p>');
//=> true

isHtml('<!doctype><html><body><h1>I ❤ unicorns</h1></body></html>');
//=> true

isHtml('<cake>I am XML</cake>');
//=> false

isHtml('>+++++++>++++++++++>+++>+<<<<-');
//=> false

Note: It does not detect deprecated HTML tags.

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 3.1.0
    6,194
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 3.1.0
    6,194
  • 3.0.0
    6,420
  • 2.0.0
    468,285
  • 1.1.0
    532,856
  • 1.0.0
    19,763
  • 0.2.2
    65
  • 0.2.1
    61
  • 0.1.1
    4
  • 0.1.0
    3

Package Sidebar

Install

npm i is-html

Weekly Downloads

282,485

Version

3.1.0

License

MIT

Unpacked Size

2.96 kB

Total Files

5

Last publish

Collaborators

  • sindresorhus