detect-is-it-html-or-xhtml 5.1.3 → 5.1.4
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
|
@@ -23,7 +23,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
23
23
|
|
|
24
24
|
### BREAKING CHANGES
|
|
25
25
|
|
|
26
|
-
- programs now are in ES Modules and won't work with Common JS require()
|
|
26
|
+
- programs now are in ES Modules and won't work with Common JS `require()`
|
|
27
27
|
|
|
28
28
|
## 4.1.0 (2021-05-24)
|
|
29
29
|
|
|
@@ -41,7 +41,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
41
41
|
|
|
42
42
|
### Fixed
|
|
43
43
|
|
|
44
|
-
- add testStats to npmignore ([f3c84e9](https://github.com/codsen/codsen/commit/f3c84e95afc5514214312f913692d85b2e12eb29))
|
|
44
|
+
- add `testStats` to npmignore ([f3c84e9](https://github.com/codsen/codsen/commit/f3c84e95afc5514214312f913692d85b2e12eb29))
|
|
45
45
|
|
|
46
46
|
## 4.0.0 (2021-01-23)
|
|
47
47
|
|
|
@@ -55,7 +55,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
55
55
|
|
|
56
56
|
## 3.11.0 (2020-11-28)
|
|
57
57
|
|
|
58
|
-
Accidental version bump during migration to
|
|
58
|
+
Accidental version bump during migration to SourceHut. Sorry about that.
|
|
59
59
|
|
|
60
60
|
## 3.10.0 (2020-09-27)
|
|
61
61
|
|
|
@@ -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.4
|
|
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.4";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.4
|
|
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.4";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.4",
|
|
4
4
|
"description": "Does the string resemble an HTML or XHTML (or neither)?",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"check",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"examples": "node '../../ops/scripts/run-examples.js'",
|
|
46
46
|
"lect": "node '../../ops/lect/lect.js' && yarn run prettier 'README.md' '.all-contributorsrc' 'rollup.config.js' --write",
|
|
47
47
|
"letspublish": "yarn publish || :",
|
|
48
|
-
"lint": "eslint . --fix",
|
|
48
|
+
"lint": "eslint . --ext .js --ext .ts --fix",
|
|
49
49
|
"perf": "node perf/check.js",
|
|
50
50
|
"prepare": "echo 'ready'",
|
|
51
51
|
"prettier": "prettier",
|
package/examples/_quickTake.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
// Quick Take
|
|
2
|
-
|
|
3
|
-
import { strict as assert } from "assert";
|
|
4
|
-
|
|
5
|
-
import { detectIsItHTMLOrXhtml } from "../dist/detect-is-it-html-or-xhtml.esm.js";
|
|
6
|
-
|
|
7
|
-
assert.equal(
|
|
8
|
-
detectIsItHTMLOrXhtml(
|
|
9
|
-
`<img src="some.jpg" width="zzz" height="zzz" border="0" style="display:block;" alt="zzz"/>`
|
|
10
|
-
),
|
|
11
|
-
"xhtml"
|
|
12
|
-
);
|