hensei-web/node_modules/is-html/index.js
2020-09-11 06:44:42 -07:00

16 lines
337 B
JavaScript

'use strict';
var htmlTags = require('html-tags');
var basic = /\s?<!doctype html>|(<html\b[^>]*>|<body\b[^>]*>|<x-[^>]+>)+/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);
};