detect-is-it-html-or-xhtml 5.0.13 → 5.1.0

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,18 @@
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.1.0 (2022-08-12)
7
+
8
+ ### Features
9
+
10
+ - export types ([11b5fb9](https://github.com/codsen/codsen/commit/11b5fb936ce20e0a77c3a09806773e1cd7695c50))
11
+
12
+ ## [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)
13
+
14
+ ### Bug Fixes
15
+
16
+ - improve the throw message ([9c69a06](https://github.com/codsen/codsen/commit/9c69a067dc96490d9ceea69b85399c7d28600bfc))
17
+
6
18
  ## 5.0.0 (2021-09-09)
7
19
 
8
20
  ### Features
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # detect-is-it-html-or-xhtml
2
2
 
3
- > Answers, is the string input string more an HTML or XHTML (or neither)
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 Answers, is the string input string more an HTML or XHTML (or neither)
4
- * @version 5.0.13
3
+ * @fileoverview Does the string resemble an HTML or XHTML (or neither)?
4
+ * @version 5.1.0
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.13";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};
10
+ var i="5.1.0";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
+ "use strict";/**
2
2
  * @name detect-is-it-html-or-xhtml
3
- * @fileoverview Answers, is the string input string more an HTML or XHTML (or neither)
4
- * @version 5.0.13
3
+ * @fileoverview Does the string resemble an HTML or XHTML (or neither)?
4
+ * @version 5.1.0
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 I={};b(I,{detectIsItHTMLOrXhtml:()=>A,version:()=>w});var h="5.0.13";var w=h;function A(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 string");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(I);})();
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 d="5.1.0";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,7 +1,7 @@
1
1
  {
2
2
  "name": "detect-is-it-html-or-xhtml",
3
- "version": "5.0.13",
4
- "description": "Answers, is the string input string more an HTML or XHTML (or neither)",
3
+ "version": "5.1.0",
4
+ "description": "Does the string resemble an HTML or XHTML (or neither)?",
5
5
  "keywords": [
6
6
  "check",
7
7
  "code",
@@ -32,6 +32,7 @@
32
32
  },
33
33
  "type": "module",
34
34
  "exports": {
35
+ "types": "./types/index.d.ts",
35
36
  "script": "./dist/detect-is-it-html-or-xhtml.umd.js",
36
37
  "default": "./dist/detect-is-it-html-or-xhtml.esm.js"
37
38
  },
package/types/index.d.ts CHANGED
@@ -2,4 +2,4 @@ declare const version: string;
2
2
  declare type Output = "html" | "xhtml" | null;
3
3
  declare function detectIsItHTMLOrXhtml(input: string): Output;
4
4
 
5
- export { detectIsItHTMLOrXhtml, version };
5
+ export { Output, detectIsItHTMLOrXhtml, version };