detect-is-it-html-or-xhtml 5.0.11 → 5.0.12
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.
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @name detect-is-it-html-or-xhtml
|
|
3
3
|
* @fileoverview Answers, is the string input string more an HTML or XHTML (or neither)
|
|
4
|
-
* @version 5.0.
|
|
4
|
+
* @version 5.0.12
|
|
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.12";var T=i;function b(e){function o(t){return t!=null}if(!e)return null;if(typeof e!="string")throw new TypeError("detect-is-it-html-or-xhtml: [THROW_ID_01] Input must be string");let c=/<\s*!\s*doctype[^>]*>/im,a=/<\s*img[^>]*>/gi,m=/<\s*br[^>]*>/gi,h=/<\s*hr[^>]*>/gi,d=/\/\s*>/g,s=e.match(c);if(s){let t=/xhtml/gi,l=/svg/gi;return s[0].match(t)||s[0].match(l)?"xhtml":"html"}let u=e.match(a)||[],p=e.match(m)||[],g=e.match(h)||[],r=u.concat(p).concat(g);if(r.length===0)return null;let n=0;for(let t=0,l=r.length;t<l;t++)o(r[t].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
3
|
* @fileoverview Answers, is the string input string more an HTML or XHTML (or neither)
|
|
4
|
-
* @version 5.0.
|
|
4
|
+
* @version 5.0.12
|
|
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
|
|
10
|
+
var detectIsItHtmlOrXhtml=(()=>{var a=Object.defineProperty;var x=Object.getOwnPropertyDescriptor;var f=Object.getOwnPropertyNames;var T=Object.prototype.hasOwnProperty;var b=t=>a(t,"__esModule",{value:!0});var v=(t,e)=>{for(var r in e)a(t,r,{get:e[r],enumerable:!0})},j=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of f(e))!T.call(t,s)&&(r||s!=="default")&&a(t,s,{get:()=>e[s],enumerable:!(n=x(e,s))||n.enumerable});return t};var R=(t=>(e,r)=>t&&t.get(e)||(r=j(b({}),e,1),t&&t.set(e,r),r))(typeof WeakMap!="undefined"?new WeakMap:0);var M={};v(M,{detectIsItHTMLOrXhtml:()=>I,version:()=>A});var h="5.0.12";var A=h;function I(t){function e(l){return l!=null}if(!t)return null;if(typeof t!="string")throw new TypeError("detect-is-it-html-or-xhtml: [THROW_ID_01] Input must be string");let r=/<\s*!\s*doctype[^>]*>/im,n=/<\s*img[^>]*>/gi,s=/<\s*br[^>]*>/gi,d=/<\s*hr[^>]*>/gi,u=/\/\s*>/g,o=t.match(r);if(o){let l=/xhtml/gi,c=/svg/gi;return o[0].match(l)||o[0].match(c)?"xhtml":"html"}let p=t.match(n)||[],g=t.match(s)||[],y=t.match(d)||[],i=p.concat(g).concat(y);if(i.length===0)return null;let m=0;for(let l=0,c=i.length;l<c;l++)e(i[l].match(u))&&(m+=1);return m>i.length/2?"xhtml":"html"}return R(M);})();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "detect-is-it-html-or-xhtml",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.12",
|
|
4
4
|
"description": "Answers, is the string input string more an HTML or XHTML (or neither)",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"check",
|
|
@@ -39,9 +39,10 @@
|
|
|
39
39
|
"scripts": {
|
|
40
40
|
"build": "node '../../ops/scripts/esbuild.js' && yarn run dts",
|
|
41
41
|
"dev": "DEV=true node '../../ops/scripts/esbuild.js' && yarn run dts",
|
|
42
|
+
"devtest": "c8 yarn run unit && yarn run examples && yarn run lint",
|
|
42
43
|
"dts": "rollup -c && yarn run prettier 'types/index.d.ts' --write",
|
|
43
44
|
"examples": "node '../../ops/scripts/run-examples.js'",
|
|
44
|
-
"lect": "node '../../ops/lect/lect.js'",
|
|
45
|
+
"lect": "node '../../ops/lect/lect.js' && yarn run prettier 'README.md' '.all-contributorsrc' 'rollup.config.js' --write",
|
|
45
46
|
"letspublish": "yarn publish || :",
|
|
46
47
|
"lint": "eslint . --fix",
|
|
47
48
|
"perf": "node perf/check.js",
|
|
@@ -49,7 +50,7 @@
|
|
|
49
50
|
"prettier": "prettier",
|
|
50
51
|
"prettier:format": "prettier --write '**/*.{ts,tsx,md}' --no-error-on-unmatched-pattern",
|
|
51
52
|
"pretest": "yarn run lect && yarn run build",
|
|
52
|
-
"test": "
|
|
53
|
+
"test": "yarn run devtest",
|
|
53
54
|
"unit": "uvu test"
|
|
54
55
|
},
|
|
55
56
|
"engines": {
|