detect-is-it-html-or-xhtml 5.1.4 → 5.1.6
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/README.md
CHANGED
|
@@ -1,28 +1,25 @@
|
|
|
1
|
-
|
|
1
|
+
<h1 align="center">detect-is-it-html-or-xhtml</h1>
|
|
2
2
|
|
|
3
|
-
>
|
|
3
|
+
<p align="center">Does the string resemble an HTML or XHTML (or neither)?</p>
|
|
4
4
|
|
|
5
|
-
<
|
|
6
|
-
<a href="https://www.npmjs.com/package/detect-is-it-html-or-xhtml" rel="nofollow noreferrer noopener">
|
|
7
|
-
<img src="https://img.shields.io/badge/-npm-blue?style=flat-square" alt="page on npm">
|
|
8
|
-
</a>
|
|
5
|
+
<p align="center">
|
|
9
6
|
<a href="https://codsen.com/os/detect-is-it-html-or-xhtml" rel="nofollow noreferrer noopener">
|
|
10
7
|
<img src="https://img.shields.io/badge/-codsen-blue?style=flat-square" alt="page on codsen.com">
|
|
11
8
|
</a>
|
|
9
|
+
<a href="https://www.npmjs.com/package/detect-is-it-html-or-xhtml" rel="nofollow noreferrer noopener">
|
|
10
|
+
<img src="https://img.shields.io/badge/-npm-blue?style=flat-square" alt="page on npm">
|
|
11
|
+
</a>
|
|
12
12
|
<a href="https://github.com/codsen/codsen/tree/main/packages/detect-is-it-html-or-xhtml" rel="nofollow noreferrer noopener">
|
|
13
13
|
<img src="https://img.shields.io/badge/-github-blue?style=flat-square" alt="page on github">
|
|
14
14
|
</a>
|
|
15
15
|
<a href="https://npmcharts.com/compare/detect-is-it-html-or-xhtml?interval=30" rel="nofollow noreferrer noopener" target="_blank">
|
|
16
16
|
<img src="https://img.shields.io/npm/dm/detect-is-it-html-or-xhtml.svg?style=flat-square" alt="Downloads per month">
|
|
17
17
|
</a>
|
|
18
|
-
<a href="https://
|
|
19
|
-
<img src="https://img.shields.io/badge/
|
|
20
|
-
</a>
|
|
21
|
-
<img src="https://img.shields.io/badge/licence-MIT-brightgreen.svg?style=flat-square" alt="MIT License">
|
|
22
|
-
<a href="https://liberamanifesto.com" rel="nofollow noreferrer noopener" target="_blank">
|
|
23
|
-
<img src="https://img.shields.io/badge/libera-manifesto-lightgrey.svg?style=flat-square" alt="libera manifesto">
|
|
18
|
+
<a href="https://codsen.com/os/detect-is-it-html-or-xhtml/changelog" rel="nofollow noreferrer noopener">
|
|
19
|
+
<img src="https://img.shields.io/badge/changelog-here-brightgreen?style=flat-square" alt="changelog">
|
|
24
20
|
</a>
|
|
25
|
-
|
|
21
|
+
<img src="https://img.shields.io/badge/licence-MIT-brightgreen.svg?style=flat-square" alt="MIT Licence">
|
|
22
|
+
</p>
|
|
26
23
|
|
|
27
24
|
## Install
|
|
28
25
|
|
|
@@ -57,8 +54,8 @@ To report bugs or request features or assistance, [raise an issue](https://githu
|
|
|
57
54
|
|
|
58
55
|
## Licence
|
|
59
56
|
|
|
60
|
-
MIT License
|
|
57
|
+
MIT License.
|
|
61
58
|
|
|
62
|
-
Copyright
|
|
59
|
+
Copyright © 2010-2022 Roy Revelt and other contributors.
|
|
63
60
|
|
|
64
|
-
<img src="https://codsen.com/images/png-codsen-ok.png" width="98" alt="ok" align="center"> <img src="https://codsen.com/images/png-codsen-1.png" width="148" alt="codsen" align="center"> <img src="https://codsen.com/images/png-codsen-star-small.png" width="32" alt="star" align="center">
|
|
61
|
+
<p align="center"><img src="https://codsen.com/images/png-codsen-ok.png" width="98" alt="ok" align="center"> <img src="https://codsen.com/images/png-codsen-1.png" width="148" alt="codsen" align="center"> <img src="https://codsen.com/images/png-codsen-star-small.png" width="32" alt="star" align="center"></p>
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @name detect-is-it-html-or-xhtml
|
|
3
3
|
* @fileoverview Does the string resemble an HTML or XHTML (or neither)?
|
|
4
|
-
* @version 5.1.
|
|
4
|
+
* @version 5.1.6
|
|
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.1.
|
|
10
|
+
var i="5.1.6";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,d=/<\s*hr[^>]*>/gi,h=/\/\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 p=t.match(a)||[],u=t.match(m)||[],g=t.match(d)||[],r=p.concat(u).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(h))&&(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
3
|
* @fileoverview Does the string resemble an HTML or XHTML (or neither)?
|
|
4
|
-
* @version 5.1.
|
|
4
|
+
* @version 5.1.6
|
|
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
|
-
"use strict";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 d="5.1.
|
|
10
|
+
"use strict";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 d="5.1.6";var w=d;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,h=/<\s*hr[^>]*>/gi,p=/\/\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 u=t.match(n)||[],g=t.match(r)||[],y=t.match(h)||[],i=u.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(p))&&(m+=1);return m>i.length/2?"xhtml":"html"}return j(M);})();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "detect-is-it-html-or-xhtml",
|
|
3
|
-
"version": "5.1.
|
|
3
|
+
"version": "5.1.6",
|
|
4
4
|
"description": "Does the string resemble an HTML or XHTML (or neither)?",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"check",
|
|
@@ -39,6 +39,8 @@
|
|
|
39
39
|
"types": "types/index.d.ts",
|
|
40
40
|
"scripts": {
|
|
41
41
|
"build": "node '../../ops/scripts/esbuild.js' && yarn run dts",
|
|
42
|
+
"cjs-off": "exit 0",
|
|
43
|
+
"cjs-on": "exit 0",
|
|
42
44
|
"dev": "DEV=true node '../../ops/scripts/esbuild.js' && yarn run dts",
|
|
43
45
|
"devtest": "c8 yarn run unit && yarn run examples && yarn run lint",
|
|
44
46
|
"dts": "rollup -c && yarn run prettier 'types/index.d.ts' --write",
|