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

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/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2010-2021 Roy Revelt and other contributors
3
+ Copyright (c) 2010-2022 Roy Revelt and other contributors
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining
6
6
  a copy of this software and associated documentation files (the
package/README.md CHANGED
@@ -26,14 +26,12 @@
26
26
 
27
27
  ## Install
28
28
 
29
- This package is ESM only: Node 12+ is needed to use it and it must be imported instead of required:
29
+ This package is [pure ESM](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c). If you're not ready yet, install an older version of this program, 4.1.0 (`npm i detect-is-it-html-or-xhtml@4.1.0`).
30
30
 
31
31
  ```bash
32
32
  npm i detect-is-it-html-or-xhtml
33
33
  ```
34
34
 
35
- If you need a legacy version which works with `require`, use version 4.1.0
36
-
37
35
  ## Quick Take
38
36
 
39
37
  ```js
@@ -61,8 +59,6 @@ To report bugs or request features or assistance, [raise an issue](https://githu
61
59
 
62
60
  MIT License
63
61
 
64
- Copyright (c) 2010-2021 Roy Revelt and other contributors
65
-
62
+ Copyright (c) 2010-2022 Roy Revelt and other contributors
66
63
 
67
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">
68
-
@@ -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.10
4
+ * @version 5.0.13
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 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,u=/\/\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 d=e.match(a)||[],g=e.match(m)||[],p=e.match(h)||[],r=d.concat(g).concat(p);if(r.length===0)return null;let n=0;for(let t=0,l=r.length;t<l;t++)o(r[t].match(u))&&(n+=1);return n>r.length/2?"xhtml":"html"}export{b as detectIsItHTMLOrXhtml,T as version};
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};
@@ -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.10
4
+ * @version 5.0.13
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 y=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=y(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 H={};v(H,{detectIsItHTMLOrXhtml:()=>A,version:()=>k});var h="5.0.10";var k=h;function A(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,u=/<\s*hr[^>]*>/gi,d=/\/\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 g=t.match(n)||[],p=t.match(s)||[],x=t.match(u)||[],i=g.concat(p).concat(x);if(i.length===0)return null;let m=0;for(let l=0,c=i.length;l<c;l++)e(i[l].match(d))&&(m+=1);return m>i.length/2?"xhtml":"html"}return R(H);})();
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);})();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "detect-is-it-html-or-xhtml",
3
- "version": "5.0.10",
3
+ "version": "5.0.13",
4
4
  "description": "Answers, is the string input string more an HTML or XHTML (or neither)",
5
5
  "keywords": [
6
6
  "check",
@@ -39,15 +39,18 @@
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
- "dts": "rollup -c",
42
+ "devtest": "c8 yarn run unit && yarn run examples && yarn run lint",
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",
48
49
  "prepare": "echo 'ready'",
50
+ "prettier": "prettier",
51
+ "prettier:format": "prettier --write '**/*.{ts,tsx,md}' --no-error-on-unmatched-pattern",
49
52
  "pretest": "yarn run lect && yarn run build",
50
- "test": "c8 yarn run unit && yarn run examples && yarn run lint",
53
+ "test": "yarn run devtest",
51
54
  "unit": "uvu test"
52
55
  },
53
56
  "engines": {