detect-is-it-html-or-xhtml 5.0.13 → 5.0.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,12 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [5.0.14](https://github.com/codsen/codsen/compare/detect-is-it-html-or-xhtml@5.0.13...detect-is-it-html-or-xhtml@5.0.14) (2022-04-21)
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
- improve the throw message ([9c69a06](https://github.com/codsen/codsen/commit/9c69a067dc96490d9ceea69b85399c7d28600bfc))
|
|
11
|
+
|
|
6
12
|
## 5.0.0 (2021-09-09)
|
|
7
13
|
|
|
8
14
|
### Features
|
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# detect-is-it-html-or-xhtml
|
|
2
2
|
|
|
3
|
-
>
|
|
3
|
+
> Does the string resemble an HTML or XHTML (or neither)?
|
|
4
4
|
|
|
5
5
|
<div class="package-badges">
|
|
6
6
|
<a href="https://www.npmjs.com/package/detect-is-it-html-or-xhtml" rel="nofollow noreferrer noopener">
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @name detect-is-it-html-or-xhtml
|
|
3
|
-
* @fileoverview
|
|
4
|
-
* @version 5.0.
|
|
3
|
+
* @fileoverview Does the string resemble an HTML or XHTML (or neither)?
|
|
4
|
+
* @version 5.0.14
|
|
5
5
|
* @author Roy Revelt, Codsen Ltd
|
|
6
6
|
* @license MIT
|
|
7
7
|
* {@link https://codsen.com/os/detect-is-it-html-or-xhtml/}
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
var i="5.0.
|
|
10
|
+
var i="5.0.14";var T=i;function b(t){function o(e){return e!=null}if(!t)return null;if(typeof t!="string")throw new TypeError(`detect-is-it-html-or-xhtml: [THROW_ID_01] Input must be a string! It was given as ${JSON.stringify(t,null,4)} (type ${typeof t})`);let c=/<\s*!\s*doctype[^>]*>/im,a=/<\s*img[^>]*>/gi,m=/<\s*br[^>]*>/gi,h=/<\s*hr[^>]*>/gi,d=/\/\s*>/g,s=t.match(c);if(s){let e=/xhtml/gi,l=/svg/gi;return s[0].match(e)||s[0].match(l)?"xhtml":"html"}let u=t.match(a)||[],p=t.match(m)||[],g=t.match(h)||[],r=u.concat(p).concat(g);if(r.length===0)return null;let n=0;for(let e=0,l=r.length;e<l;e++)o(r[e].match(d))&&(n+=1);return n>r.length/2?"xhtml":"html"}export{b as detectIsItHTMLOrXhtml,T as version};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @name detect-is-it-html-or-xhtml
|
|
3
|
-
* @fileoverview
|
|
4
|
-
* @version 5.0.
|
|
3
|
+
* @fileoverview Does the string resemble an HTML or XHTML (or neither)?
|
|
4
|
+
* @version 5.0.14
|
|
5
5
|
* @author Roy Revelt, Codsen Ltd
|
|
6
6
|
* @license MIT
|
|
7
7
|
* {@link https://codsen.com/os/detect-is-it-html-or-xhtml/}
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
var detectIsItHtmlOrXhtml=(()=>{var a=Object.defineProperty;var x=Object.getOwnPropertyDescriptor;var f=Object.getOwnPropertyNames;var T=Object.prototype.hasOwnProperty;var b=(t,e)=>{for(var l in e)a(t,l,{get:e[l],enumerable:!0})},v=(t,e,l,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of f(e))!T.call(t,r)&&r!==l&&a(t,r,{get:()=>e[r],enumerable:!(n=x(e,r))||n.enumerable});return t};var j=t=>v(a({},"__esModule",{value:!0}),t);var
|
|
10
|
+
var detectIsItHtmlOrXhtml=(()=>{var a=Object.defineProperty;var x=Object.getOwnPropertyDescriptor;var f=Object.getOwnPropertyNames;var T=Object.prototype.hasOwnProperty;var b=(t,e)=>{for(var l in e)a(t,l,{get:e[l],enumerable:!0})},v=(t,e,l,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of f(e))!T.call(t,r)&&r!==l&&a(t,r,{get:()=>e[r],enumerable:!(n=x(e,r))||n.enumerable});return t};var j=t=>v(a({},"__esModule",{value:!0}),t);var M={};b(M,{detectIsItHTMLOrXhtml:()=>I,version:()=>w});var h="5.0.14";var w=h;function I(t){function e(s){return s!=null}if(!t)return null;if(typeof t!="string")throw new TypeError(`detect-is-it-html-or-xhtml: [THROW_ID_01] Input must be a string! It was given as ${JSON.stringify(t,null,4)} (type ${typeof t})`);let l=/<\s*!\s*doctype[^>]*>/im,n=/<\s*img[^>]*>/gi,r=/<\s*br[^>]*>/gi,d=/<\s*hr[^>]*>/gi,u=/\/\s*>/g,o=t.match(l);if(o){let s=/xhtml/gi,c=/svg/gi;return o[0].match(s)||o[0].match(c)?"xhtml":"html"}let p=t.match(n)||[],g=t.match(r)||[],y=t.match(d)||[],i=p.concat(g).concat(y);if(i.length===0)return null;let m=0;for(let s=0,c=i.length;s<c;s++)e(i[s].match(u))&&(m+=1);return m>i.length/2?"xhtml":"html"}return j(M);})();
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "detect-is-it-html-or-xhtml",
|
|
3
|
-
"version": "5.0.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "5.0.14",
|
|
4
|
+
"description": "Does the string resemble an HTML or XHTML (or neither)?",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"check",
|
|
7
7
|
"code",
|