detect-is-it-html-or-xhtml 6.0.2 → 6.0.3
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,10 +3,6 @@
|
|
|
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
|
-
## [6.0.2](https://github.com/codsen/codsen/compare/detect-is-it-html-or-xhtml@6.0.1...detect-is-it-html-or-xhtml@6.0.2) (2022-12-06)
|
|
7
|
-
|
|
8
|
-
**Note:** Version bump only for package detect-is-it-html-or-xhtml
|
|
9
|
-
|
|
10
6
|
## 6.0.0 (2022-12-01)
|
|
11
7
|
|
|
12
8
|
### Bug Fixes
|
|
@@ -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 6.0.
|
|
4
|
+
* @version 6.0.3
|
|
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="6.0.
|
|
10
|
+
var i="6.0.3";var v=i;function T(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 m=/<\s*!\s*doctype[^>]*>/im,c=/<\s*img[^>]*>/gi,p=/<\s*br[^>]*>/gi,a=/<\s*hr[^>]*>/gi,d=/\/\s*>/g,s=t.match(m);if(s){let e=/xhtml/gi,l=/svg/gi;return s[0].match(e)||s[0].match(l)?"xhtml":"html"}let h=t.match(c)||[],u=t.match(p)||[],g=t.match(a)||[],r=h.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(d))&&(n+=1);return n>r.length/2?"xhtml":"html"}export{T as detectIsItHTMLOrXhtml,v 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 6.0.
|
|
4
|
+
* @version 6.0.3
|
|
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 c=Object.defineProperty;var f=Object.getOwnPropertyDescriptor;var y=Object.getOwnPropertyNames;var v=Object.prototype.hasOwnProperty;var T=(t,e)=>{for(var l in e)c(t,l,{get:e[l],enumerable:!0})},b=(t,e,l,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of y(e))!v.call(t,r)&&r!==l&&c(t,r,{get:()=>e[r],enumerable:!(n=f(e,r))||n.enumerable});return t};var j=t=>b(c({},"__esModule",{value:!0}),t);var M={};T(M,{detectIsItHTMLOrXhtml:()=>I,version:()=>w});var a="6.0.
|
|
10
|
+
"use strict";var detectIsItHtmlOrXhtml=(()=>{var c=Object.defineProperty;var f=Object.getOwnPropertyDescriptor;var y=Object.getOwnPropertyNames;var v=Object.prototype.hasOwnProperty;var T=(t,e)=>{for(var l in e)c(t,l,{get:e[l],enumerable:!0})},b=(t,e,l,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of y(e))!v.call(t,r)&&r!==l&&c(t,r,{get:()=>e[r],enumerable:!(n=f(e,r))||n.enumerable});return t};var j=t=>b(c({},"__esModule",{value:!0}),t);var M={};T(M,{detectIsItHTMLOrXhtml:()=>I,version:()=>w});var a="6.0.3";var w=a;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,h=/\/\s*>/g,o=t.match(l);if(o){let s=/xhtml/gi,m=/svg/gi;return o[0].match(s)||o[0].match(m)?"xhtml":"html"}let u=t.match(n)||[],g=t.match(r)||[],x=t.match(d)||[],i=u.concat(g).concat(x);if(i.length===0)return null;let p=0;for(let s=0,m=i.length;s<m;s++)e(i[s].match(h))&&(p+=1);return p>i.length/2?"xhtml":"html"}return j(M);})();
|
package/package.json
CHANGED
package/types/index.d.ts
CHANGED
|
File without changes
|