projects
/
yaffs-website
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
history
|
raw
|
HEAD
Version 1
[yaffs-website]
/
node_modules
/
is-html
/
index.js
1
'use strict';
2
var htmlTags = require('html-tags');
3
4
module.exports = function (str) {
5
if (/\s?<!doctype html>|(<html\b[^>]*>|<body\b[^>]*>|<x-[^>]+>)+/i.test(str)) {
6
return true;
7
}
8
9
var re = new RegExp(htmlTags.map(function (el) {
10
return '<' + el + '\\b[^>]*>';
11
}).join('|'), 'i');
12
13
if (re.test(str)) {
14
return true;
15
}
16
17
return false;
18
};