New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

is-html-ts

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

is-html-ts

Check if a string is HTML

latest
Source
npmnpm
Version
1.0.0
Version published
Maintainers
1
Created
Source

is-html-ts

forked from 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-ts
$ yarn add is-html-ts

Usage

import isHtml, { basic, full } from 'is-html-ts';
import type { Options } from 'is-html-ts'

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

const customOptions: Options = {
    regExp: 'basic',
    length: 'all',
};

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

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

Note: It does not detect deprecated HTML tags.

Keywords

html

FAQs

Package last updated on 15 Jul 2022

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