@design-edito/tools 0.0.31 → 0.0.33
Sign up to get free protection for your applications and to get access to all the features.
- package/chunks/chunk-KNE7WIIW.js +1 -0
- package/index.js +4 -0
- package/package.json +1 -1
- package/utils/agnostic/is-in-enum/index.d.ts +1 -1
- package/utils/agnostic/is-in-enum/index.js +1 -1
- package/utils/agnostic/record-format/index.d.ts +11 -6
- package/utils/agnostic/record-format/index.js +1 -1
- package/utils/agnostic/string-matches/index.d.ts +4 -0
- package/utils/agnostic/string-matches/index.js +1 -0
- package/utils/agnostic/string-normalize-indent/index.d.ts +1 -0
- package/utils/agnostic/string-normalize-indent/index.js +3 -0
- package/utils/node/list-subpaths/index.d.ts +2 -2
- package/utils/node/list-subpaths/index.js +1 -1
@@ -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,8 @@ 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'
|
37
|
+
import * as stringNormalizeIndent from './utils/agnostic/string-normalize-indent/index.js'
|
36
38
|
import * as throttleDebounce from './utils/agnostic/throttle-debounce/index.js'
|
37
39
|
import * as toAlphanum from './utils/agnostic/to-alphanum/index.js'
|
38
40
|
import * as transition from './utils/agnostic/transition/index.js'
|
@@ -79,6 +81,8 @@ export { roundNumbers }
|
|
79
81
|
export { selectorToElement }
|
80
82
|
export { silentLog }
|
81
83
|
export { strToNodes }
|
84
|
+
export { stringMatches }
|
85
|
+
export { stringNormalizeIndent }
|
82
86
|
export { throttleDebounce }
|
83
87
|
export { toAlphanum }
|
84
88
|
export { transition }
|
package/package.json
CHANGED
@@ -1 +1 @@
|
|
1
|
-
export default function isInEnum<E extends
|
1
|
+
export default function isInEnum<E extends Record<string, string | number>>(enumObj: E, value: string | number): value is E[keyof E];
|
@@ -1 +1 @@
|
|
1
|
-
function
|
1
|
+
function l(s,n){let t=Object.keys(s),c=Object.values(s).filter(e=>typeof e=="number");return t.filter(e=>!c.includes(parseInt(e,10))).map(e=>s[e]).includes(n)}export{l as default};
|
@@ -1,6 +1,11 @@
|
|
1
|
-
type
|
2
|
-
type
|
3
|
-
export
|
4
|
-
|
5
|
-
|
6
|
-
|
1
|
+
export type FormatKey<Input extends {} = any> = keyof Input | string;
|
2
|
+
export type InputValue<Input extends {}, Key extends FormatKey<Input>> = Input extends Record<Key, infer V> ? V : undefined;
|
3
|
+
export type FormatterFunc<I, O> = (val: I) => O | Promise<O>;
|
4
|
+
export type Format<Input extends {} = any> = {
|
5
|
+
[Key in FormatKey<Input>]: FormatterFunc<InputValue<Input, Key>, any>;
|
6
|
+
};
|
7
|
+
export type UnwrapPromise<PromiseOrNot> = PromiseOrNot extends Promise<infer Resolved> ? Resolved : PromiseOrNot;
|
8
|
+
export type Formatted<F extends Format<{}>> = {
|
9
|
+
[Key in keyof F]: UnwrapPromise<ReturnType<F[Key]>>;
|
10
|
+
};
|
11
|
+
export default function recordFormat<I extends {}, F extends Format<I>>(input: I, format: F): Promise<Formatted<F>>;
|
@@ -1 +1 @@
|
|
1
|
-
async function
|
1
|
+
async function a(o,n){let t={};for(let e in n){let r=n[e];typeof r=="function"?t[e]=await r(o[e]):t[e]=r}return t}export{a as default};
|
@@ -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};
|
@@ -0,0 +1 @@
|
|
1
|
+
export default function stringNormalizeIndent(input: string, indentLevel?: number): string;
|
@@ -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};
|