Socket
Socket
Sign inDemoInstall

is-html

Package Overview
Dependencies
1
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.1.0 to 2.0.0

17

index.js
'use strict';
var htmlTags = require('html-tags');
const htmlTags = require('html-tags');
var basic = /\s?<!doctype html>|(<html\b[^>]*>|<body\b[^>]*>|<x-[^>]+>)+/i;
const basic = /\s?<!doctype html>|(<html\b[^>]*>|<body\b[^>]*>|<x-[^>]+>)+/i;
const full = new RegExp(htmlTags.map(tag => `<${tag}\\b[^>]*>`).join('|'), 'i');
var full = new RegExp(htmlTags.map(function (el) {
return '<' + el + '\\b[^>]*>';
}).join('|'), 'i');
module.exports = function (str) {
if (basic.test(str)) {
return true;
}
return full.test(str);
};
module.exports = string => basic.test(string) || full.test(string);
{
"name": "is-html",
"version": "1.1.0",
"description": "Check if a string is HTML",
"license": "MIT",
"repository": "sindresorhus/is-html",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "http://sindresorhus.com"
},
"engines": {
"node": ">=0.10.0"
},
"scripts": {
"test": "mocha"
},
"files": [
"index.js"
],
"keywords": [
"html",
"detect",
"check",
"is",
"tags",
"elements",
"string"
],
"dependencies": {
"html-tags": "^1.0.0"
},
"devDependencies": {
"mocha": "*"
}
"name": "is-html",
"version": "2.0.0",
"description": "Check if a string is HTML",
"license": "MIT",
"repository": "sindresorhus/is-html",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
"engines": {
"node": ">=8"
},
"scripts": {
"test": "xo && ava"
},
"files": [
"index.js"
],
"keywords": [
"html",
"detect",
"check",
"is",
"tags",
"elements",
"string"
],
"dependencies": {
"html-tags": "^3.0.0"
},
"devDependencies": {
"ava": "^1.4.1",
"xo": "^0.24.0"
}
}

@@ -9,3 +9,3 @@ # is-html [![Build Status](https://travis-ci.org/sindresorhus/is-html.svg?branch=master)](https://travis-ci.org/sindresorhus/is-html)

```
$ npm install --save is-html
$ npm install is-html
```

@@ -32,5 +32,2 @@

## License
MIT © [Sindre Sorhus](https://sindresorhus.com)
Note: It does not detect deprecated HTML tags.

Sorry, the diff of this file is not supported yet

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