detect-is-it-html-or-xhtml 6.2.0 → 6.2.1
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,13 +3,19 @@
|
|
|
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.2.1 (2026-08-22)
|
|
7
|
+
|
|
8
|
+
### Performance Improvements
|
|
9
|
+
|
|
10
|
+
- optimise package hot paths and JSON editing ([f3112bd](https://github.com/codsen/codsen/commit/f3112bd7fc0d7c9bc09312d3744c950691d72ca5))
|
|
11
|
+
|
|
6
12
|
## 6.2.0 (2026-08-19)
|
|
7
13
|
|
|
8
14
|
### Bug Fixes
|
|
9
15
|
|
|
10
16
|
- make validation diagnostics safe ([7b01074](https://github.com/codsen/codsen/commit/7b0107476f12734aeb8e82852ba980b187280110))
|
|
11
17
|
- reject non-string falsy inputs ([f000de4](https://github.com/codsen/codsen/commit/f000de44f1a5637ca8d5a593b3a9d933f9c7dac0))
|
|
12
|
-
- resolve review findings
|
|
18
|
+
- resolve various review findings ([b60e9ee](https://github.com/codsen/codsen/commit/b60e9eeb499af94685cfb87b4970fe025be1fc10))
|
|
13
19
|
- retire direct publish aliases ([f98e31e](https://github.com/codsen/codsen/commit/f98e31eb89bc185471225664e610b55f34fbf648))
|
|
14
20
|
|
|
15
21
|
### Features
|
|
@@ -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.2.
|
|
4
|
+
* @version 6.2.1
|
|
5
5
|
* @author Roy Revelt
|
|
6
6
|
* @license MIT
|
|
7
7
|
* {@link https://codsen.com/os/detect-is-it-html-or-xhtml/}
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
import{formatDiagnosticValue as l}from"codsen-utils";var o="6.2.
|
|
10
|
+
import{formatDiagnosticValue as l}from"codsen-utils";var o="6.2.1";var x=o,m=/<\s*!\s*doctype[^>]*>/i,p=/<\s*(?:img|br|hr)[^>]*>/gi,d=/\/\s*>/,h=/xhtml/i,a=/svg/i;function y(e){if(e==null||e==="")return null;if(typeof e!="string")throw new TypeError(`detect-is-it-html-or-xhtml/detectIsItHTMLOrXhtml(): [THROW_ID_01] Input must be a string! It was given as ${l(e,4)} (type ${typeof e})`);let s=e.match(m);if(s)return h.test(s[0])||a.test(s[0])?"xhtml":"html";let t=e.match(p);if(!t)return null;let n=0;for(let r=0,i=t.length;r<i;r++)d.test(t[r])&&(n+=1);return n>t.length/2?"xhtml":"html"}export{y as detectIsItHTMLOrXhtml,x as version};
|
|
@@ -1,17 +1,17 @@
|
|
|
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.2.
|
|
4
|
+
* @version 6.2.1
|
|
5
5
|
* @author Roy Revelt
|
|
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 g=Object.defineProperty;var
|
|
10
|
+
"use strict";var detectIsItHtmlOrXhtml=(()=>{var g=Object.defineProperty;var D=Object.getOwnPropertyDescriptor;var R=Object.getOwnPropertyNames;var I=Object.prototype.hasOwnProperty;var M=(t,i)=>{for(var e in i)g(t,e,{get:i[e],enumerable:!0})},$=(t,i,e,n)=>{if(i&&typeof i=="object"||typeof i=="function")for(let s of R(i))!I.call(t,s)&&s!==e&&g(t,s,{get:()=>i[s],enumerable:!(n=D(i,s))||n.enumerable});return t};var W=t=>$(g({},"__esModule",{value:!0}),t);var Q={};M(Q,{detectIsItHTMLOrXhtml:()=>_,version:()=>P});function T(){let t=[],i=0,e=!1;return{append(n){return e?!1:i+n.length>1999?(t.push("\u2026"),i+=1,e=!0,!1):(t.push(n),i+=n.length,!0)},result(){return t.join("")},stopped(){return e}}}function L(t){return"\\u".concat(t.toString(16).padStart(4,"0"))}function d(t,i){if(t.append('"')){for(let e=0;e<i.length&&!t.stopped();e+=1){let n=i.charCodeAt(e);n===34?t.append('\\"'):n===92?t.append("\\\\"):n===8?t.append("\\b"):n===9?t.append("\\t"):n===10?t.append("\\n"):n===12?t.append("\\f"):n===13?t.append("\\r"):n<32||n===8232||n===8233||n>=55296&&n<=57343?t.append(L(n)):t.append(i[e])}t.append('"')}}function B(t){return t.get&&t.set?"[Getter/Setter]":t.get?"[Getter]":t.set?"[Setter]":"[Accessor]"}function w(t,i){t.append("Symbol(");let e=String(i);e.length>8&&d(t,e.slice(7,-1)),t.append(")")}function A(t,i){typeof i=="symbol"?w(t,i):d(t,String(i))}function C(t,i=0){let e=T(),n=i===4?4:0,s=new WeakSet,c=0;function m(r){n&&e.append(" ".repeat(r*n))}function h(r,l){r&&e.append(","),n&&(e.append("\n"),m(l+1))}function y(r,l,o){n&&l&&(e.append("\n"),m(o)),e.append(r)}function b(r,l){Object.prototype.hasOwnProperty.call(r,"value")?v(r.value,l):e.append(B(r))}function k(r,l){let o;try{o=Reflect.getOwnPropertyDescriptor(r,"length")}catch(a){e.append("[Uninspectable]");return}let u=o==null?void 0:o.value;if(!Number.isSafeInteger(u)||u<0){e.append("[Uninspectable]");return}e.append("[");let f=!1;for(let a=0;a<u&&!e.stopped();a+=1){if(h(f,l),f=!0,c>=50){e.append("[MaxEntries]");break}c+=1;let p;try{p=Reflect.getOwnPropertyDescriptor(r,String(a))}catch(z){e.append("[Uninspectable]");continue}p!=null&&p.enumerable?b(p,l+1):e.append("[Empty]")}y("]",f,l)}function S(r,l){let o;try{o=Reflect.ownKeys(r)}catch(f){e.append("[Uninspectable]");return}e.append("{");let u=!1;for(let f of o){if(e.stopped())break;if(c>=50){h(u,l),u=!0,d(e,"\u2026"),e.append(n?": ":":"),e.append("[MaxEntries]");break}c+=1;let a;try{a=Reflect.getOwnPropertyDescriptor(r,f)}catch(p){h(u,l),u=!0,A(e,f),e.append(n?": ":":"),e.append("[Uninspectable]");continue}a!=null&&a.enumerable&&(h(u,l),u=!0,A(e,f),e.append(n?": ":":"),b(a,l+1))}y("}",u,l)}function j(r,l){if(s.has(r)){e.append("[Circular]");return}if(l>=5){e.append("[MaxDepth]");return}let o;try{o=Array.isArray(r)}catch(u){e.append("[Uninspectable]");return}s.add(r);try{o?k(r,l):S(r,l)}finally{s.delete(r)}}function v(r,l){r===null?e.append("null"):typeof r=="string"?d(e,r):typeof r=="number"?e.append(Object.is(r,-0)?"-0":String(r)):typeof r=="boolean"?e.append(r?"true":"false"):typeof r>"u"?e.append("undefined"):typeof r=="bigint"?e.append("".concat(r,"n")):typeof r=="symbol"?w(e,r):typeof r=="function"?e.append("[Function]"):j(r,l)}try{return v(t,0),e.result()}catch(r){return"[Uninspectable]"}}var X=new Set([..."\u060B$\u20BC\u17DB\xA5\u20A1\u20B1\xA3\u20AC\xA2\u20B9\uFDFC\u20AA\u20A9\u20AD\u20A8\u20AE\u20A6\u20BD\u20AB\u0E3F\u20A9\u20BA\u20B4","$U","$b","B/.","BZ$","Br","Bs","C$","CHF","Ft","Gs","J$","KM","K\u010D","L","MT","NT$","P","Q","R","R$","RD$","RM","Rp","S","S/.","TT$","Z$","kn","kr","lei","z\u0142","\u0192","\u0414\u0438\u043D.","\u0434\u0435\u043D","\u043B\u0432","\u062F.\u0625","Lek"]);var x,Z=(x=Object.getOwnPropertyDescriptor(RegExp.prototype,"source"))==null?void 0:x.get;var q=Date.prototype.getTime;var O="6.2.1";var P=O,U=/<\s*!\s*doctype[^>]*>/i,F=/<\s*(?:img|br|hr)[^>]*>/gi,N=/\/\s*>/,H=/xhtml/i,V=/svg/i;function _(t){if(t==null||t==="")return null;if(typeof t!="string")throw new TypeError("detect-is-it-html-or-xhtml/detectIsItHTMLOrXhtml(): [THROW_ID_01] Input must be a string! It was given as ".concat(C(t,4)," (type ").concat(typeof t,")"));let i=t.match(U);if(i)return H.test(i[0])||V.test(i[0])?"xhtml":"html";let e=t.match(F);if(!e)return null;let n=0;for(let s=0,c=e.length;s<c;s++)N.test(e[s])&&(n+=1);return n>e.length/2?"xhtml":"html"}return W(Q);})();
|
|
11
11
|
/**
|
|
12
12
|
* @name codsen-utils
|
|
13
13
|
* @fileoverview Various utility functions
|
|
14
|
-
* @version 1.
|
|
14
|
+
* @version 1.9.0
|
|
15
15
|
* @author Roy Revelt
|
|
16
16
|
* @license MIT
|
|
17
17
|
* {@link https://codsen.com/os/codsen-utils/}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "detect-is-it-html-or-xhtml",
|
|
3
|
-
"version": "6.2.
|
|
3
|
+
"version": "6.2.1",
|
|
4
4
|
"description": "Does the string resemble an HTML or XHTML (or neither)?",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"check",
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
}
|
|
71
71
|
},
|
|
72
72
|
"dependencies": {
|
|
73
|
-
"codsen-utils": "^1.
|
|
73
|
+
"codsen-utils": "^1.9.0"
|
|
74
74
|
},
|
|
75
75
|
"engines": {
|
|
76
76
|
"node": ">=18.20.8"
|