codsen-utils 1.7.3 → 1.8.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,11 +3,26 @@
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
- ## 1.7.0 (2025-10-15)
6
+ ## 1.8.0 (2026-08-19)
7
+
8
+ ### Bug Fixes
9
+
10
+ - make validation diagnostics safe ([7b01074](https://github.com/codsen/codsen/commit/7b0107476f12734aeb8e82852ba980b187280110))
11
+ - resolve review findings REV-004 through REV-007 ([b60e9ee](https://github.com/codsen/codsen/commit/b60e9eeb499af94685cfb87b4970fe025be1fc10))
12
+ - retire direct publish aliases ([f98e31e](https://github.com/codsen/codsen/commit/f98e31eb89bc185471225664e610b55f34fbf648))
13
+ - treat a backslash run before * like a run before any other char ([5cc839a](https://github.com/codsen/codsen/commit/5cc839abc1ba3f19f6c4ee740e8514d9122588d6))
7
14
 
8
15
  ### Features
9
16
 
10
- - if value to be added is a number, keep it as is, don't stringify ([ce3e1a5](https://github.com/codsen/codsen/commit/ce3e1a525998ca3c0abf0142affef95b14cd1990))
17
+ - add codsen-glob and migrate glob consumers ([5595a2b](https://github.com/codsen/codsen/commit/5595a2b267eaa6cb60072d037aef00b7a28edd42))
18
+ - add insurance to findAllIdx() against an empty substring ([b8be7c8](https://github.com/codsen/codsen/commit/b8be7c8813d233e84eea3d5ff9ffc1bf9f0d1199))
19
+ - expand the shared utilty toolkit ([2d9a125](https://github.com/codsen/codsen/commit/2d9a125b16f01abf925be258329931f093dbbbe3))
20
+ - refresh the tooling and generate with the latest dependencies ([781f802](https://github.com/codsen/codsen/commit/781f802911066a82a4533b0e5a3fcbd742d0dd83))
21
+
22
+ ### Reverts
23
+
24
+ - Revert "Merge pull request #128 from codsen/release/npm-32198404552-1" ([5baeeaa](https://github.com/codsen/codsen/commit/5baeeaaa677b86f1eaa6396cadf3aea32b06416e)), closes [#128](https://github.com/codsen/codsen/issues/128)
25
+ - Revert "Merge pull request #127 from codsen/release/npm-32194020886-1" ([5f1e94d](https://github.com/codsen/codsen/commit/5f1e94deef910ce735266b16aeee08a76de7a862)), closes [#127](https://github.com/codsen/codsen/issues/127)
11
26
 
12
27
  ## 1.6.0 (2023-05-21)
13
28
 
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright © 2010-2025 Roy Revelt and other contributors
3
+ Copyright © 2010-2026 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
@@ -32,17 +32,17 @@ npm i codsen-utils
32
32
  ## Quick Take
33
33
 
34
34
  ```js
35
- import { strict as assert } from "assert";
35
+ import { strict as assert } from "node:assert";
36
36
 
37
37
  import { isNumberChar } from "codsen-utils";
38
38
 
39
- assert.equal(isNumberChar("z"), false);
40
39
  assert.equal(isNumberChar("0"), true);
41
40
  ```
42
41
 
42
+
43
43
  ## Documentation
44
44
 
45
- Please [visit codsen.com](https://codsen.com/os/codsen-utils/) for a full description of the API.
45
+ Please [visit codsen.com](https://codsen.com/os/codsen-utils/) for a full description of the API. If you’re looking for the **Changelog**, it’s [here](https://github.com/codsen/codsen/blob/main/packages/codsen-utils/CHANGELOG.md).
46
46
 
47
47
  ## Contributing
48
48
 
@@ -52,6 +52,6 @@ To report bugs or request features or assistance, [raise an issue](https://githu
52
52
 
53
53
  MIT License
54
54
 
55
- Copyright © 2010-2025 Roy Revelt and other contributors
55
+ Copyright © 2010-2026 Roy Revelt and other contributors
56
56
 
57
57
  <p align="center"><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"></p>
@@ -1,19 +1,29 @@
1
1
  /**
2
2
  * @name codsen-utils
3
3
  * @fileoverview Various utility functions
4
- * @version 1.7.3
4
+ * @version 1.8.0
5
5
  * @author Roy Revelt
6
6
  * @license MIT
7
7
  * {@link https://codsen.com/os/codsen-utils/}
8
8
  */
9
9
 
10
- var i="1.7.3";import p from"rfdc";var l=p(),k=i,a="\u2018",f="\u2019",m="\u201C",d="\u201D",S="\u2013",O="\u2014",C="\xA0",N="\u2026",A="\u200A",j="\u2009",E="\u2032",T="\u2033",J="\\",R="\uFFFD",$="`",L="\xD7",D=[".",",",";","!","?"];function U(t){return r(t)&&t.charCodeAt(0)>=48&&t.charCodeAt(0)<=57}function g(t){return r(t)&&"\u060B$\u20BC\u17DB\xA5\u20A1\u20B1\xA3\u20AC\xA2\u20B9\uFDFC\u20AA\u20A9\u20AD\u20A8\u20AE\u20A6\u20BD\u20AB\u0E3F\u20A9\u20BA\u20B4".includes(t)}function F(t){let e=new Set(["$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"]);return r(t)&&!!t.trim()&&(g(t)||e.has(t))}function s(t){return r(t)&&t.length===1&&t.toUpperCase()!==t.toLowerCase()}function I(t){return!!(t&&r(t)&&(t.charCodeAt(0)>64&&t.charCodeAt(0)<91||t.charCodeAt(0)>96&&t.charCodeAt(0)<123))}function P(t){return r(t)&&(t==='"'||t==="'"||t===a||t===f||t===m||t===d)}function M(t){return!r(t)||!s(t)?!1:t===t.toLowerCase()&&t!==t.toUpperCase()}function Q(t){return!r(t)||!s(t)?!1:t===t.toUpperCase()&&t!==t.toLowerCase()}function V(t){return!r(t)||!t?!1:!t[0].trim()}var B=t=>r(t)&&t.length&&t.endsWith("/")?t.slice(0,-1).trim():t;function u(t){if(t==null||typeof t!="object")return!1;let e=Object.getPrototypeOf(t);return e!==null&&e!==Object.prototype&&Object.getPrototypeOf(e)!==null?!1:!(Symbol.iterator in t)&&!(Symbol.toStringTag in t)}function K(t="",e=0,n=0,o=""){return e<0&&(e+=t.length,e<0&&(e=0)),t.slice(0,e)+(o||"")+t.slice(e+n)}function r(t){return typeof t=="string"}function W(t){return Number.isFinite(t)}function q(t){return Number.isSafeInteger(t)&&t>=0}function H(t){return typeof t=="boolean"}function Z(t){return t===null}function x(t){return t instanceof RegExp}function _(t,e){if(!r(t)||!r(e))return[];let n=[],o=-1;for(;(o=t.indexOf(e,o+1))>=0;)n.push(o);return n}function z(t=[],e=[]){return!t||!Array.isArray(t)||!t.length?[]:!e||!Array.isArray(e)||!e.length?t:t.filter(n=>!e.includes(n))}function G(t){return t!=null}function X(t){return[...new Set(t)]}function b(t){if(!(typeof t!="string"||!t)){if(t.includes(`\r
10
+ var $="1.8.0";function ne(){let e=[],n=0,t=!1;return{append(r){return t?!1:n+r.length>1999?(e.push("\u2026"),n+=1,t=!0,!1):(e.push(r),n+=r.length,!0)},result(){return e.join("")},stopped(){return t}}}function te(e){return`\\u${e.toString(16).padStart(4,"0")}`}function I(e,n){if(e.append('"')){for(let t=0;t<n.length&&!e.stopped();t+=1){let r=n.charCodeAt(t);r===34?e.append('\\"'):r===92?e.append("\\\\"):r===8?e.append("\\b"):r===9?e.append("\\t"):r===10?e.append("\\n"):r===12?e.append("\\f"):r===13?e.append("\\r"):r<32||r===8232||r===8233||r>=55296&&r<=57343?e.append(te(r)):e.append(n[t])}e.append('"')}}function re(e){return e.get&&e.set?"[Getter/Setter]":e.get?"[Getter]":e.set?"[Setter]":"[Accessor]"}function J(e,n){e.append("Symbol(");let t=String(n);t.length>8&&I(e,t.slice(7,-1)),e.append(")")}function _(e,n){typeof n=="symbol"?J(e,n):I(e,String(n))}function U(e,n=0){let t=ne(),r=n===4?4:0,s=new WeakSet,o=0;function i(c){r&&t.append(" ".repeat(c*r))}function l(c,d){c&&t.append(","),r&&(t.append(`
11
+ `),i(d+1))}function f(c,d,p){r&&d&&(t.append(`
12
+ `),i(p)),t.append(c)}function g(c,d){Object.prototype.hasOwnProperty.call(c,"value")?S(c.value,d):t.append(re(c))}function m(c,d){let p;try{p=Reflect.getOwnPropertyDescriptor(c,"length")}catch{t.append("[Uninspectable]");return}let x=p?.value;if(!Number.isSafeInteger(x)||x<0){t.append("[Uninspectable]");return}t.append("[");let b=!1;for(let k=0;k<x&&!t.stopped();k+=1){if(l(b,d),b=!0,o>=50){t.append("[MaxEntries]");break}o+=1;let R;try{R=Reflect.getOwnPropertyDescriptor(c,String(k))}catch{t.append("[Uninspectable]");continue}R?.enumerable?g(R,d+1):t.append("[Empty]")}f("]",b,d)}function M(c,d){let p;try{p=Reflect.ownKeys(c)}catch{t.append("[Uninspectable]");return}t.append("{");let x=!1;for(let b of p){if(t.stopped())break;if(o>=50){l(x,d),x=!0,I(t,"\u2026"),t.append(r?": ":":"),t.append("[MaxEntries]");break}o+=1;let k;try{k=Reflect.getOwnPropertyDescriptor(c,b)}catch{l(x,d),x=!0,_(t,b),t.append(r?": ":":"),t.append("[Uninspectable]");continue}k?.enumerable&&(l(x,d),x=!0,_(t,b),t.append(r?": ":":"),g(k,d+1))}f("}",x,d)}function h(c,d){if(s.has(c)){t.append("[Circular]");return}if(d>=5){t.append("[MaxDepth]");return}let p;try{p=Array.isArray(c)}catch{t.append("[Uninspectable]");return}s.add(c);try{p?m(c,d):M(c,d)}finally{s.delete(c)}}function S(c,d){c===null?t.append("null"):typeof c=="string"?I(t,c):typeof c=="number"?t.append(Object.is(c,-0)?"-0":String(c)):typeof c=="boolean"?t.append(c?"true":"false"):typeof c>"u"?t.append("undefined"):typeof c=="bigint"?t.append(`${c}n`):typeof c=="symbol"?J(t,c):typeof c=="function"?t.append("[Function]"):h(c,d)}try{return S(e,0),t.result()}catch{return"[Uninspectable]"}}var We=$,oe="\u2018",se="\u2019",ie="\u201C",ce="\u201D",Ne="\u2013",Ee="\u2014",Ue="\xA0",De="\u2026",Le="\u200A",Be="\u2009",Fe="\u2032",Ve="\u2033",$e="\\",_e="\uFFFD",Je="`",Ke="\xD7",He=[".",",",";","!","?"],G=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"]),j=Object.prototype.hasOwnProperty,P=class{hasRepeatedReferences=!1;clones=[];index;sources=[];get(n){if(this.index){let r=this.index.get(n);return r!==void 0&&(this.hasRepeatedReferences=!0),r}let t=this.sources.indexOf(n);if(t!==-1)return this.hasRepeatedReferences=!0,this.clones[t]}set(n,t){if(this.index){this.index.set(n,t);return}if(this.sources.push(n),this.clones.push(t),this.sources.length===32){this.index=new WeakMap;for(let r=0;r<this.sources.length;r++)this.index.set(this.sources[r],this.clones[r]);this.sources=[],this.clones=[]}}};function Q(e,n){let t=n.get(e);if(t!==void 0)return t;let r=e.slice(0);return n.set(e,r),r}function le(e,n){if(typeof Buffer<"u"&&Buffer.isBuffer(e)){let o=Buffer.from(e);return n.set(e,o),o}let t=Q(e.buffer,n);if(e instanceof DataView){let o=new DataView(t,e.byteOffset,e.byteLength);return n.set(e,o),o}let r=e.constructor,s=new r(t,e.byteOffset,e.length);return n.set(e,s),s}function D(e,n,t,r){for(let s of t){let o=n[s];e[s]=typeof o!="object"||o===null?o:T(o,r)}}function T(e,n){if(typeof e!="object"||e===null)return e;let t=n.get(e);if(t!==void 0)return t;if(Array.isArray(e)){let o=e.length,i=new Array(o);n.set(e,i);let l=e,f=Object.keys(e);if(f.length===o&&(o===0||f[o-1]===`${o-1}`))for(let g=0;g<o;g++){let m=l[g];i[g]=typeof m!="object"||m===null?m:T(m,n)}else D(i,l,f,n);return i}let r=Object.getPrototypeOf(e);if(r===Object.prototype||r===null){let o={};return n.set(e,o),D(o,e,Object.keys(e),n),o}if(e instanceof Date){let o=new Date(e.getTime());return n.set(e,o),o}if(ArrayBuffer.isView(e))return le(e,n);if(e instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&e instanceof SharedArrayBuffer)return Q(e,n);if(e instanceof Map){let o=new Map;n.set(e,o);for(let[i,l]of e)o.set(T(i,n),T(l,n));return o}if(e instanceof Set){let o=new Set;n.set(e,o);for(let i of e)o.add(T(i,n));return o}let s={};return n.set(e,s),D(s,e,Object.keys(e),n),s}function Ge(e){return T(e,new P)}function Qe(e){let n=new P,t=T(e,n);return{hasRepeatedReferences:n.hasRepeatedReferences,value:t}}function Xe(e){if(!w(e))return!1;let n=e.charCodeAt(0);return n>=48&&n<=57}function qe(e){return w(e)&&e.length===1&&G.has(e)}function ze(e){return w(e)&&G.has(e)}function Ze(e){if(!w(e)||e.length!==1)return!1;let n=e.charCodeAt(0);return n<128?n>64&&n<91||n>96&&n<123:e.toUpperCase()!==e.toLowerCase()}function Ye(e){if(!e||!w(e))return!1;let n=e.charCodeAt(0);return n>64&&n<91||n>96&&n<123}function ve(e){return w(e)&&(e==='"'||e==="'"||e===oe||e===se||e===ie||e===ce)}function en(e){if(!w(e)||e.length!==1)return!1;let n=e.charCodeAt(0);return n<128?n>96&&n<123:e===e.toLowerCase()&&e!==e.toUpperCase()}function nn(e){if(!w(e)||e.length!==1)return!1;let n=e.charCodeAt(0);return n<128?n>64&&n<91:e===e.toUpperCase()&&e!==e.toLowerCase()}function tn(e){if(!w(e)||!e)return!1;let n=e.charCodeAt(0);return n<128?n===32||n>8&&n<14:!e[0].trim()}var rn=e=>w(e)&&e.length&&e.endsWith("/")?e.slice(0,-1).trim():e;function X(e){if(e==null||typeof e!="object")return!1;let n=Object.getPrototypeOf(e);return n!==null&&n!==Object.prototype&&Object.getPrototypeOf(n)!==null?!1:!(Symbol.iterator in e)&&!(Symbol.toStringTag in e)}function on(e="",n=0,t=0,r=""){return n<0&&(n+=e.length,n<0&&(n=0)),e.slice(0,n)+(r||"")+e.slice(n+t)}function w(e){return typeof e=="string"}function fe(e){return Number.isFinite(e)}function sn(e){return Number.isSafeInteger(e)&&e>=0}function cn(e){return typeof e=="boolean"}function ln(e){return e===null}function ae(e){return e instanceof RegExp}function fn(e,n){if(!w(e)||!w(n)||n.length===0)return[];let t=[],r=e.indexOf(n);for(;r!==-1;)t.push(r),r=e.indexOf(n,r+1);return t}function an(e=[],n=[]){if(!e||!Array.isArray(e)||!e.length)return[];if(!n||!Array.isArray(n)||!n.length)return e;if(e.length<128||n.length<5)return e.filter(r=>!n.includes(r));let t=new Set(n);return e.filter(r=>!t.has(r))}function un(e){return e!=null}function dn(e){return[...new Set(e)]}function ue(e){if(!(typeof e!="string"||!e)){if(e.includes(`\r
11
13
  `))return`\r
12
- `;if(t.includes(`
14
+ `;if(e.includes(`
13
15
  `))return`
14
- `;if(t.includes("\r"))return"\r"}}function Y(t,e,n=`
15
- `){if(![`\r
16
- `,"\r",`
17
- `].includes(n))throw new Error(`codsen-utils/resolveEolSetting(): the input argument defaultEolChar should be one of EOL values: "\\n", "\\r", or "\\r\\n", but it was given as ${JSON.stringify(n,null,0)}`);return e==="crlf"?`\r
18
- `:e==="cr"?"\r":e==="lf"?`
19
- `:b(t)||n}function v(t,e){return u(t)&&r(e)&&e in t}function tt(t,e){return t.localeCompare(e)}var et=["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"],nt=new Set(["a","abbr","acronym","audio","b","bdi","bdo","big","br","button","canvas","cite","code","data","datalist","del","dfn","em","embed","i","iframe","img","input","ins","kbd","label","map","mark","meter","noscript","object","output","picture","progress","q","ruby","s","samp","script","select","slot","small","span","strong","sub","sup","svg","template","textarea","time","u","tt","var","video","wbr"]);function rt(t,e){return!Array.isArray(t)||!t.length?!1:t.some(n=>x(n)&&e.match(n)||typeof n=="string"&&e===n)}function ot(t=[],e=[]){return!t||!e?[]:Array.from(new Set(Array.from(t).filter(n=>new Set(e).has(n))))}function it(t,e=[]){if(!t)return t;if(!u(t))throw new Error(`codsen-utils/omit(): [THROW_ID_01] Input must be a plain object! It was given as ${JSON.stringify(t,null,4)} (typeof is "${typeof t}")`);let n=l(t);return e.forEach(o=>{delete n[o]}),n}export{J as backslash,$ as backtick,tt as compareFn,b as detectEol,T as doublePrime,N as ellipsis,G as existy,_ as findAllIdx,A as hairspace,v as hasOwnProp,rt as includes,nt as inlineTags,ot as intersection,H as isBool,g as isCurrencyChar,F as isCurrencySymbol,q as isInt,I as isLatinLetter,s as isLetter,M as isLowercaseLetter,Z as isNull,W as isNum,U as isNumberChar,u as isPlainObject,P as isQuote,x as isRegExp,r as isStr,Q as isUppercaseLetter,V as isWhitespaceChar,m as leftDoubleQuote,a as leftSingleQuote,L as multiplicationSign,it as omit,z as pullAll,D as punctuationChars,O as rawMDash,S as rawNDash,C as rawNbsp,R as rawReplacementMark,B as removeTrailingSlash,Y as resolveEolSetting,d as rightDoubleQuote,f as rightSingleQuote,E as singlePrime,K as stringSplice,j as thinSpace,X as uniq,k as version,et as voidTags};
16
+ `;if(e.includes("\r"))return"\r"}}function pn(e,n,t=`
17
+ `){if(t!==`
18
+ `&&t!==`\r
19
+ `&&t!=="\r")throw new Error(`codsen-utils/resolveEolSetting(): [THROW_ID_01] the input argument defaultEolChar should be one of EOL values: "\\n", "\\r", or "\\r\\n", but it was given as ${U(t)}`);return n==="crlf"?`\r
20
+ `:n==="cr"?"\r":n==="lf"?`
21
+ `:ue(e)||t}function gn(e,n){return X(e)&&w(n)&&j.call(e,n)}function hn(e,n){return e.localeCompare(n)}var bn=["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"],yn=new Set(["a","abbr","acronym","audio","b","bdi","bdo","big","br","button","canvas","cite","code","data","datalist","del","dfn","em","embed","i","iframe","img","input","ins","kbd","label","map","mark","meter","noscript","object","output","picture","progress","q","ruby","s","samp","script","select","slot","small","span","strong","sub","sup","svg","template","textarea","time","u","tt","var","video","wbr"]);function mn(e,n){if(!Array.isArray(e)||!e.length||!w(n))return!1;for(let t of e){if(typeof t=="string"){if(n===t)return!0;continue}if(ae(t)){t.global&&(t.lastIndex=0);let r=t.test(n);if(t.global&&(t.lastIndex=0),r)return!0}}return!1}function xn(e=[],n=[]){if(!Array.isArray(e)||!Array.isArray(n)||!e.length||!n.length)return[];let t=[];if(e.length*n.length<64){for(let o of e)n.includes(o)&&!t.includes(o)&&t.push(o);return t}let r=new Set(n),s=new Set;for(let o of e)r.has(o)&&!s.has(o)&&(s.add(o),t.push(o));return t}var L=/^-?\d+(?:\.\d*)?(?:e[+-]?\d+)?$/i;function de(e){return e.replace(/-+([^-])/g,(n,t)=>t.toUpperCase())}function pe(e){return e.replace(/([\da-z])([A-Z])/g,"$1-$2").toLowerCase()}function ge(e){return e.replace(/^[\r\n]+/,"").replace(/[\r\n]+$/,"")}function K(e,n){let t=Number.POSITIVE_INFINITY,r=e.split(`
22
+ `);for(let o of r){let i=/^[ \t]*(?=\S)/.exec(o);i&&(t=Math.min(t,i[0].length))}let s=" ".repeat(n);return r.map(o=>o.trim()?s+o.slice(t):o).join(`
23
+ `)}function he(e,n,t){let r="";return e&&(r=ge(e.replace(/\t+\n*$/,"")),r.includes(`
24
+ `)&&(r=K(r,t)),r=`
25
+ ${r}`),n&&(r=r?`${K(`
26
+ ${n}
27
+ `,t)}${r}`:`
28
+ ${n}`),`${r}
29
+ `}function be(e){let n=w(e.name)?e.name:"",{bin:t}=e;return w(t)?n.slice(n.startsWith("@")?n.indexOf("/")+1:0):t&&typeof t=="object"?Object.keys(t)[0]??n:n}function ye(e,n){let t=e?e.type:void 0;return n===void 0?t==="string"?"":t==="number"?void 0:!0:t==="boolean"?n==="true":t==="number"?Number(n):n}function kn(e="",n={}){let t=typeof process>"u"?void 0:process,r=n.pkg??{},s=n.argv??t?.argv.slice(2)??[],o=n.helpIndent??2,i=n.autoHelp??!0,l=n.autoVersion??!0,f=n.version??r.version??"No version found",g=j.call(n,"booleanDefault")?n.booleanDefault:!1,m=he(e,n.description??r.description,o);function M(a){console.log(m),t?.exit(fe(a)?a:2)}function h(){console.log(f),t?.exit(0)}let S=[],c=new Map;for(let[a,u]of Object.entries(n.flags??{})){let y={key:a,type:u.type,isMultiple:!!u.isMultiple,source:u};S.push(y),c.set(a,y),c.set(pe(a),y),u.shortFlag&&c.set(u.shortFlag,y)}let d=[],p={};function x(a,u){let y=c.get(a),C=y?y.key:de(a);if(y?.isMultiple){let A=p[C];Array.isArray(A)?A.push(u):p[C]=[u];return}p[C]=u}function b(a,u){x(a,ye(c.get(a),u))}function k(a,u){return u===void 0?!1:a?.type==="boolean"?u==="true"||u==="false":!(u.startsWith("-")&&u.length>1&&!L.test(u))}function R(a,u){let y=a.slice(1);for(let C=0;C<y.length;C++){let A=y[C],O=y.slice(C+1);if(O.startsWith("="))return b(A,O.slice(1)),u;if(L.test(O)||O&&/\W/.test(O[0]))return b(A,O),u;let E=c.get(A);if(O&&E?.type&&E.type!=="boolean")return b(A,O),u;if(O){b(A,void 0);continue}if(k(E,s[u+1]))return b(A,s[u+1]),u+1;b(A,void 0)}return u}for(let a=0;a<s.length;a++){let u=s[a];if(u==="--"){d.push(...s.slice(a+1));break}if(u.startsWith("--")){let y=u.slice(2),C=y.indexOf("=");if(C!==-1){b(y.slice(0,C),y.slice(C+1));continue}if(y.startsWith("no-")){x(y.slice(3),!1);continue}let A=c.get(y);if(k(A,s[a+1])){b(y,s[a+1]),a++;continue}b(y,void 0);continue}if(u.startsWith("-")&&u.length>1&&!L.test(u)){a=R(u,a);continue}d.push(u)}for(let a of S)j.call(p,a.key)||(j.call(a.source,"default")?p[a.key]=a.source.default:a.isMultiple?p[a.key]=[]:a.type==="boolean"&&g!==void 0&&(p[a.key]=g));!d.length&&s.length===1&&(l&&p.version===!0?h():i&&p.help===!0&&M(0));let V=be(r);return V&&t&&(t.title=V),{input:d,flags:p,pkg:r,help:m,showHelp:M,showVersion:h}}function wn(e,n=[]){if(!e)return e;if(!X(e))throw new Error(`codsen-utils/omit(): [THROW_ID_02] Input must be a plain object! It was given as ${U(e,4)} (typeof is "${typeof e}")`);let t={},r=new P;r.set(e,t);let s=Object.keys(e),o=s.length<128||n.length<5?void 0:new Set(n);for(let i of s)(o?o.has(i):n.includes(i))||(t[i]=T(e[i],r));return t}var me=256,xe=1024,ke=1,we=new Map,Ce=new Map;function F(e){if(e>=97&&e<=122)return e-32;if(e>65535)return e;let n=String.fromCharCode(e).toUpperCase();if(n.length!==1)return e;let t=n.charCodeAt(0);return e>127&&t<128?e:t}function B(e,n,t,r,s,o){for(let i=0;i<s;i++){let l=e.charCodeAt(n+i),f=t.charCodeAt(r+i);if(o||(l>=97&&l<=122&&(l-=32),f>=97&&f<=122&&(f-=32)),l!==f)return!1}return!0}function q(e,n,t){let r=n.indexOf("\\");if(r===-1&&e===n)return!0;let s=n.indexOf("*");if(r===-1&&s===-1){if(t)return!1;for(let m=0;m<n.length;m++)if(n.charCodeAt(m)>127)return;return e.length===n.length&&B(e,0,n,0,n.length,!1)}if(r!==-1)return;let o=0,i=!1,l=-1;for(let m=0;m<n.length;m++){let M=n.charCodeAt(m);if(M>127)return;if(M===42){if(l=m,!i){if(o++,o>1)return;i=!0}}else i=!1}let f=l+1,g=n.length-f;return e.length<s+g?!1:B(e,0,n,0,s,t)&&B(e,e.length-g,n,f,g,t)}function Ae(e){let n=new Uint32Array(e.length),t=0;for(let r=1;r<e.length;r++){for(;t>0&&e[r]!==e[t];)t=n[t-1];e[r]===e[t]&&t++,n[r]=t}return n}function Se(e,n){let t=[[]],r=!0,s=!1,o=!1,i=0;for(let h=0;h<e.length;){let S=e.codePointAt(h);if(S!==92){if(S===42)s=!0,o||(t.push([]),o=!0);else{let k=n?S:F(S);t[t.length-1].push(k),r&&=k<=127,i++,o=!1}h+=S>65535?2:1;continue}let c=h+1;for(;e.charCodeAt(c)===92;)c++;let d=c-h,p=e.codePointAt(c),x,b=!1;p===42?(b=d%2===0,x=b?d/2:(d-1)/2):p===void 0||p===10||p===13||p===8232||p===8233?x=Math.ceil(d/2):x=Math.floor(d/2);for(let k=0;k<x;k++)t[t.length-1].push(92),i++;if(b){o=!1,h=c;continue}if(p!==void 0){let k=n?p:F(p);t[t.length-1].push(k),r&&=k<=127,i++,c+=p>65535?2:1}o=!1,h=c}let l=s&&t[0].length===0,f=s&&t[t.length-1].length===0,g=[];for(let h of t)h.length&&g.push({values:h});let m=l?0:1,M=g.length-(f?0:1);for(let h=m;h<M;h++)g[h].values.length>ke&&(g[h].failure=Ae(g[h].values));return{asciiOnly:r,endsWithWildcard:f,hasWildcard:s,minimumInputLength:i,segments:g,startsWithWildcard:l}}function z(e,n){let t=n?we:Ce,r=e.length<=xe;if(r){let o=t.get(e);if(o)return o}let s=Se(e,n);if(r){if(t.size>=me){let o=t.keys().next().value;o!==void 0&&t.delete(o)}t.set(e,s)}return s}function Z(e,n){if(n){let s=[];for(let o=0;o<e.length;){let i=e.codePointAt(o);s.push(i),o+=i>65535?2:1}return s}let t=new Uint32Array(e.length),r=0;for(let s=0;s<e.length;){let o=e.codePointAt(s);t[r]=F(o),r++,s+=o>65535?2:1}return r===t.length?t:t.subarray(0,r)}function W(e,n,t,r){for(let s=0;s<t.values.length;s++){let o=e.charCodeAt(n+s);if(!r&&o>=97&&o<=122&&(o-=32),o!==t.values[s])return!1}return!0}function Me(e,n,t,r,s){let o=r-n.values.length;if(o<t)return-1;if(!n.failure){for(let l=t;l<=o;l++)if(W(e,l,n,s))return l;return-1}let i=0;for(let l=t;l<r;l++){let f=e.charCodeAt(l);for(!s&&f>=97&&f<=122&&(f-=32);i>0&&f!==n.values[i];)i=n.failure[i-1];if(f===n.values[i]&&(i++,i===n.values.length))return l-i+1}return-1}function Y(e,n,t){if(e.length<n.minimumInputLength)return!1;if(!n.hasWildcard)return e.length===n.minimumInputLength&&W(e,0,n.segments[0],t);let r=0,s=n.segments.length,o=0,i=e.length;if(!n.startsWithWildcard){let l=n.segments[0];if(!W(e,0,l,t))return!1;o=l.values.length,r++}if(!n.endsWithWildcard){s--;let l=n.segments[s];if(i-=l.values.length,!W(e,i,l,t))return!1}for(let l=r;l<s;l++){let f=n.segments[l],g=Me(e,f,o,i,t);if(g===-1)return!1;o=g+f.values.length}return!0}function N(e,n,t){for(let r=0;r<t.values.length;r++)if(e[n+r]!==t.values[r])return!1;return!0}function Oe(e,n,t,r){let s=r-n.values.length;if(s<t)return-1;if(!n.failure){for(let i=t;i<=s;i++)if(N(e,i,n))return i;return-1}let o=0;for(let i=t;i<r;i++){for(;o>0&&e[i]!==n.values[o];)o=n.failure[o-1];if(e[i]===n.values[o]&&(o++,o===n.values.length))return i-o+1}return-1}function v(e,n){if(e.length<n.minimumInputLength)return!1;if(!n.hasWildcard)return e.length===n.minimumInputLength&&N(e,0,n.segments[0]);let t=0,r=n.segments.length,s=0,o=e.length;if(!n.startsWithWildcard){let i=n.segments[0];if(!N(e,0,i))return!1;s=i.values.length,t++}if(!n.endsWithWildcard){r--;let i=n.segments[r];if(o-=i.values.length,!N(e,o,i))return!1}for(let i=t;i<r;i++){let l=n.segments[i],f=Oe(e,l,s,o);if(f===-1)return!1;s=f+l.values.length}return!0}function Te(e,n,t){let r=q(e,n,t);if(r!==void 0)return r;let s=z(n,t);return s.asciiOnly?Y(e,s,t):v(Z(e,t),s)}function H(e,n,t,r){let s=q(e,n,t);if(s!==void 0)return s;let o=z(n,t);return o.asciiOnly?Y(e,o,t):(r.tokens??=Z(e,t),v(r.tokens,o))}function Cn(e,n,t){if(typeof n!="string"&&!n.length)return!1;let r=t===void 0?!1:t.caseSensitiveMatch===!0;if(typeof n=="string"){let l=n.charCodeAt(0)===33,f=l?n.slice(1):n,g=Te(e,f,r);return l?!g:g}let s={},o=!1,i=!1;for(let l of n){let f=l.charCodeAt(0)===33,g=f?l.slice(1):l;if(f){if(H(e,g,r,s))return!1}else o=!0,!i&&H(e,g,r,s)&&(i=!0)}return o?i:!0}export{$e as backslash,Je as backtick,kn as codsenCLI,hn as compareFn,Ge as deepClone,Qe as deepCloneWithMetadata,ue as detectEol,Ve as doublePrime,De as ellipsis,un as existy,fn as findAllIdx,U as formatDiagnosticValue,Le as hairspace,gn as hasOwnProp,mn as includes,yn as inlineTags,xn as intersection,cn as isBool,qe as isCurrencyChar,ze as isCurrencySymbol,sn as isInt,Ye as isLatinLetter,Ze as isLetter,en as isLowercaseLetter,ln as isNull,fe as isNum,Xe as isNumberChar,X as isPlainObject,ve as isQuote,ae as isRegExp,w as isStr,nn as isUppercaseLetter,tn as isWhitespaceChar,ie as leftDoubleQuote,oe as leftSingleQuote,Cn as match,Ke as multiplicationSign,wn as omit,an as pullAll,He as punctuationChars,Ee as rawMDash,Ne as rawNDash,Ue as rawNbsp,_e as rawReplacementMark,rn as removeTrailingSlash,pn as resolveEolSetting,ce as rightDoubleQuote,se as rightSingleQuote,Fe as singlePrime,on as stringSplice,Be as thinSpace,dn as uniq,We as version,bn as voidTags};
@@ -1,10 +1,10 @@
1
1
  /**
2
2
  * @name codsen-utils
3
3
  * @fileoverview Various utility functions
4
- * @version 1.7.3
4
+ * @version 1.8.0
5
5
  * @author Roy Revelt
6
6
  * @license MIT
7
7
  * {@link https://codsen.com/os/codsen-utils/}
8
8
  */
9
9
 
10
- "use strict";var codsenUtils=(()=>{var R=Object.create;var m=Object.defineProperty;var $=Object.getOwnPropertyDescriptor;var L=Object.getOwnPropertyNames;var M=Object.getPrototypeOf,V=Object.prototype.hasOwnProperty;var P=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),U=(e,t)=>{for(var n in t)m(e,n,{get:t[n],enumerable:!0})},O=(e,t,n,c)=>{if(t&&typeof t=="object"||typeof t=="function")for(let l of L(t))!V.call(e,l)&&l!==n&&m(e,l,{get:()=>t[l],enumerable:!(c=$(t,l))||c.enumerable});return e};var H=(e,t,n)=>(n=e!=null?R(M(e)):{},O(t||!e||!e.__esModule?m(n,"default",{value:e,enumerable:!0}):n,e)),F=e=>O(m({},"__esModule",{value:!0}),e);var A=P(($e,j)=>{"use strict";j.exports=Q;function g(e){return e instanceof Buffer?Buffer.from(e):new e.constructor(e.buffer.slice(),e.byteOffset,e.length)}function Q(e){if(e=e||{},e.circles)return K(e);let t=new Map;if(t.set(Date,s=>new Date(s)),t.set(Map,(s,u)=>new Map(c(Array.from(s),u))),t.set(Set,(s,u)=>new Set(c(Array.from(s),u))),e.constructorHandlers)for(let s of e.constructorHandlers)t.set(s[0],s[1]);let n=null;return e.proto?y:l;function c(s,u){let r=Object.keys(s),o=new Array(r.length);for(let f=0;f<r.length;f++){let i=r[f],p=s[i];typeof p!="object"||p===null?o[i]=p:p.constructor!==Object&&(n=t.get(p.constructor))?o[i]=n(p,u):ArrayBuffer.isView(p)?o[i]=g(p):o[i]=u(p)}return o}function l(s){if(typeof s!="object"||s===null)return s;if(Array.isArray(s))return c(s,l);if(s.constructor!==Object&&(n=t.get(s.constructor)))return n(s,l);let u={};for(let r in s){if(Object.hasOwnProperty.call(s,r)===!1)continue;let o=s[r];typeof o!="object"||o===null?u[r]=o:o.constructor!==Object&&(n=t.get(o.constructor))?u[r]=n(o,l):ArrayBuffer.isView(o)?u[r]=g(o):u[r]=l(o)}return u}function y(s){if(typeof s!="object"||s===null)return s;if(Array.isArray(s))return c(s,y);if(s.constructor!==Object&&(n=t.get(s.constructor)))return n(s,y);let u={};for(let r in s){let o=s[r];typeof o!="object"||o===null?u[r]=o:o.constructor!==Object&&(n=t.get(o.constructor))?u[r]=n(o,y):ArrayBuffer.isView(o)?u[r]=g(o):u[r]=y(o)}return u}}function K(e){let t=[],n=[],c=new Map;if(c.set(Date,r=>new Date(r)),c.set(Map,(r,o)=>new Map(y(Array.from(r),o))),c.set(Set,(r,o)=>new Set(y(Array.from(r),o))),e.constructorHandlers)for(let r of e.constructorHandlers)c.set(r[0],r[1]);let l=null;return e.proto?u:s;function y(r,o){let f=Object.keys(r),i=new Array(f.length);for(let p=0;p<f.length;p++){let b=f[p],d=r[b];if(typeof d!="object"||d===null)i[b]=d;else if(d.constructor!==Object&&(l=c.get(d.constructor)))i[b]=l(d,o);else if(ArrayBuffer.isView(d))i[b]=g(d);else{let w=t.indexOf(d);w!==-1?i[b]=n[w]:i[b]=o(d)}}return i}function s(r){if(typeof r!="object"||r===null)return r;if(Array.isArray(r))return y(r,s);if(r.constructor!==Object&&(l=c.get(r.constructor)))return l(r,s);let o={};t.push(r),n.push(o);for(let f in r){if(Object.hasOwnProperty.call(r,f)===!1)continue;let i=r[f];if(typeof i!="object"||i===null)o[f]=i;else if(i.constructor!==Object&&(l=c.get(i.constructor)))o[f]=l(i,s);else if(ArrayBuffer.isView(i))o[f]=g(i);else{let p=t.indexOf(i);p!==-1?o[f]=n[p]:o[f]=s(i)}}return t.pop(),n.pop(),o}function u(r){if(typeof r!="object"||r===null)return r;if(Array.isArray(r))return y(r,u);if(r.constructor!==Object&&(l=c.get(r.constructor)))return l(r,u);let o={};t.push(r),n.push(o);for(let f in r){let i=r[f];if(typeof i!="object"||i===null)o[f]=i;else if(i.constructor!==Object&&(l=c.get(i.constructor)))o[f]=l(i,u);else if(ArrayBuffer.isView(i))o[f]=g(i);else{let p=t.indexOf(i);p!==-1?o[f]=n[p]:o[f]=u(i)}}return t.pop(),n.pop(),o}}});var De={};U(De,{backslash:()=>te,backtick:()=>ne,compareFn:()=>Se,detectEol:()=>B,doublePrime:()=>ee,ellipsis:()=>G,existy:()=>Oe,findAllIdx:()=>he,hairspace:()=>X,hasOwnProp:()=>Ae,includes:()=>Ee,inlineTags:()=>Ne,intersection:()=>Te,isBool:()=>me,isCurrencyChar:()=>J,isCurrencySymbol:()=>ce,isInt:()=>ge,isLatinLetter:()=>ue,isLetter:()=>x,isLowercaseLetter:()=>fe,isNull:()=>xe,isNum:()=>be,isNumberChar:()=>ie,isPlainObject:()=>h,isQuote:()=>le,isRegExp:()=>D,isStr:()=>a,isUppercaseLetter:()=>pe,isWhitespaceChar:()=>ae,leftDoubleQuote:()=>E,leftSingleQuote:()=>C,multiplicationSign:()=>oe,omit:()=>Je,pullAll:()=>we,punctuationChars:()=>se,rawMDash:()=>_,rawNDash:()=>Z,rawNbsp:()=>z,rawReplacementMark:()=>re,removeTrailingSlash:()=>ye,resolveEolSetting:()=>je,rightDoubleQuote:()=>T,rightSingleQuote:()=>N,singlePrime:()=>v,stringSplice:()=>de,thinSpace:()=>Y,uniq:()=>ke,version:()=>q,voidTags:()=>Ce});var k="1.7.3";var S=H(A(),1),W=(0,S.default)(),q=k,C="\u2018",N="\u2019",E="\u201C",T="\u201D",Z="\u2013",_="\u2014",z="\xA0",G="\u2026",X="\u200A",Y="\u2009",v="\u2032",ee="\u2033",te="\\",re="\uFFFD",ne="`",oe="\xD7",se=[".",",",";","!","?"];function ie(e){return a(e)&&e.charCodeAt(0)>=48&&e.charCodeAt(0)<=57}function J(e){return a(e)&&"\u060B$\u20BC\u17DB\xA5\u20A1\u20B1\xA3\u20AC\xA2\u20B9\uFDFC\u20AA\u20A9\u20AD\u20A8\u20AE\u20A6\u20BD\u20AB\u0E3F\u20A9\u20BA\u20B4".includes(e)}function ce(e){let t=new Set(["$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"]);return a(e)&&!!e.trim()&&(J(e)||t.has(e))}function x(e){return a(e)&&e.length===1&&e.toUpperCase()!==e.toLowerCase()}function ue(e){return!!(e&&a(e)&&(e.charCodeAt(0)>64&&e.charCodeAt(0)<91||e.charCodeAt(0)>96&&e.charCodeAt(0)<123))}function le(e){return a(e)&&(e==='"'||e==="'"||e===C||e===N||e===E||e===T)}function fe(e){return!a(e)||!x(e)?!1:e===e.toLowerCase()&&e!==e.toUpperCase()}function pe(e){return!a(e)||!x(e)?!1:e===e.toUpperCase()&&e!==e.toLowerCase()}function ae(e){return!a(e)||!e?!1:!e[0].trim()}var ye=e=>a(e)&&e.length&&e.endsWith("/")?e.slice(0,-1).trim():e;function h(e){if(e==null||typeof e!="object")return!1;let t=Object.getPrototypeOf(e);return t!==null&&t!==Object.prototype&&Object.getPrototypeOf(t)!==null?!1:!(Symbol.iterator in e)&&!(Symbol.toStringTag in e)}function de(e="",t=0,n=0,c=""){return t<0&&(t+=e.length,t<0&&(t=0)),e.slice(0,t)+(c||"")+e.slice(t+n)}function a(e){return typeof e=="string"}function be(e){return Number.isFinite(e)}function ge(e){return Number.isSafeInteger(e)&&e>=0}function me(e){return typeof e=="boolean"}function xe(e){return e===null}function D(e){return e instanceof RegExp}function he(e,t){if(!a(e)||!a(t))return[];let n=[],c=-1;for(;(c=e.indexOf(t,c+1))>=0;)n.push(c);return n}function we(e=[],t=[]){return!e||!Array.isArray(e)||!e.length?[]:!t||!Array.isArray(t)||!t.length?e:e.filter(n=>!t.includes(n))}function Oe(e){return e!=null}function ke(e){return[...new Set(e)]}function B(e){if(!(typeof e!="string"||!e)){if(e.includes("\r\n"))return"\r\n";if(e.includes("\n"))return"\n";if(e.includes("\r"))return"\r"}}function je(e,t,n="\n"){if(!["\r\n","\r","\n"].includes(n))throw new Error('codsen-utils/resolveEolSetting(): the input argument defaultEolChar should be one of EOL values: "\\n", "\\r", or "\\r\\n", but it was given as '.concat(JSON.stringify(n,null,0)));return t==="crlf"?"\r\n":t==="cr"?"\r":t==="lf"?"\n":B(e)||n}function Ae(e,t){return h(e)&&a(t)&&t in e}function Se(e,t){return e.localeCompare(t)}var Ce=["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"],Ne=new Set(["a","abbr","acronym","audio","b","bdi","bdo","big","br","button","canvas","cite","code","data","datalist","del","dfn","em","embed","i","iframe","img","input","ins","kbd","label","map","mark","meter","noscript","object","output","picture","progress","q","ruby","s","samp","script","select","slot","small","span","strong","sub","sup","svg","template","textarea","time","u","tt","var","video","wbr"]);function Ee(e,t){return!Array.isArray(e)||!e.length?!1:e.some(n=>D(n)&&t.match(n)||typeof n=="string"&&t===n)}function Te(e=[],t=[]){return!e||!t?[]:Array.from(new Set(Array.from(e).filter(n=>new Set(t).has(n))))}function Je(e,t=[]){if(!e)return e;if(!h(e))throw new Error("codsen-utils/omit(): [THROW_ID_01] Input must be a plain object! It was given as ".concat(JSON.stringify(e,null,4),' (typeof is "').concat(typeof e,'")'));let n=W(e);return t.forEach(c=>{delete n[c]}),n}return F(De);})();
10
+ "use strict";var codsenUtils=(()=>{var W=Object.defineProperty;var xe=Object.getOwnPropertyDescriptor;var ke=Object.getOwnPropertyNames;var we=Object.prototype.hasOwnProperty;var Ce=(e,n,t)=>n in e?W(e,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[n]=t;var Ae=(e,n)=>{for(var t in n)W(e,t,{get:n[t],enumerable:!0})},Me=(e,n,t,r)=>{if(n&&typeof n=="object"||typeof n=="function")for(let s of ke(n))!we.call(e,s)&&s!==t&&W(e,s,{get:()=>n[s],enumerable:!(r=xe(n,s))||r.enumerable});return e};var Se=e=>Me(W({},"__esModule",{value:!0}),e);var I=(e,n,t)=>Ce(e,typeof n!="symbol"?n+"":n,t);var Bn={};Ae(Bn,{backslash:()=>Fe,backtick:()=>$e,codsenCLI:()=>Sn,compareFn:()=>gn,deepClone:()=>He,deepCloneWithMetadata:()=>Ge,detectEol:()=>pe,doublePrime:()=>Be,ellipsis:()=>Ee,existy:()=>an,findAllIdx:()=>cn,formatDiagnosticValue:()=>E,hairspace:()=>Ue,hasOwnProp:()=>pn,includes:()=>yn,inlineTags:()=>bn,intersection:()=>mn,isBool:()=>sn,isCurrencyChar:()=>Xe,isCurrencySymbol:()=>qe,isInt:()=>on,isLatinLetter:()=>Ze,isLetter:()=>ze,isLowercaseLetter:()=>ve,isNull:()=>ln,isNum:()=>ue,isNumberChar:()=>Qe,isPlainObject:()=>J,isQuote:()=>Ye,isRegExp:()=>de,isStr:()=>w,isUppercaseLetter:()=>en,isWhitespaceChar:()=>nn,leftDoubleQuote:()=>le,leftSingleQuote:()=>se,match:()=>Ln,multiplicationSign:()=>_e,omit:()=>On,pullAll:()=>fn,punctuationChars:()=>Je,rawMDash:()=>We,rawNDash:()=>je,rawNbsp:()=>Ne,rawReplacementMark:()=>Ve,removeTrailingSlash:()=>tn,resolveEolSetting:()=>dn,rightDoubleQuote:()=>ce,rightSingleQuote:()=>ie,singlePrime:()=>Le,stringSplice:()=>rn,thinSpace:()=>De,uniq:()=>un,version:()=>Ie,voidTags:()=>hn});var ee="1.8.0";function Te(){let e=[],n=0,t=!1;return{append(r){return t?!1:n+r.length>1999?(e.push("\u2026"),n+=1,t=!0,!1):(e.push(r),n+=r.length,!0)},result(){return e.join("")},stopped(){return t}}}function Re(e){return"\\u".concat(e.toString(16).padStart(4,"0"))}function N(e,n){if(e.append('"')){for(let t=0;t<n.length&&!e.stopped();t+=1){let r=n.charCodeAt(t);r===34?e.append('\\"'):r===92?e.append("\\\\"):r===8?e.append("\\b"):r===9?e.append("\\t"):r===10?e.append("\\n"):r===12?e.append("\\f"):r===13?e.append("\\r"):r<32||r===8232||r===8233||r>=55296&&r<=57343?e.append(Re(r)):e.append(n[t])}e.append('"')}}function Pe(e){return e.get&&e.set?"[Getter/Setter]":e.get?"[Getter]":e.set?"[Setter]":"[Accessor]"}function te(e,n){e.append("Symbol(");let t=String(n);t.length>8&&N(e,t.slice(7,-1)),e.append(")")}function ne(e,n){typeof n=="symbol"?te(e,n):N(e,String(n))}function E(e,n=0){let t=Te(),r=n===4?4:0,s=new WeakSet,o=0;function i(l){r&&t.append(" ".repeat(l*r))}function c(l,p){l&&t.append(","),r&&(t.append("\n"),i(p+1))}function a(l,p,d){r&&p&&(t.append("\n"),i(d)),t.append(l)}function g(l,p){Object.prototype.hasOwnProperty.call(l,"value")?M(l.value,p):t.append(Pe(l))}function x(l,p){let d;try{d=Reflect.getOwnPropertyDescriptor(l,"length")}catch(y){t.append("[Uninspectable]");return}let k=d==null?void 0:d.value;if(!Number.isSafeInteger(k)||k<0){t.append("[Uninspectable]");return}t.append("[");let b=!1;for(let y=0;y<k&&!t.stopped();y+=1){if(c(b,p),b=!0,o>=50){t.append("[MaxEntries]");break}o+=1;let T;try{T=Reflect.getOwnPropertyDescriptor(l,String(y))}catch(B){t.append("[Uninspectable]");continue}T!=null&&T.enumerable?g(T,p+1):t.append("[Empty]")}a("]",b,p)}function S(l,p){let d;try{d=Reflect.ownKeys(l)}catch(b){t.append("[Uninspectable]");return}t.append("{");let k=!1;for(let b of d){if(t.stopped())break;if(o>=50){c(k,p),k=!0,N(t,"\u2026"),t.append(r?": ":":"),t.append("[MaxEntries]");break}o+=1;let y;try{y=Reflect.getOwnPropertyDescriptor(l,b)}catch(T){c(k,p),k=!0,ne(t,b),t.append(r?": ":":"),t.append("[Uninspectable]");continue}y!=null&&y.enumerable&&(c(k,p),k=!0,ne(t,b),t.append(r?": ":":"),g(y,p+1))}a("}",k,p)}function m(l,p){if(s.has(l)){t.append("[Circular]");return}if(p>=5){t.append("[MaxDepth]");return}let d;try{d=Array.isArray(l)}catch(k){t.append("[Uninspectable]");return}s.add(l);try{d?x(l,p):S(l,p)}finally{s.delete(l)}}function M(l,p){l===null?t.append("null"):typeof l=="string"?N(t,l):typeof l=="number"?t.append(Object.is(l,-0)?"-0":String(l)):typeof l=="boolean"?t.append(l?"true":"false"):typeof l>"u"?t.append("undefined"):typeof l=="bigint"?t.append("".concat(l,"n")):typeof l=="symbol"?te(t,l):typeof l=="function"?t.append("[Function]"):m(l,p)}try{return M(e,0),t.result()}catch(l){return"[Uninspectable]"}}var Ie=ee,se="\u2018",ie="\u2019",le="\u201C",ce="\u201D",je="\u2013",We="\u2014",Ne="\xA0",Ee="\u2026",Ue="\u200A",De="\u2009",Le="\u2032",Be="\u2033",Fe="\\",Ve="\uFFFD",$e="`",_e="\xD7",Je=[".",",",";","!","?"],fe=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"]),U=Object.prototype.hasOwnProperty,j=class{constructor(){I(this,"hasRepeatedReferences",!1);I(this,"clones",[]);I(this,"index");I(this,"sources",[])}get(n){if(this.index){let r=this.index.get(n);return r!==void 0&&(this.hasRepeatedReferences=!0),r}let t=this.sources.indexOf(n);if(t!==-1)return this.hasRepeatedReferences=!0,this.clones[t]}set(n,t){if(this.index){this.index.set(n,t);return}if(this.sources.push(n),this.clones.push(t),this.sources.length===32){this.index=new WeakMap;for(let r=0;r<this.sources.length;r++)this.index.set(this.sources[r],this.clones[r]);this.sources=[],this.clones=[]}}};function ae(e,n){let t=n.get(e);if(t!==void 0)return t;let r=e.slice(0);return n.set(e,r),r}function Ke(e,n){if(typeof Buffer<"u"&&Buffer.isBuffer(e)){let o=Buffer.from(e);return n.set(e,o),o}let t=ae(e.buffer,n);if(e instanceof DataView){let o=new DataView(t,e.byteOffset,e.byteLength);return n.set(e,o),o}let r=e.constructor,s=new r(t,e.byteOffset,e.length);return n.set(e,s),s}function F(e,n,t,r){for(let s of t){let o=n[s];e[s]=typeof o!="object"||o===null?o:R(o,r)}}function R(e,n){if(typeof e!="object"||e===null)return e;let t=n.get(e);if(t!==void 0)return t;if(Array.isArray(e)){let o=e.length,i=new Array(o);n.set(e,i);let c=e,a=Object.keys(e);if(a.length===o&&(o===0||a[o-1]==="".concat(o-1)))for(let g=0;g<o;g++){let x=c[g];i[g]=typeof x!="object"||x===null?x:R(x,n)}else F(i,c,a,n);return i}let r=Object.getPrototypeOf(e);if(r===Object.prototype||r===null){let o={};return n.set(e,o),F(o,e,Object.keys(e),n),o}if(e instanceof Date){let o=new Date(e.getTime());return n.set(e,o),o}if(ArrayBuffer.isView(e))return Ke(e,n);if(e instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&e instanceof SharedArrayBuffer)return ae(e,n);if(e instanceof Map){let o=new Map;n.set(e,o);for(let[i,c]of e)o.set(R(i,n),R(c,n));return o}if(e instanceof Set){let o=new Set;n.set(e,o);for(let i of e)o.add(R(i,n));return o}let s={};return n.set(e,s),F(s,e,Object.keys(e),n),s}function He(e){return R(e,new j)}function Ge(e){let n=new j,t=R(e,n);return{hasRepeatedReferences:n.hasRepeatedReferences,value:t}}function Qe(e){if(!w(e))return!1;let n=e.charCodeAt(0);return n>=48&&n<=57}function Xe(e){return w(e)&&e.length===1&&fe.has(e)}function qe(e){return w(e)&&fe.has(e)}function ze(e){if(!w(e)||e.length!==1)return!1;let n=e.charCodeAt(0);return n<128?n>64&&n<91||n>96&&n<123:e.toUpperCase()!==e.toLowerCase()}function Ze(e){if(!e||!w(e))return!1;let n=e.charCodeAt(0);return n>64&&n<91||n>96&&n<123}function Ye(e){return w(e)&&(e==='"'||e==="'"||e===se||e===ie||e===le||e===ce)}function ve(e){if(!w(e)||e.length!==1)return!1;let n=e.charCodeAt(0);return n<128?n>96&&n<123:e===e.toLowerCase()&&e!==e.toUpperCase()}function en(e){if(!w(e)||e.length!==1)return!1;let n=e.charCodeAt(0);return n<128?n>64&&n<91:e===e.toUpperCase()&&e!==e.toLowerCase()}function nn(e){if(!w(e)||!e)return!1;let n=e.charCodeAt(0);return n<128?n===32||n>8&&n<14:!e[0].trim()}var tn=e=>w(e)&&e.length&&e.endsWith("/")?e.slice(0,-1).trim():e;function J(e){if(e==null||typeof e!="object")return!1;let n=Object.getPrototypeOf(e);return n!==null&&n!==Object.prototype&&Object.getPrototypeOf(n)!==null?!1:!(Symbol.iterator in e)&&!(Symbol.toStringTag in e)}function rn(e="",n=0,t=0,r=""){return n<0&&(n+=e.length,n<0&&(n=0)),e.slice(0,n)+(r||"")+e.slice(n+t)}function w(e){return typeof e=="string"}function ue(e){return Number.isFinite(e)}function on(e){return Number.isSafeInteger(e)&&e>=0}function sn(e){return typeof e=="boolean"}function ln(e){return e===null}function de(e){return e instanceof RegExp}function cn(e,n){if(!w(e)||!w(n)||n.length===0)return[];let t=[],r=e.indexOf(n);for(;r!==-1;)t.push(r),r=e.indexOf(n,r+1);return t}function fn(e=[],n=[]){if(!e||!Array.isArray(e)||!e.length)return[];if(!n||!Array.isArray(n)||!n.length)return e;if(e.length<128||n.length<5)return e.filter(r=>!n.includes(r));let t=new Set(n);return e.filter(r=>!t.has(r))}function an(e){return e!=null}function un(e){return[...new Set(e)]}function pe(e){if(!(typeof e!="string"||!e)){if(e.includes("\r\n"))return"\r\n";if(e.includes("\n"))return"\n";if(e.includes("\r"))return"\r"}}function dn(e,n,t="\n"){if(t!=="\n"&&t!=="\r\n"&&t!=="\r")throw new Error('codsen-utils/resolveEolSetting(): [THROW_ID_01] the input argument defaultEolChar should be one of EOL values: "\\n", "\\r", or "\\r\\n", but it was given as '.concat(E(t)));return n==="crlf"?"\r\n":n==="cr"?"\r":n==="lf"?"\n":pe(e)||t}function pn(e,n){return J(e)&&w(n)&&U.call(e,n)}function gn(e,n){return e.localeCompare(n)}var hn=["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"],bn=new Set(["a","abbr","acronym","audio","b","bdi","bdo","big","br","button","canvas","cite","code","data","datalist","del","dfn","em","embed","i","iframe","img","input","ins","kbd","label","map","mark","meter","noscript","object","output","picture","progress","q","ruby","s","samp","script","select","slot","small","span","strong","sub","sup","svg","template","textarea","time","u","tt","var","video","wbr"]);function yn(e,n){if(!Array.isArray(e)||!e.length||!w(n))return!1;for(let t of e){if(typeof t=="string"){if(n===t)return!0;continue}if(de(t)){t.global&&(t.lastIndex=0);let r=t.test(n);if(t.global&&(t.lastIndex=0),r)return!0}}return!1}function mn(e=[],n=[]){if(!Array.isArray(e)||!Array.isArray(n)||!e.length||!n.length)return[];let t=[];if(e.length*n.length<64){for(let o of e)n.includes(o)&&!t.includes(o)&&t.push(o);return t}let r=new Set(n),s=new Set;for(let o of e)r.has(o)&&!s.has(o)&&(s.add(o),t.push(o));return t}var V=/^-?\d+(?:\.\d*)?(?:e[+-]?\d+)?$/i;function xn(e){return e.replace(/-+([^-])/g,(n,t)=>t.toUpperCase())}function kn(e){return e.replace(/([\da-z])([A-Z])/g,"$1-$2").toLowerCase()}function wn(e){return e.replace(/^[\r\n]+/,"").replace(/[\r\n]+$/,"")}function re(e,n){let t=Number.POSITIVE_INFINITY,r=e.split("\n");for(let o of r){let i=/^[ \t]*(?=\S)/.exec(o);i&&(t=Math.min(t,i[0].length))}let s=" ".repeat(n);return r.map(o=>o.trim()?s+o.slice(t):o).join("\n")}function Cn(e,n,t){let r="";return e&&(r=wn(e.replace(/\t+\n*$/,"")),r.includes("\n")&&(r=re(r,t)),r="\n".concat(r)),n&&(r=r?"".concat(re("\n".concat(n,"\n"),t)).concat(r):"\n".concat(n)),"".concat(r,"\n")}function An(e){var r;let n=w(e.name)?e.name:"",{bin:t}=e;return w(t)?n.slice(n.startsWith("@")?n.indexOf("/")+1:0):t&&typeof t=="object"&&(r=Object.keys(t)[0])!=null?r:n}function Mn(e,n){let t=e?e.type:void 0;return n===void 0?t==="string"?"":t==="number"?void 0:!0:t==="boolean"?n==="true":t==="number"?Number(n):n}function Sn(e="",n={}){var K,H,G,Q,X,q,z,Z,Y,v;let t=typeof process>"u"?void 0:process,r=(K=n.pkg)!=null?K:{},s=(G=(H=n.argv)!=null?H:t==null?void 0:t.argv.slice(2))!=null?G:[],o=(Q=n.helpIndent)!=null?Q:2,i=(X=n.autoHelp)!=null?X:!0,c=(q=n.autoVersion)!=null?q:!0,a=(Z=(z=n.version)!=null?z:r.version)!=null?Z:"No version found",g=U.call(n,"booleanDefault")?n.booleanDefault:!1,x=Cn(e,(Y=n.description)!=null?Y:r.description,o);function S(f){console.log(x),t==null||t.exit(ue(f)?f:2)}function m(){console.log(a),t==null||t.exit(0)}let M=[],l=new Map;for(let[f,u]of Object.entries((v=n.flags)!=null?v:{})){let h={key:f,type:u.type,isMultiple:!!u.isMultiple,source:u};M.push(h),l.set(f,h),l.set(kn(f),h),u.shortFlag&&l.set(u.shortFlag,h)}let p=[],d={};function k(f,u){let h=l.get(f),C=h?h.key:xn(f);if(h!=null&&h.isMultiple){let A=d[C];Array.isArray(A)?A.push(u):d[C]=[u];return}d[C]=u}function b(f,u){k(f,Mn(l.get(f),u))}function y(f,u){return u===void 0?!1:(f==null?void 0:f.type)==="boolean"?u==="true"||u==="false":!(u.startsWith("-")&&u.length>1&&!V.test(u))}function T(f,u){let h=f.slice(1);for(let C=0;C<h.length;C++){let A=h[C],O=h.slice(C+1);if(O.startsWith("="))return b(A,O.slice(1)),u;if(V.test(O)||O&&/\W/.test(O[0]))return b(A,O),u;let P=l.get(A);if(O&&(P!=null&&P.type)&&P.type!=="boolean")return b(A,O),u;if(O){b(A,void 0);continue}if(y(P,s[u+1]))return b(A,s[u+1]),u+1;b(A,void 0)}return u}for(let f=0;f<s.length;f++){let u=s[f];if(u==="--"){p.push(...s.slice(f+1));break}if(u.startsWith("--")){let h=u.slice(2),C=h.indexOf("=");if(C!==-1){b(h.slice(0,C),h.slice(C+1));continue}if(h.startsWith("no-")){k(h.slice(3),!1);continue}let A=l.get(h);if(y(A,s[f+1])){b(h,s[f+1]),f++;continue}b(h,void 0);continue}if(u.startsWith("-")&&u.length>1&&!V.test(u)){f=T(u,f);continue}p.push(u)}for(let f of M)U.call(d,f.key)||(U.call(f.source,"default")?d[f.key]=f.source.default:f.isMultiple?d[f.key]=[]:f.type==="boolean"&&g!==void 0&&(d[f.key]=g));!p.length&&s.length===1&&(c&&d.version===!0?m():i&&d.help===!0&&S(0));let B=An(r);return B&&t&&(t.title=B),{input:p,flags:d,pkg:r,help:x,showHelp:S,showVersion:m}}function On(e,n=[]){if(!e)return e;if(!J(e))throw new Error("codsen-utils/omit(): [THROW_ID_02] Input must be a plain object! It was given as ".concat(E(e,4),' (typeof is "').concat(typeof e,'")'));let t={},r=new j;r.set(e,t);let s=Object.keys(e),o=s.length<128||n.length<5?void 0:new Set(n);for(let i of s)(o?o.has(i):n.includes(i))||(t[i]=R(e[i],r));return t}var Tn=256,Rn=1024,Pn=1,In=new Map,jn=new Map;function _(e){if(e>=97&&e<=122)return e-32;if(e>65535)return e;let n=String.fromCharCode(e).toUpperCase();if(n.length!==1)return e;let t=n.charCodeAt(0);return e>127&&t<128?e:t}function $(e,n,t,r,s,o){for(let i=0;i<s;i++){let c=e.charCodeAt(n+i),a=t.charCodeAt(r+i);if(o||(c>=97&&c<=122&&(c-=32),a>=97&&a<=122&&(a-=32)),c!==a)return!1}return!0}function ge(e,n,t){let r=n.indexOf("\\");if(r===-1&&e===n)return!0;let s=n.indexOf("*");if(r===-1&&s===-1){if(t)return!1;for(let x=0;x<n.length;x++)if(n.charCodeAt(x)>127)return;return e.length===n.length&&$(e,0,n,0,n.length,!1)}if(r!==-1)return;let o=0,i=!1,c=-1;for(let x=0;x<n.length;x++){let S=n.charCodeAt(x);if(S>127)return;if(S===42){if(c=x,!i){if(o++,o>1)return;i=!0}}else i=!1}let a=c+1,g=n.length-a;return e.length<s+g?!1:$(e,0,n,0,s,t)&&$(e,e.length-g,n,a,g,t)}function Wn(e){let n=new Uint32Array(e.length),t=0;for(let r=1;r<e.length;r++){for(;t>0&&e[r]!==e[t];)t=n[t-1];e[r]===e[t]&&t++,n[r]=t}return n}function Nn(e,n){let t=[[]],r=!0,s=!1,o=!1,i=0;for(let m=0;m<e.length;){let M=e.codePointAt(m);if(M!==92){if(M===42)s=!0,o||(t.push([]),o=!0);else{let y=n?M:_(M);t[t.length-1].push(y),r&&(r=y<=127),i++,o=!1}m+=M>65535?2:1;continue}let l=m+1;for(;e.charCodeAt(l)===92;)l++;let p=l-m,d=e.codePointAt(l),k,b=!1;d===42?(b=p%2===0,k=b?p/2:(p-1)/2):d===void 0||d===10||d===13||d===8232||d===8233?k=Math.ceil(p/2):k=Math.floor(p/2);for(let y=0;y<k;y++)t[t.length-1].push(92),i++;if(b){o=!1,m=l;continue}if(d!==void 0){let y=n?d:_(d);t[t.length-1].push(y),r&&(r=y<=127),i++,l+=d>65535?2:1}o=!1,m=l}let c=s&&t[0].length===0,a=s&&t[t.length-1].length===0,g=[];for(let m of t)m.length&&g.push({values:m});let x=c?0:1,S=g.length-(a?0:1);for(let m=x;m<S;m++)g[m].values.length>Pn&&(g[m].failure=Wn(g[m].values));return{asciiOnly:r,endsWithWildcard:a,hasWildcard:s,minimumInputLength:i,segments:g,startsWithWildcard:c}}function he(e,n){let t=n?In:jn,r=e.length<=Rn;if(r){let o=t.get(e);if(o)return o}let s=Nn(e,n);if(r){if(t.size>=Tn){let o=t.keys().next().value;o!==void 0&&t.delete(o)}t.set(e,s)}return s}function be(e,n){if(n){let s=[];for(let o=0;o<e.length;){let i=e.codePointAt(o);s.push(i),o+=i>65535?2:1}return s}let t=new Uint32Array(e.length),r=0;for(let s=0;s<e.length;){let o=e.codePointAt(s);t[r]=_(o),r++,s+=o>65535?2:1}return r===t.length?t:t.subarray(0,r)}function D(e,n,t,r){for(let s=0;s<t.values.length;s++){let o=e.charCodeAt(n+s);if(!r&&o>=97&&o<=122&&(o-=32),o!==t.values[s])return!1}return!0}function En(e,n,t,r,s){let o=r-n.values.length;if(o<t)return-1;if(!n.failure){for(let c=t;c<=o;c++)if(D(e,c,n,s))return c;return-1}let i=0;for(let c=t;c<r;c++){let a=e.charCodeAt(c);for(!s&&a>=97&&a<=122&&(a-=32);i>0&&a!==n.values[i];)i=n.failure[i-1];if(a===n.values[i]&&(i++,i===n.values.length))return c-i+1}return-1}function ye(e,n,t){if(e.length<n.minimumInputLength)return!1;if(!n.hasWildcard)return e.length===n.minimumInputLength&&D(e,0,n.segments[0],t);let r=0,s=n.segments.length,o=0,i=e.length;if(!n.startsWithWildcard){let c=n.segments[0];if(!D(e,0,c,t))return!1;o=c.values.length,r++}if(!n.endsWithWildcard){s--;let c=n.segments[s];if(i-=c.values.length,!D(e,i,c,t))return!1}for(let c=r;c<s;c++){let a=n.segments[c],g=En(e,a,o,i,t);if(g===-1)return!1;o=g+a.values.length}return!0}function L(e,n,t){for(let r=0;r<t.values.length;r++)if(e[n+r]!==t.values[r])return!1;return!0}function Un(e,n,t,r){let s=r-n.values.length;if(s<t)return-1;if(!n.failure){for(let i=t;i<=s;i++)if(L(e,i,n))return i;return-1}let o=0;for(let i=t;i<r;i++){for(;o>0&&e[i]!==n.values[o];)o=n.failure[o-1];if(e[i]===n.values[o]&&(o++,o===n.values.length))return i-o+1}return-1}function me(e,n){if(e.length<n.minimumInputLength)return!1;if(!n.hasWildcard)return e.length===n.minimumInputLength&&L(e,0,n.segments[0]);let t=0,r=n.segments.length,s=0,o=e.length;if(!n.startsWithWildcard){let i=n.segments[0];if(!L(e,0,i))return!1;s=i.values.length,t++}if(!n.endsWithWildcard){r--;let i=n.segments[r];if(o-=i.values.length,!L(e,o,i))return!1}for(let i=t;i<r;i++){let c=n.segments[i],a=Un(e,c,s,o);if(a===-1)return!1;s=a+c.values.length}return!0}function Dn(e,n,t){let r=ge(e,n,t);if(r!==void 0)return r;let s=he(n,t);return s.asciiOnly?ye(e,s,t):me(be(e,t),s)}function oe(e,n,t,r){var i;let s=ge(e,n,t);if(s!==void 0)return s;let o=he(n,t);return o.asciiOnly?ye(e,o,t):((i=r.tokens)!=null||(r.tokens=be(e,t)),me(r.tokens,o))}function Ln(e,n,t){if(typeof n!="string"&&!n.length)return!1;let r=t===void 0?!1:t.caseSensitiveMatch===!0;if(typeof n=="string"){let c=n.charCodeAt(0)===33,a=c?n.slice(1):n,g=Dn(e,a,r);return c?!g:g}let s={},o=!1,i=!1;for(let c of n){let a=c.charCodeAt(0)===33,g=a?c.slice(1):c;if(a){if(oe(e,g,r,s))return!1}else o=!0,!i&&oe(e,g,r,s)&&(i=!0)}return o?i:!0}return Se(Bn);})();
package/package.json CHANGED
@@ -1,12 +1,8 @@
1
1
  {
2
2
  "name": "codsen-utils",
3
- "version": "1.7.3",
3
+ "version": "1.8.0",
4
4
  "description": "Various utility functions",
5
- "keywords": [
6
- "codsen",
7
- "utility",
8
- "helpers"
9
- ],
5
+ "keywords": ["codsen", "utility", "helpers"],
10
6
  "homepage": "https://codsen.com/os/codsen-utils",
11
7
  "repository": {
12
8
  "type": "git",
@@ -27,45 +23,42 @@
27
23
  },
28
24
  "types": "types/index.d.ts",
29
25
  "scripts": {
30
- "build": "node '../../ops/scripts/esbuild.js' && npm run dts",
31
- "cjs-off": "exit 0",
32
- "cjs-on": "exit 0",
33
- "dev": "DEV=true node '../../ops/scripts/esbuild.js' && npm run dts",
26
+ "build": "node ../../ops/scripts/esbuild.js && npm run dts",
27
+ "coverage": "c8 uvu test",
28
+ "dev": "node ../../ops/scripts/esbuild.js --dev && npm run dts",
34
29
  "devtest": "c8 npm run unit && npm run examples && npm run lint",
35
- "dts": "rollup -c && npm run prettier -- 'types/index.d.ts' --write --log-level 'silent'",
30
+ "dts": "rollup -c && biome format --write --config-path=../../biome.json --vcs-enabled=false --use-editorconfig=false types/index.d.ts",
36
31
  "examples": "node '../../ops/scripts/run-examples.js'",
37
- "lect": "node '../../ops/lect/lect.js' && npm run prettier -- 'README.md' '.all-contributorsrc' 'rollup.config.js' --write",
38
- "letspublish": "npm publish --provenance || :",
39
- "lint": "eslint . --fix --concurrency=auto --cache",
32
+ "lect": "node '../../ops/lect/lect.js'",
33
+ "lect:check": "node '../../ops/lect/lect.js' --check",
34
+ "lint": "biome lint --error-on-warnings . && npm run typecheck",
35
+ "lint:fix": "biome lint --write --error-on-warnings . && npm run typecheck",
40
36
  "perf": "node perf/check.js",
41
37
  "prep": "echo 'ready'",
42
- "prettier": "prettier",
43
- "prettier:format": "npm run prettier -- --write '**/*.{ts,tsx,md}' --no-error-on-unmatched-pattern --log-level 'silent'",
44
- "pretest": "npm run lect && npm run build",
38
+ "prettier": "biome format",
39
+ "prettier:format": "biome format --write .",
40
+ "pretest": "npm run lect:check && npm run build",
45
41
  "test": "npm run devtest",
42
+ "typecheck": "tsc --noEmit --pretty false --project tsconfig.json",
46
43
  "unit": "uvu test"
47
44
  },
48
- "engines": {
49
- "node": ">=14.18.0"
50
- },
51
45
  "c8": {
46
+ "all": true,
52
47
  "branches": 100,
53
48
  "check-coverage": true,
54
- "exclude": [
55
- "**/test/**/*.*"
56
- ],
49
+ "exclude": ["**/test/**/*.*"],
57
50
  "functions": 100,
58
- "lines": 100
51
+ "include": ["dist/*.esm.js"],
52
+ "lines": 100,
53
+ "statements": 100
59
54
  },
60
55
  "lect": {
61
56
  "licence": {
62
- "extras": [
63
- ""
64
- ]
57
+ "extras": [""]
65
58
  }
66
59
  },
67
- "dependencies": {
68
- "rfdc": "^1.4.1"
60
+ "engines": {
61
+ "node": ">=18.20.8"
69
62
  },
70
63
  "publishConfig": {
71
64
  "registry": "https://registry.npmjs.org/"
package/types/index.d.ts CHANGED
@@ -1,3 +1,17 @@
1
+ /**
2
+ * Safely formats untrusted input for an error message.
3
+ *
4
+ * The result is JSON-like rather than JSON: values which JSON cannot express
5
+ * use explicit diagnostic tokens. Object accessors are described without
6
+ * running them, circular references are marked, and reflection failures are
7
+ * contained. Output is capped at 2,000 UTF-16 code units, five object levels,
8
+ * and 50 array items or object properties across the whole value.
9
+ */
10
+ declare function formatDiagnosticValue(
11
+ value: unknown,
12
+ indentation?: 0 | 4,
13
+ ): string;
14
+
1
15
  declare const version: string;
2
16
  declare const leftSingleQuote = "\u2018";
3
17
  declare const rightSingleQuote = "\u2019";
@@ -27,6 +41,14 @@ interface JSONObject {
27
41
  type Obj = JSONObject;
28
42
  type EolChar = "\n" | "\r" | "\r\n";
29
43
  type EolSetting = "lf" | "crlf" | "cr";
44
+ /** Clone nested data without retaining object or collection references. */
45
+ declare function deepClone<T>(value: T): T;
46
+ interface DeepCloneResult<T> {
47
+ hasRepeatedReferences: boolean;
48
+ value: T;
49
+ }
50
+ /** Clone nested data and report whether its source graph reused an object. */
51
+ declare function deepCloneWithMetadata<T>(value: T): DeepCloneResult<T>;
30
52
  declare function isNumberChar(value: unknown): boolean;
31
53
  declare function isCurrencyChar(value: unknown): boolean;
32
54
  declare function isCurrencySymbol(value: unknown): boolean;
@@ -69,7 +91,6 @@ declare function isRegExp(something: any): something is RegExp;
69
91
  * @param string source string
70
92
  * @param substring what to look for
71
93
  * @returns array of findings' position indexes
72
- * adapted from https://stackoverflow.com/a/10710406
73
94
  * console.log(findAllIdx("scissors", "s"));
74
95
  * -> [0, 3, 4, 7]
75
96
  */
@@ -115,18 +136,117 @@ declare function includes(
115
136
  ): boolean;
116
137
  /** Alternative to lodash.intersection */
117
138
  declare function intersection<T, U>(a?: T[], b?: U[]): T[];
139
+ /** What a flag's value gets coerced to, once parsed */
140
+ type CliFlagType = "boolean" | "string" | "number";
141
+ interface CliFlag {
142
+ /** Coercion applied to whatever the user typed. Undeclared - value is
143
+ * passed through as a raw string (or `true` for a bare flag) */
144
+ type?: CliFlagType;
145
+ /** Single-letter alias, for example `p` to serve `--pad` as `-p` */
146
+ shortFlag?: string;
147
+ /** Used when the flag is absent from argv */
148
+ default?: unknown;
149
+ /** Collect every occurrence into an array instead of last-one-wins */
150
+ isMultiple?: boolean;
151
+ }
152
+ interface CliPkg {
153
+ name?: string;
154
+ version?: string;
155
+ description?: string;
156
+ bin?: string | Record<string, string>;
157
+ [key: string]: unknown;
158
+ }
159
+ interface CliOptions {
160
+ /** The consuming program's package.json contents */
161
+ pkg?: CliPkg;
162
+ /** Flag schema, keyed by the flag's camelCase name */
163
+ flags?: Record<string, CliFlag>;
164
+ /** Defaults to `process.argv.slice(2)` */
165
+ argv?: string[];
166
+ /** Printed above the help text. Defaults to `pkg.description`,
167
+ * set to `false` to omit it */
168
+ description?: string | false;
169
+ /** Defaults to `pkg.version` */
170
+ version?: string;
171
+ /** How many spaces the help text is indented by. Default: 2 */
172
+ helpIndent?: number;
173
+ /** Print help and exit when the only argument is `--help`. Default: true */
174
+ autoHelp?: boolean;
175
+ /** Print version and exit when the only argument is `--version`.
176
+ * Default: true */
177
+ autoVersion?: boolean;
178
+ /** Value given to declared boolean flags the user didn't pass.
179
+ * Default: `false`, set to `undefined` to leave them unset */
180
+ booleanDefault?: boolean;
181
+ }
182
+ interface CliResult {
183
+ /** Positional arguments, in the order they were given */
184
+ input: string[];
185
+ /** Parsed flags, keyed by their camelCase names */
186
+ flags: Record<string, unknown>;
187
+ pkg: CliPkg;
188
+ /** The assembled help text, ready to print */
189
+ help: string;
190
+ /** Prints the help text, then exits (code 2 unless told otherwise) */
191
+ showHelp: (exitCode?: number) => void;
192
+ /** Prints the version, then exits with code 0 */
193
+ showVersion: () => void;
194
+ }
195
+ /**
196
+ * Parses argv the way a CLI expects: flags with values, short flags, bundles,
197
+ * `--no-` negation, camelCase names and a `--` escape hatch. Prints help or
198
+ * version on request. An in-house stand-in for "meow".
199
+ * @param helpText what `--help` prints
200
+ * @param options flag schema and the consuming program's package.json
201
+ * @returns the parsed `input` and `flags`, plus `help`/`showHelp`/`showVersion`
202
+ */
203
+ declare function codsenCLI(helpText?: string, options?: CliOptions): CliResult;
118
204
  /** Alternative to lodash.omit */
119
205
  declare function omit(obj: JSONObject, keysToRemove?: string[]): JSONObject;
206
+ interface MatchOptions {
207
+ /** Match letter case exactly. Off by default. */
208
+ caseSensitiveMatch?: boolean;
209
+ }
210
+ /**
211
+ * Match a whole string against one or more wildcard patterns.
212
+ *
213
+ * Patterns are anchored — they must consume the whole input, not a part of
214
+ * it. `*` stands for zero or more characters and does cross line breaks.
215
+ * A leading `!` negates a pattern: any negative pattern which matches vetoes
216
+ * the result outright, no matter what the positive ones did. Given only
217
+ * negative patterns, anything they don't catch passes. An empty pattern
218
+ * array matches nothing.
219
+ *
220
+ * `\` escapes the character after it, so `\*` means a literal asterisk and
221
+ * `\\` means a literal backslash.
222
+ *
223
+ * Matching walks code points, not UTF-16 code units, so a wildcard can never
224
+ * consume half of a surrogate pair.
225
+ * @param input string to match
226
+ * @param patterns one pattern or an array of them
227
+ * @returns boolean
228
+ * console.log(match("index.js", ["*.js", "!*.test.js"]));
229
+ * -> true
230
+ */
231
+ declare function match(
232
+ input: string,
233
+ patterns: string | readonly string[],
234
+ options?: MatchOptions,
235
+ ): boolean;
120
236
 
121
237
  export {
122
238
  backslash,
123
239
  backtick,
240
+ codsenCLI,
124
241
  compareFn,
242
+ deepClone,
243
+ deepCloneWithMetadata,
125
244
  detectEol,
126
245
  doublePrime,
127
246
  ellipsis,
128
247
  existy,
129
248
  findAllIdx,
249
+ formatDiagnosticValue,
130
250
  hairspace,
131
251
  hasOwnProp,
132
252
  includes,
@@ -150,6 +270,7 @@ export {
150
270
  isWhitespaceChar,
151
271
  leftDoubleQuote,
152
272
  leftSingleQuote,
273
+ match,
153
274
  multiplicationSign,
154
275
  omit,
155
276
  pullAll,
@@ -170,11 +291,18 @@ export {
170
291
  voidTags,
171
292
  };
172
293
  export type {
294
+ CliFlag,
295
+ CliFlagType,
296
+ CliOptions,
297
+ CliPkg,
298
+ CliResult,
299
+ DeepCloneResult,
173
300
  EolChar,
174
301
  EolSetting,
175
302
  JSONArray,
176
303
  JSONObject,
177
304
  JSONValue,
178
305
  JsonObject,
306
+ MatchOptions,
179
307
  Obj,
180
308
  };