array-includes-with-glob 5.2.1 → 5.2.2
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 +6 -0
- package/README.md +1 -1
- package/dist/array-includes-with-glob.esm.js +3 -3
- package/dist/array-includes-with-glob.umd.js +12 -4
- package/package.json +3 -3
- package/types/index.d.ts +61 -6
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,12 @@
|
|
|
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.2.2 (2026-09-01)
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
- harden glob inclusion matching ([ac901db](https://github.com/codsen/codsen/commit/ac901db39ef29003493a2c76beca9ee23aa5c7ad))
|
|
11
|
+
|
|
6
12
|
## 5.2.1 (2026-08-22)
|
|
7
13
|
|
|
8
14
|
### Performance Improvements
|
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<h1 align="center">array-includes-with-glob</h1>
|
|
2
2
|
|
|
3
|
-
<p align="center">
|
|
3
|
+
<p align="center">Check strings against whole-string wildcard patterns</p>
|
|
4
4
|
|
|
5
5
|
<p align="center">
|
|
6
6
|
<a href="https://codsen.com/os/array-includes-with-glob" rel="nofollow noreferrer noopener">
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @name array-includes-with-glob
|
|
3
|
-
* @fileoverview
|
|
4
|
-
* @version 5.2.
|
|
3
|
+
* @fileoverview Check strings against whole-string wildcard patterns
|
|
4
|
+
* @version 5.2.2
|
|
5
5
|
* @author Roy Revelt
|
|
6
6
|
* @license MIT
|
|
7
7
|
* {@link https://codsen.com/os/array-includes-with-glob/}
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
import{
|
|
10
|
+
import{createMatcher as D,formatDiagnosticValue as t}from"codsen-utils";var O="5.2.2";var E=O,i={arrayVsArrayAllMustBeFound:"any",caseSensitive:!0,reportCompletionFunc:null,reportProgressFunc:null,reportProgressFuncFrom:0,reportProgressFuncTo:100},G=Object.freeze({...i});function V(o,a,r){if(typeof o!="string"&&!Array.isArray(o))throw new TypeError(`array-includes-with-glob/includesWithGlob(): [THROW_ID_01] The first argument must be a string or an array; received ${t(o,4)}.`);if(typeof a!="string"&&!Array.isArray(a))throw new TypeError(`array-includes-with-glob/includesWithGlob(): [THROW_ID_02] The second argument must be a string or an array of strings; received ${t(a,4)}.`);if(r!=null&&(typeof r!="object"||Array.isArray(r)))throw new TypeError(`array-includes-with-glob/includesWithGlob(): [THROW_ID_03] The third argument must be an options object, null, or undefined; received ${t(r,4)}.`);let m=r?.arrayVsArrayAllMustBeFound??i.arrayVsArrayAllMustBeFound;if(m!=="any"&&m!=="all")throw new TypeError(`array-includes-with-glob/includesWithGlob(): [THROW_ID_04] opts.arrayVsArrayAllMustBeFound must be "any", "all", null, or undefined; received ${t(m,4)}.`);let y=r?.caseSensitive??i.caseSensitive;if(typeof y!="boolean")throw new TypeError(`array-includes-with-glob/includesWithGlob(): [THROW_ID_05] opts.caseSensitive must be a Boolean, null, or undefined; received ${t(y,4)}.`);let u=r?.reportProgressFunc??i.reportProgressFunc;if(u!==null&&typeof u!="function")throw new TypeError(`array-includes-with-glob/includesWithGlob(): [THROW_ID_06] opts.reportProgressFunc must be a function, null, or undefined; received ${t(u,4)}.`);let s=r?.reportProgressFuncFrom??i.reportProgressFuncFrom;if(!Number.isFinite(s))throw new TypeError(`array-includes-with-glob/includesWithGlob(): [THROW_ID_07] opts.reportProgressFuncFrom must be a finite number, null, or undefined; received ${t(s,4)}.`);let l=r?.reportProgressFuncTo??i.reportProgressFuncTo;if(!Number.isFinite(l))throw new TypeError(`array-includes-with-glob/includesWithGlob(): [THROW_ID_08] opts.reportProgressFuncTo must be a finite number, null, or undefined; received ${t(l,4)}.`);if(s>l)throw new TypeError(`array-includes-with-glob/includesWithGlob(): [THROW_ID_09] opts.reportProgressFuncFrom cannot exceed opts.reportProgressFuncTo; received ${s} and ${l}.`);let d=r?.reportCompletionFunc??i.reportCompletionFunc;if(d!==null&&typeof d!="function")throw new TypeError(`array-includes-with-glob/includesWithGlob(): [THROW_ID_10] opts.reportCompletionFunc must be a function, null, or undefined; received ${t(d,4)}.`);let w=typeof a=="string"?[a]:Array.from(a);for(let e of w)if(typeof e!="string")throw new TypeError(`array-includes-with-glob/includesWithGlob(): [THROW_ID_11] The second argument's array must contain only strings and no holes; received ${t(e,4)}.`);let I=d?Date.now():0,b=typeof o=="string"?1:o.length,F,g=0,v=0;function h(e){u&&e!==F&&(F=e,u(e))}function p(e){return h(l),d?.({patternComparisons:g,sourceItemsVisited:v,timeTakenInMilliseconds:Date.now()-I}),e}h(s);let P=Array.from(new Set(w));if(b===0||P.length===0)return p(!1);let x={caseSensitiveMatch:y},T=P.map(e=>({matches:D(e,x),negative:e.charCodeAt(0)===33})),j=T.filter(e=>e.negative),c=T.filter(e=>!e.negative),A=new Uint8Array(c.length),W=c.length;for(let e=0;e<b;e++){let f=typeof o=="string"?o:o[e];if(v++,typeof f=="string"){let _=!0;for(let n of j)if(g++,!n.matches(f)){_=!1;break}if(_){if(c.length===0)return p(!0);if(m==="any"){for(let n of c)if(g++,n.matches(f))return p(!0)}else{for(let n=0;n<c.length;n++)A[n]||(g++,c[n].matches(f)&&(A[n]=1,W--));if(W===0)return p(!0)}}}h(s+Math.floor((e+1)/b*(l-s)))}return p(!1)}export{G as defaults,V as includesWithGlob,E as version};
|
|
@@ -1,17 +1,25 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @name array-includes-with-glob
|
|
3
|
-
* @fileoverview
|
|
4
|
-
* @version 5.2.
|
|
3
|
+
* @fileoverview Check strings against whole-string wildcard patterns
|
|
4
|
+
* @version 5.2.2
|
|
5
5
|
* @author Roy Revelt
|
|
6
6
|
* @license MIT
|
|
7
7
|
* {@link https://codsen.com/os/array-includes-with-glob/}
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
"use strict";var arrayIncludesWithGlob=(()=>{var v=Object.defineProperty;var U=Object.getOwnPropertyDescriptor;var T=Object.getOwnPropertyNames,j=Object.getOwnPropertySymbols;var M=Object.prototype.hasOwnProperty,N=Object.prototype.propertyIsEnumerable;var D=(t,e,r)=>e in t?v(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,x=(t,e)=>{for(var r in e||(e={}))M.call(e,r)&&D(t,r,e[r]);if(j)for(var r of j(e))N.call(e,r)&&D(t,r,e[r]);return t};var V=(t,e)=>{for(var r in e)v(t,r,{get:e[r],enumerable:!0})},Q=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let l of T(e))!M.call(t,l)&&l!==r&&v(t,l,{get:()=>e[l],enumerable:!(n=U(e,l))||n.enumerable});return t};var _=t=>Q(v({},"__esModule",{value:!0}),t);var ie={};V(ie,{defaults:()=>F,includesWithGlob:()=>ne,version:()=>re});var oe=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 R,ue=(R=Object.getOwnPropertyDescriptor(RegExp.prototype,"source"))==null?void 0:R.get;var ae=Date.prototype.getTime;var H=256,G=1024,z=1,K=new Map,Z=new Map;function k(t){if(t>=97&&t<=122)return t-32;if(t>65535)return t;let e=String.fromCharCode(t).toUpperCase();if(e.length!==1)return t;let r=e.charCodeAt(0);return t>127&&r<128?t:r}function O(t,e,r,n,l,i){for(let s=0;s<l;s++){let o=t.charCodeAt(e+s),u=r.charCodeAt(n+s);if(i||(o>=97&&o<=122&&(o-=32),u>=97&&u<=122&&(u-=32)),o!==u)return!1}return!0}function $(t,e,r){let n=e.indexOf("\\");if(n===-1&&t===e)return!0;let l=e.indexOf("*");if(n===-1&&l===-1){if(r)return!1;for(let c=0;c<e.length;c++)if(e.charCodeAt(c)>127)return;return t.length===e.length&&O(t,0,e,0,e.length,!1)}if(n!==-1)return;let i=0,s=!1,o=-1;for(let c=0;c<e.length;c++){let m=e.charCodeAt(c);if(m>127)return;if(m===42){if(o=c,!s){if(i++,i>1)return;s=!0}}else s=!1}let u=o+1,a=e.length-u;return t.length<l+a?!1:O(t,0,e,0,l,r)&&O(t,t.length-a,e,u,a,r)}function q(t){let e=new Uint32Array(t.length),r=0;for(let n=1;n<t.length;n++){for(;r>0&&t[n]!==t[r];)r=e[r-1];t[n]===t[r]&&r++,e[n]=r}return e}function J(t,e){let r=[[]],n=!0,l=!1,i=!1,s=0;for(let f=0;f<t.length;){let g=t.codePointAt(f);if(g!==92){if(g===42)l=!0,i||(r.push([]),i=!0);else{let d=e?g:k(g);r[r.length-1].push(d),n&&(n=d<=127),s++,i=!1}f+=g>65535?2:1;continue}let h=f+1;for(;t.charCodeAt(h)===92;)h++;let y=h-f,p=t.codePointAt(h),b,S=!1;p===42?(S=y%2===0,b=S?y/2:(y-1)/2):p===void 0||p===10||p===13||p===8232||p===8233?b=Math.ceil(y/2):b=Math.floor(y/2);for(let d=0;d<b;d++)r[r.length-1].push(92),s++;if(S){i=!1,f=h;continue}if(p!==void 0){let d=e?p:k(p);r[r.length-1].push(d),n&&(n=d<=127),s++,h+=p>65535?2:1}i=!1,f=h}let o=l&&r[0].length===0,u=l&&r[r.length-1].length===0,a=[];for(let f of r)f.length&&a.push({values:f});let c=o?0:1,m=a.length-(u?0:1);for(let f=c;f<m;f++)a[f].values.length>z&&(a[f].failure=q(a[f].values));return{asciiOnly:n,endsWithWildcard:u,hasWildcard:l,minimumInputLength:s,segments:a,startsWithWildcard:o}}function B(t,e){let r=e?K:Z,n=t.length<=G;if(n){let i=r.get(t);if(i)return i}let l=J(t,e);if(n){if(r.size>=H){let i=r.keys().next().value;i!==void 0&&r.delete(i)}r.set(t,l)}return l}function I(t,e){if(e){let l=[];for(let i=0;i<t.length;){let s=t.codePointAt(i);l.push(s),i+=s>65535?2:1}return l}let r=new Uint32Array(t.length),n=0;for(let l=0;l<t.length;){let i=t.codePointAt(l);r[n]=k(i),n++,l+=i>65535?2:1}return n===r.length?r:r.subarray(0,n)}function A(t,e,r,n){for(let l=0;l<r.values.length;l++){let i=t.charCodeAt(e+l);if(!n&&i>=97&&i<=122&&(i-=32),i!==r.values[l])return!1}return!0}function Y(t,e,r,n,l){let i=n-e.values.length;if(i<r)return-1;if(!e.failure){for(let o=r;o<=i;o++)if(A(t,o,e,l))return o;return-1}let s=0;for(let o=r;o<n;o++){let u=t.charCodeAt(o);for(!l&&u>=97&&u<=122&&(u-=32);s>0&&u!==e.values[s];)s=e.failure[s-1];if(u===e.values[s]&&(s++,s===e.values.length))return o-s+1}return-1}function L(t,e,r){if(t.length<e.minimumInputLength)return!1;if(!e.hasWildcard)return t.length===e.minimumInputLength&&A(t,0,e.segments[0],r);let n=0,l=e.segments.length,i=0,s=t.length;if(!e.startsWithWildcard){let o=e.segments[0];if(!A(t,0,o,r))return!1;i=o.values.length,n++}if(!e.endsWithWildcard){l--;let o=e.segments[l];if(s-=o.values.length,!A(t,s,o,r))return!1}for(let o=n;o<l;o++){let u=e.segments[o],a=Y(t,u,i,s,r);if(a===-1)return!1;i=a+u.values.length}return!0}function w(t,e,r){for(let n=0;n<r.values.length;n++)if(t[e+n]!==r.values[n])return!1;return!0}function X(t,e,r,n){let l=n-e.values.length;if(l<r)return-1;if(!e.failure){for(let s=r;s<=l;s++)if(w(t,s,e))return s;return-1}let i=0;for(let s=r;s<n;s++){for(;i>0&&t[s]!==e.values[i];)i=e.failure[i-1];if(t[s]===e.values[i]&&(i++,i===e.values.length))return s-i+1}return-1}function P(t,e){if(t.length<e.minimumInputLength)return!1;if(!e.hasWildcard)return t.length===e.minimumInputLength&&w(t,0,e.segments[0]);let r=0,n=e.segments.length,l=0,i=t.length;if(!e.startsWithWildcard){let s=e.segments[0];if(!w(t,0,s))return!1;l=s.values.length,r++}if(!e.endsWithWildcard){n--;let s=e.segments[n];if(i-=s.values.length,!w(t,i,s))return!1}for(let s=r;s<n;s++){let o=e.segments[s],u=X(t,o,l,i);if(u===-1)return!1;l=u+o.values.length}return!0}function ee(t,e,r){let n=$(t,e,r);if(n!==void 0)return n;let l=B(e,r);return l.asciiOnly?L(t,l,r):P(I(t,r),l)}function W(t,e,r,n){var s;let l=$(t,e,r);if(l!==void 0)return l;let i=B(e,r);return i.asciiOnly?L(t,i,r):((s=n.tokens)!=null||(n.tokens=I(t,r)),P(n.tokens,i))}function C(t,e,r){if(typeof e!="string"&&!e.length)return!1;let n=r===void 0?!1:r.caseSensitiveMatch===!0;if(typeof e=="string"){let o=e.charCodeAt(0)===33,u=o?e.slice(1):e,a=ee(t,u,n);return o?!a:a}let l={},i=!1,s=!1;for(let o of e){let u=o.charCodeAt(0)===33,a=u?o.slice(1):o;if(u){if(W(t,a,n,l))return!1}else i=!0,!s&&W(t,a,n,l)&&(s=!0)}return i?s:!0}var E="5.2.1";var re=E,F={arrayVsArrayAllMustBeFound:"any",caseSensitive:!0};function ne(t,e,r){if(!t.length||!e.length)return!1;let n=x(x({},F),r),l=typeof t=="string"?[t]:Array.from(t);return typeof e=="string"?l.some(i=>C(i,e,{caseSensitiveMatch:n.caseSensitive})):n.arrayVsArrayAllMustBeFound==="any"?e.some(i=>l.some(s=>C(s,i,{caseSensitiveMatch:n.caseSensitive}))):e.every(i=>l.some(s=>C(s,i,{caseSensitiveMatch:n.caseSensitive})))}return _(ie);})();
|
|
10
|
+
"use strict";var arrayIncludesWithGlob=(()=>{var C=Object.defineProperty;var _e=Object.getOwnPropertyDescriptor;var re=Object.getOwnPropertyNames,N=Object.getOwnPropertySymbols;var H=Object.prototype.hasOwnProperty,ne=Object.prototype.propertyIsEnumerable;var U=(t,_,e)=>_ in t?C(t,_,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[_]=e,G=(t,_)=>{for(var e in _||(_={}))H.call(_,e)&&U(t,e,_[e]);if(N)for(var e of N(_))ne.call(_,e)&&U(t,e,_[e]);return t};var ie=(t,_)=>{for(var e in _)C(t,e,{get:_[e],enumerable:!0})},oe=(t,_,e,r)=>{if(_&&typeof _=="object"||typeof _=="function")for(let o of re(_))!H.call(t,o)&&o!==e&&C(t,o,{get:()=>_[o],enumerable:!(r=_e(_,o))||r.enumerable});return t};var le=t=>oe(C({},"__esModule",{value:!0}),t);var We={};ie(We,{defaults:()=>De,includesWithGlob:()=>Se,version:()=>Fe});function se(){let t=[],_=0,e=!1;return{append(r){return e?!1:_+r.length>1999?(t.push("\u2026"),_+=1,e=!0,!1):(t.push(r),_+=r.length,!0)},result(){return t.join("")},stopped(){return e}}}function ae(t){return"\\u".concat(t.toString(16).padStart(4,"0"))}function P(t,_){if(t.append('"')){for(let e=0;e<_.length&&!t.stopped();e+=1){let r=_.charCodeAt(e);r===34?t.append('\\"'):r===92?t.append("\\\\"):r===8?t.append("\\b"):r===9?t.append("\\t"):r===10?t.append("\\n"):r===12?t.append("\\f"):r===13?t.append("\\r"):r<32||r===8232||r===8233||r>=55296&&r<=57343?t.append(ae(r)):t.append(_[e])}t.append('"')}}function ue(t){return t.get&&t.set?"[Getter/Setter]":t.get?"[Getter]":t.set?"[Setter]":"[Accessor]"}function K(t,_){t.append("Symbol(");let e=String(_);e.length>8&&P(t,e.slice(7,-1)),t.append(")")}function q(t,_){typeof _=="symbol"?K(t,_):P(t,String(_))}function m(t,_=0){let e=se(),r=_===4?4:0,o=new WeakSet,n=0;function i(l){r&&e.append(" ".repeat(l*r))}function s(l,a){l&&e.append(","),r&&(e.append("\n"),i(a+1))}function u(l,a,c){r&&a&&(e.append("\n"),i(c)),e.append(l)}function h(l,a){Object.prototype.hasOwnProperty.call(l,"value")?b(l.value,a):e.append(ue(l))}function k(l,a){let c;try{c=Reflect.getOwnPropertyDescriptor(l,"length")}catch(f){e.append("[Uninspectable]");return}let d=c==null?void 0:c.value;if(!Number.isSafeInteger(d)||d<0){e.append("[Uninspectable]");return}e.append("[");let y=!1;for(let f=0;f<d&&!e.stopped();f+=1){if(s(y,a),y=!0,n>=50){e.append("[MaxEntries]");break}n+=1;let w;try{w=Reflect.getOwnPropertyDescriptor(l,String(f))}catch(O){e.append("[Uninspectable]");continue}w!=null&&w.enumerable?h(w,a+1):e.append("[Empty]")}u("]",y,a)}function A(l,a){let c;try{c=Reflect.ownKeys(l)}catch(y){e.append("[Uninspectable]");return}e.append("{");let d=!1;for(let y of c){if(e.stopped())break;if(n>=50){s(d,a),d=!0,P(e,"\u2026"),e.append(r?": ":":"),e.append("[MaxEntries]");break}n+=1;let f;try{f=Reflect.getOwnPropertyDescriptor(l,y)}catch(w){s(d,a),d=!0,q(e,y),e.append(r?": ":":"),e.append("[Uninspectable]");continue}f!=null&&f.enumerable&&(s(d,a),d=!0,q(e,y),e.append(r?": ":":"),h(f,a+1))}u("}",d,a)}function p(l,a){if(o.has(l)){e.append("[Circular]");return}if(a>=5){e.append("[MaxDepth]");return}let c;try{c=Array.isArray(l)}catch(d){e.append("[Uninspectable]");return}o.add(l);try{c?k(l,a):A(l,a)}finally{o.delete(l)}}function b(l,a){l===null?e.append("null"):typeof l=="string"?P(e,l):typeof l=="number"?e.append(Object.is(l,-0)?"-0":String(l)):typeof l=="boolean"?e.append(l?"true":"false"):typeof l>"u"?e.append("undefined"):typeof l=="bigint"?e.append("".concat(l,"n")):typeof l=="symbol"?K(e,l):typeof l=="function"?e.append("[Function]"):p(l,a)}try{return b(t,0),e.result()}catch(l){return"[Uninspectable]"}}var ce=["_16_0_a_0_4_0_5_m_1_u_1_cp_4_b_e_4_7_0_1_0_3l_4_1_1_2_3_1_0_6_0_1_2_1_0_1_j_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b_k_0_1n_16_d_0_1z_q_11_6_55_17_38_1r_v_","7_2_0_2_7_1_1_1_n_f_0_1_0_2m_7_2_12_g_0_1_0_s_0_a_13_7_0_l_0_b_19_j_0_i_20_5j_w_v_8_1_10_h_0_1d_t_34","_6_1_1_1_11_l_0_p_5_1_1_1_v_e_0_n_17_78_i_f_0_1_c_1_x_3g_0_27_pl_6e_5f_218_2o_f_tr_h_5_p_32y_5_g6_5a","1_t_1cy_fs_7_u_h_26_h_t_i_1b_g_3_v_k_5_i_c0_18_5v_1r_w_o_2_o_18_22_5_0_1u_c_1s_1_1_0_e_1_c_5p1_15_v_","2p_36_6pp_3_1_6_1_1_1_82_f_0_t_2_2_0_e_3_8_az_1s4_2y_5_c_3_8_7_9_4me_2c_1_1y_1_1_2_0_2_1_2_3_1_b_1_0","_1_6_1_1s_1_3_2_7_1_6_1_r_1_3_1_4_1_0_3_6_1_9f_2_o_1_o_1_u_1_o_1_u_1_o_1_u_1_o_1_u_1_o_1_7_1f8_u_6_5","_79_1p_42_18_a_6_g_0_8x_t_i_17_dg_r_6c_t_2_0_5r_u_1_2_1_1_1_6_2_4_9_1_68_6_1_3_1_1_1_e_1_5g_1n_1v_7_","0_xg_3_1_q_1_1_1_0_2_0_1_9_1_3_1_0_1_0_6_0_4_0_1_0_1_0_1_2_1_1_1_0_2_0_1_0_1_0_1_0_1_0_1_1_1_0_2_3_1","_6_1_3_1_3_1_0_1_9_1_g_5_2_1_4_1_g_3es_wyn_w_3dp_2_4gd_2_5rk_f_h9_1wi_f1_15u_3t6_5_6jt"].join(""),S=ce.slice(1).split("_"),fe=[],Q=127;for(let t=0;t<S.length;t+=2){let _=Q+1+Number.parseInt(S[t],36),e=_+Number.parseInt(S[t+1],36);fe.push([_,e]),Q=e}var $e=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 pe=Function.prototype.toString,Ee=pe.call(Object);var Be=Map.prototype.entries,Le=Set.prototype.values;var J,Ve=(J=Object.getOwnPropertyDescriptor(ArrayBuffer.prototype,"byteLength"))==null?void 0:J.get,Z,ze=(Z=Object.getOwnPropertyDescriptor(RegExp.prototype,"flags"))==null?void 0:Z.get,Y,Ne=(Y=Object.getOwnPropertyDescriptor(RegExp.prototype,"global"))==null?void 0:Y.get,X,Ue=(X=Object.getOwnPropertyDescriptor(RegExp.prototype,"source"))==null?void 0:X.get,He=RegExp.prototype.test;var Ge=Date.prototype.getTime;var de=256,ge=1024,he=1,ye=new Map,be=new Map;function R(t){if(t>=97&&t<=122)return t-32;if(t>65535)return t;let _=String.fromCharCode(t).toUpperCase();if(_.length!==1)return t;let e=_.charCodeAt(0);return t>127&&e<128?t:e}function me(t){let _=new Uint32Array(t.length),e=0;for(let r=1;r<t.length;r++){for(;e>0&&t[r]!==t[e];)e=_[e-1];t[r]===t[e]&&e++,_[r]=e}return _}function ve(t,_){let e=[[]],r=!0,o=!1,n=!1,i=0;for(let p=0;p<t.length;){let b=t.codePointAt(p);if(b!==92){if(b===42)o=!0,n||(e.push([]),n=!0);else{let f=_?b:R(b);e[e.length-1].push(f),r&&(r=f<=127),i++,n=!1}p+=b>65535?2:1;continue}let l=p+1;for(;t.charCodeAt(l)===92;)l++;let a=l-p,c=t.codePointAt(l),d,y=!1;c===42?(y=a%2===0,d=y?a/2:(a-1)/2):c===void 0||c===10||c===13||c===8232||c===8233?d=Math.ceil(a/2):d=Math.floor(a/2);for(let f=0;f<d;f++)e[e.length-1].push(92),i++;if(y){n=!1,p=l;continue}if(c!==void 0){let f=_?c:R(c);e[e.length-1].push(f),r&&(r=f<=127),i++,l+=c>65535?2:1}n=!1,p=l}let s=o&&e[0].length===0,u=o&&e[e.length-1].length===0,h=[];for(let p of e)p.length&&h.push({values:p});let k=s?0:1,A=h.length-(u?0:1);for(let p=k;p<A;p++)h[p].values.length>he&&(h[p].failure=me(h[p].values));return{asciiOnly:r,endsWithWildcard:u,hasWildcard:o,minimumInputLength:i,segments:h,startsWithWildcard:s}}function we(t,_){let e=_?ye:be,r=t.length<=ge;if(r){let n=e.get(t);if(n)return n}let o=ve(t,_);if(r){if(e.size>=de){let n=e.keys().next().value;n!==void 0&&e.delete(n)}e.set(t,o)}return o}function Ae(t,_){if(_){let o=[];for(let n=0;n<t.length;){let i=t.codePointAt(n);o.push(i),n+=i>65535?2:1}return o}let e=new Uint32Array(t.length),r=0;for(let o=0;o<t.length;){let n=t.codePointAt(o);e[r]=R(n),r++,o+=n>65535?2:1}return r===e.length?e:e.subarray(0,r)}function F(t,_,e,r){for(let o=0;o<e.values.length;o++){let n=t.charCodeAt(_+o);if(!r&&n>=97&&n<=122&&(n-=32),n!==e.values[o])return!1}return!0}function Oe(t,_,e,r,o){let n=r-_.values.length;if(n<e)return-1;if(!_.failure){for(let s=e;s<=n;s++)if(F(t,s,_,o))return s;return-1}let i=0;for(let s=e;s<r;s++){let u=t.charCodeAt(s);for(!o&&u>=97&&u<=122&&(u-=32);i>0&&u!==_.values[i];)i=_.failure[i-1];if(u===_.values[i]&&(i++,i===_.values.length))return s-i+1}return-1}function je(t,_,e){if(t.length<_.minimumInputLength)return!1;if(!_.hasWildcard)return t.length===_.minimumInputLength&&F(t,0,_.segments[0],e);let r=0,o=_.segments.length,n=0,i=t.length;if(!_.startsWithWildcard){let s=_.segments[0];if(!F(t,0,s,e))return!1;n=s.values.length,r++}if(!_.endsWithWildcard){o--;let s=_.segments[o];if(i-=s.values.length,!F(t,i,s,e))return!1}for(let s=r;s<o;s++){let u=_.segments[s],h=Oe(t,u,n,i,e);if(h===-1)return!1;n=h+u.values.length}return!0}function D(t,_,e){for(let r=0;r<e.values.length;r++)if(t[_+r]!==e.values[r])return!1;return!0}function ke(t,_,e,r){let o=r-_.values.length;if(o<e)return-1;if(!_.failure){for(let i=e;i<=o;i++)if(D(t,i,_))return i;return-1}let n=0;for(let i=e;i<r;i++){for(;n>0&&t[i]!==_.values[n];)n=_.failure[n-1];if(t[i]===_.values[n]&&(n++,n===_.values.length))return i-n+1}return-1}function xe(t,_){if(t.length<_.minimumInputLength)return!1;if(!_.hasWildcard)return t.length===_.minimumInputLength&&D(t,0,_.segments[0]);let e=0,r=_.segments.length,o=0,n=t.length;if(!_.startsWithWildcard){let i=_.segments[0];if(!D(t,0,i))return!1;o=i.values.length,e++}if(!_.endsWithWildcard){r--;let i=_.segments[r];if(n-=i.values.length,!D(t,n,i))return!1}for(let i=e;i<r;i++){let s=_.segments[i],u=ke(t,s,o,n);if(u===-1)return!1;o=u+s.values.length}return!0}function Ce(t,_){let e=t.charCodeAt(0)===33,r=e?t.slice(1):t;return{compiled:r.length===0?void 0:we(r,_),negative:e}}function W(t,_,e,r){var n;let o;return _.compiled?_.compiled.asciiOnly?o=je(t,_.compiled,e):((n=r.tokens)!=null||(r.tokens=Ae(t,e)),o=xe(r.tokens,_.compiled)):o=t.length===0,_.negative?!o:o}function ee(t,_){let e=(_==null?void 0:_.caseSensitiveMatch)===!0,r=typeof t=="string"?[t]:Array.from(new Set(t));if(r.length===0)return()=>!1;let o=r.map(n=>Ce(n,e));if(typeof t=="string"){let n=o[0];return i=>W(i,n,e,{})}return n=>{let i={},s=!1,u=!1;for(let h of o)if(h.negative){if(!W(n,h,e,i))return!1}else s=!0,!u&&W(n,h,e,i)&&(u=!0);return s?u:!0}}var te="5.2.2";var Fe=te,j={arrayVsArrayAllMustBeFound:"any",caseSensitive:!0,reportCompletionFunc:null,reportProgressFunc:null,reportProgressFuncFrom:0,reportProgressFuncTo:100},De=Object.freeze(G({},j));function Se(t,_,e){var M,$,E,B,L,V;if(typeof t!="string"&&!Array.isArray(t))throw new TypeError("array-includes-with-glob/includesWithGlob(): [THROW_ID_01] The first argument must be a string or an array; received ".concat(m(t,4),"."));if(typeof _!="string"&&!Array.isArray(_))throw new TypeError("array-includes-with-glob/includesWithGlob(): [THROW_ID_02] The second argument must be a string or an array of strings; received ".concat(m(_,4),"."));if(e!=null&&(typeof e!="object"||Array.isArray(e)))throw new TypeError("array-includes-with-glob/includesWithGlob(): [THROW_ID_03] The third argument must be an options object, null, or undefined; received ".concat(m(e,4),"."));let r=(M=e==null?void 0:e.arrayVsArrayAllMustBeFound)!=null?M:j.arrayVsArrayAllMustBeFound;if(r!=="any"&&r!=="all")throw new TypeError('array-includes-with-glob/includesWithGlob(): [THROW_ID_04] opts.arrayVsArrayAllMustBeFound must be "any", "all", null, or undefined; received '.concat(m(r,4),"."));let o=($=e==null?void 0:e.caseSensitive)!=null?$:j.caseSensitive;if(typeof o!="boolean")throw new TypeError("array-includes-with-glob/includesWithGlob(): [THROW_ID_05] opts.caseSensitive must be a Boolean, null, or undefined; received ".concat(m(o,4),"."));let n=(E=e==null?void 0:e.reportProgressFunc)!=null?E:j.reportProgressFunc;if(n!==null&&typeof n!="function")throw new TypeError("array-includes-with-glob/includesWithGlob(): [THROW_ID_06] opts.reportProgressFunc must be a function, null, or undefined; received ".concat(m(n,4),"."));let i=(B=e==null?void 0:e.reportProgressFuncFrom)!=null?B:j.reportProgressFuncFrom;if(!Number.isFinite(i))throw new TypeError("array-includes-with-glob/includesWithGlob(): [THROW_ID_07] opts.reportProgressFuncFrom must be a finite number, null, or undefined; received ".concat(m(i,4),"."));let s=(L=e==null?void 0:e.reportProgressFuncTo)!=null?L:j.reportProgressFuncTo;if(!Number.isFinite(s))throw new TypeError("array-includes-with-glob/includesWithGlob(): [THROW_ID_08] opts.reportProgressFuncTo must be a finite number, null, or undefined; received ".concat(m(s,4),"."));if(i>s)throw new TypeError("array-includes-with-glob/includesWithGlob(): [THROW_ID_09] opts.reportProgressFuncFrom cannot exceed opts.reportProgressFuncTo; received ".concat(i," and ").concat(s,"."));let u=(V=e==null?void 0:e.reportCompletionFunc)!=null?V:j.reportCompletionFunc;if(u!==null&&typeof u!="function")throw new TypeError("array-includes-with-glob/includesWithGlob(): [THROW_ID_10] opts.reportCompletionFunc must be a function, null, or undefined; received ".concat(m(u,4),"."));let h=typeof _=="string"?[_]:Array.from(_);for(let g of h)if(typeof g!="string")throw new TypeError("array-includes-with-glob/includesWithGlob(): [THROW_ID_11] The second argument's array must contain only strings and no holes; received ".concat(m(g,4),"."));let k=u?Date.now():0,A=typeof t=="string"?1:t.length,p,b=0,l=0;function a(g){n&&g!==p&&(p=g,n(g))}function c(g){return a(s),u==null||u({patternComparisons:b,sourceItemsVisited:l,timeTakenInMilliseconds:Date.now()-k}),g}a(i);let d=Array.from(new Set(h));if(A===0||d.length===0)return c(!1);let y={caseSensitiveMatch:o},f=d.map(g=>({matches:ee(g,y),negative:g.charCodeAt(0)===33})),w=f.filter(g=>g.negative),O=f.filter(g=>!g.negative),I=new Uint8Array(O.length),T=O.length;for(let g=0;g<A;g++){let x=typeof t=="string"?t:t[g];if(l++,typeof x=="string"){let z=!0;for(let v of w)if(b++,!v.matches(x)){z=!1;break}if(z){if(O.length===0)return c(!0);if(r==="any"){for(let v of O)if(b++,v.matches(x))return c(!0)}else{for(let v=0;v<O.length;v++)I[v]||(b++,O[v].matches(x)&&(I[v]=1,T--));if(T===0)return c(!0)}}}a(i+Math.floor((g+1)/A*(s-i)))}return c(!1)}return le(We);})();
|
|
11
|
+
/**
|
|
12
|
+
* @name codsen-format-diagnostic-value
|
|
13
|
+
* @fileoverview Safely format untrusted JavaScript values for diagnostics
|
|
14
|
+
* @version 1.1.0
|
|
15
|
+
* @author Roy Revelt
|
|
16
|
+
* @license MIT
|
|
17
|
+
* {@link https://codsen.com/os/codsen-format-diagnostic-value/}
|
|
18
|
+
*/
|
|
11
19
|
/**
|
|
12
20
|
* @name codsen-utils
|
|
13
21
|
* @fileoverview Various utility functions
|
|
14
|
-
* @version 1.
|
|
22
|
+
* @version 1.10.0
|
|
15
23
|
* @author Roy Revelt
|
|
16
24
|
* @license MIT
|
|
17
25
|
* {@link https://codsen.com/os/codsen-utils/}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "array-includes-with-glob",
|
|
3
|
-
"version": "5.2.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "5.2.2",
|
|
4
|
+
"description": "Check strings against whole-string wildcard patterns",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"array",
|
|
7
7
|
"arrays",
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
}
|
|
74
74
|
},
|
|
75
75
|
"dependencies": {
|
|
76
|
-
"codsen-utils": "^1.
|
|
76
|
+
"codsen-utils": "^1.10.0"
|
|
77
77
|
},
|
|
78
78
|
"engines": {
|
|
79
79
|
"node": ">=18.20.8"
|
package/types/index.d.ts
CHANGED
|
@@ -1,17 +1,72 @@
|
|
|
1
1
|
declare const version: string;
|
|
2
|
+
interface CompletionStats {
|
|
3
|
+
/** Number of prepared-pattern comparisons performed. */
|
|
4
|
+
patternComparisons: number;
|
|
5
|
+
/** Number of source positions read before the result was known. */
|
|
6
|
+
sourceItemsVisited: number;
|
|
7
|
+
/** Best-effort elapsed time for user-facing completion feedback. */
|
|
8
|
+
timeTakenInMilliseconds: number;
|
|
9
|
+
}
|
|
2
10
|
interface Opts {
|
|
3
11
|
arrayVsArrayAllMustBeFound: "any" | "all";
|
|
4
12
|
caseSensitive: boolean;
|
|
13
|
+
reportCompletionFunc: null | ((stats: CompletionStats) => void);
|
|
14
|
+
reportProgressFunc: null | ((percentageDone: number) => void);
|
|
15
|
+
reportProgressFuncFrom: number;
|
|
16
|
+
reportProgressFuncTo: number;
|
|
17
|
+
}
|
|
18
|
+
interface InputOpts {
|
|
19
|
+
arrayVsArrayAllMustBeFound?:
|
|
20
|
+
| Opts["arrayVsArrayAllMustBeFound"]
|
|
21
|
+
| null
|
|
22
|
+
| undefined;
|
|
23
|
+
caseSensitive?: boolean | null | undefined;
|
|
24
|
+
reportCompletionFunc?: Opts["reportCompletionFunc"] | undefined;
|
|
25
|
+
reportProgressFunc?: Opts["reportProgressFunc"] | undefined;
|
|
26
|
+
reportProgressFuncFrom?: number | null | undefined;
|
|
27
|
+
reportProgressFuncTo?: number | null | undefined;
|
|
5
28
|
}
|
|
6
|
-
declare const defaults: Opts
|
|
29
|
+
declare const defaults: Readonly<Opts>;
|
|
7
30
|
/**
|
|
8
|
-
*
|
|
31
|
+
* Test whether source values match whole-string wildcard patterns.
|
|
32
|
+
*
|
|
33
|
+
* `*` matches zero or more Unicode code points, including directory separators
|
|
34
|
+
* and line breaks. Consecutive stars are equivalent to one. A backslash escapes
|
|
35
|
+
* the next character, so `\*` matches a literal asterisk and `\\` matches a
|
|
36
|
+
* literal backslash. All other punctuation is literal. Matching is
|
|
37
|
+
* case-sensitive by default; case-insensitive matching uses one-code-point
|
|
38
|
+
* uppercase comparisons and is not locale-aware.
|
|
39
|
+
*
|
|
40
|
+
* Pattern arrays form one allow/deny list. A leading `!` excludes a matching
|
|
41
|
+
* source value from every positive pattern. Escape it as `\!` to match a
|
|
42
|
+
* literal leading exclamation mark. With `arrayVsArrayAllMustBeFound: "any"`,
|
|
43
|
+
* one positive pattern must match an allowed source value. With `"all"`, every
|
|
44
|
+
* unique positive pattern must match an allowed source value. A negative-only
|
|
45
|
+
* list matches when at least one source value is not excluded.
|
|
46
|
+
*
|
|
47
|
+
* Empty strings are values and patterns; `""` therefore matches `""`, and `*`
|
|
48
|
+
* also matches `""`. Empty and holes-only pattern arrays match nothing.
|
|
49
|
+
* Non-string entries and holes in a source array are skipped. The function does
|
|
50
|
+
* not mutate its inputs.
|
|
51
|
+
*
|
|
52
|
+
* Progress and completion callbacks are observational. Progress is finite and
|
|
53
|
+
* monotonic within the configured range. Callback errors propagate to the
|
|
54
|
+
* caller.
|
|
55
|
+
*
|
|
56
|
+
* @param input one source string or a read-only array whose non-string entries
|
|
57
|
+
* are skipped
|
|
58
|
+
* @param findThis one pattern or a read-only array of patterns
|
|
59
|
+
* @param opts matching and reporting options
|
|
60
|
+
* @returns whether the requested pattern condition was satisfied
|
|
61
|
+
* @example
|
|
62
|
+
* includesWithGlob(["index.js", "index.test.js"], ["*.js", "!*.test.js"]);
|
|
63
|
+
* // => true
|
|
9
64
|
*/
|
|
10
65
|
declare function includesWithGlob(
|
|
11
|
-
input: string |
|
|
12
|
-
findThis: string | string[],
|
|
13
|
-
opts?:
|
|
66
|
+
input: string | readonly unknown[],
|
|
67
|
+
findThis: string | readonly string[],
|
|
68
|
+
opts?: InputOpts | null,
|
|
14
69
|
): boolean;
|
|
15
70
|
|
|
16
71
|
export { defaults, includesWithGlob, version };
|
|
17
|
-
export type { Opts };
|
|
72
|
+
export type { CompletionStats, InputOpts, Opts };
|