Version 1
[yaffs-website] / node_modules / is-html / index.js
diff --git a/node_modules/is-html/index.js b/node_modules/is-html/index.js
new file mode 100644 (file)
index 0000000..0cbd797
--- /dev/null
@@ -0,0 +1,18 @@
+'use strict';
+var htmlTags = require('html-tags');
+
+module.exports = function (str) {
+       if (/\s?<!doctype html>|(<html\b[^>]*>|<body\b[^>]*>|<x-[^>]+>)+/i.test(str)) {
+               return true;
+       }
+
+       var re = new RegExp(htmlTags.map(function (el) {
+               return '<' + el + '\\b[^>]*>';
+       }).join('|'), 'i');
+
+       if (re.test(str)) {
+               return true;
+       }
+
+       return false;
+};