@design-edito/tools 0.0.31 → 0.0.32
Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1 @@
|
|
1
|
+
function e(n,r){return typeof r=="string"?n===r:n.match(r)!==null}function g(n,r){return Array.isArray(r)?r.some(t=>e(n,t)):e(n,r)}function i(n,r){return Array.isArray(r)?r.every(t=>e(n,t)):e(n,r)}export{e as a,g as b,i as c};
|
package/index.js
CHANGED
@@ -33,6 +33,7 @@ import * as roundNumbers from './utils/agnostic/round-numbers/index.js'
|
|
33
33
|
import * as selectorToElement from './utils/agnostic/selector-to-element/index.js'
|
34
34
|
import * as silentLog from './utils/agnostic/silent-log/index.js'
|
35
35
|
import * as strToNodes from './utils/agnostic/str-to-nodes/index.js'
|
36
|
+
import * as stringMatches from './utils/agnostic/string-matches/index.js'
|
36
37
|
import * as throttleDebounce from './utils/agnostic/throttle-debounce/index.js'
|
37
38
|
import * as toAlphanum from './utils/agnostic/to-alphanum/index.js'
|
38
39
|
import * as transition from './utils/agnostic/transition/index.js'
|
@@ -79,6 +80,7 @@ export { roundNumbers }
|
|
79
80
|
export { selectorToElement }
|
80
81
|
export { silentLog }
|
81
82
|
export { strToNodes }
|
83
|
+
export { stringMatches }
|
82
84
|
export { throttleDebounce }
|
83
85
|
export { toAlphanum }
|
84
86
|
export { transition }
|
package/package.json
CHANGED
@@ -0,0 +1,4 @@
|
|
1
|
+
export default function stringMatches(input: string, matcher: string | RegExp): boolean;
|
2
|
+
export { stringMatches };
|
3
|
+
export declare function stringMatchesSome(input: string, matchers: string | RegExp | Array<string | RegExp>): boolean;
|
4
|
+
export declare function stringMatchesEvery(input: string, matchers: string | RegExp | Array<string | RegExp>): boolean;
|
@@ -0,0 +1 @@
|
|
1
|
+
import{a,b,c}from"../../../chunks/chunk-KNE7WIIW.js";export{a as default,a as stringMatches,c as stringMatchesEvery,b as stringMatchesSome};
|
@@ -15,8 +15,8 @@ export type Options = {
|
|
15
15
|
dedupeSimlinksContents?: boolean;
|
16
16
|
maxDepth?: number;
|
17
17
|
returnRelative?: boolean;
|
18
|
-
exclude?: RegExp | null;
|
19
|
-
include?: RegExp | null;
|
18
|
+
exclude?: RegExp | string | (RegExp | string)[] | null;
|
19
|
+
include?: RegExp | string | (RegExp | string)[] | null;
|
20
20
|
filter?: ((path: string, details: ChildDetails) => boolean | Promise<boolean>);
|
21
21
|
};
|
22
22
|
export declare const defaultOptions: Required<Options>;
|
@@ -1 +1 @@
|
|
1
|
-
import{promises as a}from"node:fs";import h from"node:path";var P={directories:!0,files:!0,symlinks:!0,hidden:!0,followSimlinks:!1,dedupeSimlinksContents:!1,maxDepth:1/0,returnRelative:!1,exclude:null,include:null,filter:()=>!0},
|
1
|
+
import{b as x}from"../../../chunks/chunk-KNE7WIIW.js";import{promises as a}from"node:fs";import h from"node:path";var P={directories:!0,files:!0,symlinks:!0,hidden:!0,followSimlinks:!1,dedupeSimlinksContents:!1,maxDepth:1/0,returnRelative:!1,exclude:null,include:null,filter:()=>!0},S=s=>({...P,...s}),v={depth:0,lstats:null,rootPath:null},O=s=>({...v,...s});async function E(...s){let[c,u]=s,t=S(u??{}),e=await p(...s);return t.returnRelative?e.map(i=>h.relative(c,i)):e}async function p(s,c={},u={}){let t=S(c),e=O(u);e.rootPath===null&&(e.rootPath=s);let i=[];if(e.depth>t.maxDepth)return i;try{if(!(e.lstats??await a.lstat(s)).isDirectory())return i}catch{return i}let k=await a.readdir(s);return await Promise.all(k.map(async d=>{let o=h.join(s,d),R=h.relative(e.rootPath??s,o),r=await a.lstat(o);try{let n=r.isDirectory(),l=r.isSymbolicLink(),f=!n&&!l,w=h.basename(o).startsWith("."),g=n?"directory":l?"symlink":"file";if(n&&t.directories===!1)throw!0;if(l&&t.symlinks===!1||f&&t.files===!1||w&&t.hidden===!1)throw!1;let m=l?await a.realpath(o):o,y=t.returnRelative?R:o,C=x(y,t.exclude??[]),D=x(y,t.include??[]);if(C&&!D)throw!1;if(!await t.filter(y,{type:g,hidden:w,realPath:m}))throw!0;if(l)if(t.followSimlinks===!1)i.push(o);else{let b=await p(m,t,{...e,depth:e.depth+1});i.push(m,...b)}else if(n){let b=await p(o,t,{...e,depth:e.depth+1,lstats:r});i.push(o,...b)}else i.push(o)}catch(n){if(typeof n!="boolean")throw new Error("This try/catch block should only throw booleans");if(!n)return[];let f=await p(o,t,{...e,depth:e.depth+1,lstats:r});i.push(...f)}})),t.dedupeSimlinksContents?Array.from(new Set(i)):i}export{E as default,v as defaultContext,P as defaultOptions,O as fillContext,S as fillOptions};
|