@design-edito/tools 0.0.30 → 0.0.32
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/chunks/chunk-KNE7WIIW.js +1 -0
- package/index.js +14 -6
- package/package.json +1 -1
- package/utils/agnostic/array/index.d.ts +7 -0
- package/utils/agnostic/array/index.js +1 -0
- package/utils/agnostic/assert/index.d.ts +3 -0
- package/utils/agnostic/assert/index.js +1 -0
- package/utils/agnostic/await-timeout/index.d.ts +2 -0
- package/utils/agnostic/await-timeout/index.js +1 -0
- package/utils/agnostic/random/index.d.ts +9 -0
- package/utils/agnostic/random/index.js +1 -0
- package/utils/agnostic/regexp/index.d.ts +21 -0
- package/utils/agnostic/regexp/index.js +1 -0
- package/utils/agnostic/string-matches/index.d.ts +4 -0
- package/utils/agnostic/string-matches/index.js +1 -0
- package/utils/agnostic/to-alphanum/index.d.ts +1 -0
- package/utils/agnostic/to-alphanum/index.js +1 -0
- package/utils/node/list-subpaths/index.d.ts +2 -2
- package/utils/node/list-subpaths/index.js +1 -1
- package/utils/node/process-exit/index.d.ts +2 -0
- package/utils/node/process-exit/index.js +1 -1
- package/utils/agnostic/array-random-pick/index.d.ts +0 -3
- package/utils/agnostic/array-random-pick/index.js +0 -1
- package/utils/agnostic/find-duplicates-in-array/index.d.ts +0 -1
- package/utils/agnostic/find-duplicates-in-array/index.js +0 -1
- package/utils/agnostic/random-uuid/index.d.ts +0 -5
- package/utils/agnostic/random-uuid/index.js +0 -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
@@ -1,13 +1,14 @@
|
|
1
1
|
import * as Comp from './components/Comp/index.js'
|
2
2
|
import * as absoluteModulo from './utils/agnostic/absolute-modulo/index.js'
|
3
|
-
import * as
|
3
|
+
import * as array from './utils/agnostic/array/index.js'
|
4
|
+
import * as assert from './utils/agnostic/assert/index.js'
|
5
|
+
import * as awaitTimeout from './utils/agnostic/await-timeout/index.js'
|
4
6
|
import * as bem from './utils/agnostic/bem/index.js'
|
5
7
|
import * as cast from './utils/agnostic/cast/index.js'
|
6
8
|
import * as charcodeString from './utils/agnostic/charcode-string/index.js'
|
7
9
|
import * as clamp from './utils/agnostic/clamp/index.js'
|
8
10
|
import * as clientsideHtmlSanitizer from './utils/agnostic/clientside-html-sanitizer/index.js'
|
9
11
|
import * as crossenv from './utils/agnostic/crossenv/index.js'
|
10
|
-
import * as findDuplicatesInArray from './utils/agnostic/find-duplicates-in-array/index.js'
|
11
12
|
import * as flattenGetters from './utils/agnostic/flatten-getters/index.js'
|
12
13
|
import * as generateHtmlPlaceholders from './utils/agnostic/generate-html-placeholders/index.js'
|
13
14
|
import * as generateNiceColor from './utils/agnostic/generate-nice-color/index.js'
|
@@ -23,15 +24,18 @@ import * as isRecord from './utils/agnostic/is-record/index.js'
|
|
23
24
|
import * as isValidCssClassName from './utils/agnostic/is-valid-css-class-name/index.js'
|
24
25
|
import * as memoize from './utils/agnostic/memoize/index.js'
|
25
26
|
import * as objectValidateFromPartial from './utils/agnostic/object-validate-from-partial/index.js'
|
26
|
-
import * as
|
27
|
+
import * as random from './utils/agnostic/random/index.js'
|
27
28
|
import * as recordFormat from './utils/agnostic/record-format/index.js'
|
29
|
+
import * as regexp from './utils/agnostic/regexp/index.js'
|
28
30
|
import * as replaceAll from './utils/agnostic/replace-all/index.js'
|
29
31
|
import * as responsiveHarmonics from './utils/agnostic/responsive-harmonics/index.js'
|
30
32
|
import * as roundNumbers from './utils/agnostic/round-numbers/index.js'
|
31
33
|
import * as selectorToElement from './utils/agnostic/selector-to-element/index.js'
|
32
34
|
import * as silentLog from './utils/agnostic/silent-log/index.js'
|
33
35
|
import * as strToNodes from './utils/agnostic/str-to-nodes/index.js'
|
36
|
+
import * as stringMatches from './utils/agnostic/string-matches/index.js'
|
34
37
|
import * as throttleDebounce from './utils/agnostic/throttle-debounce/index.js'
|
38
|
+
import * as toAlphanum from './utils/agnostic/to-alphanum/index.js'
|
35
39
|
import * as transition from './utils/agnostic/transition/index.js'
|
36
40
|
import * as wait from './utils/agnostic/wait/index.js'
|
37
41
|
import * as dynamicCss from './utils/browser/dynamic-css/index.js'
|
@@ -43,14 +47,15 @@ import * as processExit from './utils/node/process-exit/index.js'
|
|
43
47
|
import * as readWriteFile from './utils/node/read-write-file/index.js'
|
44
48
|
export { Comp }
|
45
49
|
export { absoluteModulo }
|
46
|
-
export {
|
50
|
+
export { array }
|
51
|
+
export { assert }
|
52
|
+
export { awaitTimeout }
|
47
53
|
export { bem }
|
48
54
|
export { cast }
|
49
55
|
export { charcodeString }
|
50
56
|
export { clamp }
|
51
57
|
export { clientsideHtmlSanitizer }
|
52
58
|
export { crossenv }
|
53
|
-
export { findDuplicatesInArray }
|
54
59
|
export { flattenGetters }
|
55
60
|
export { generateHtmlPlaceholders }
|
56
61
|
export { generateNiceColor }
|
@@ -66,15 +71,18 @@ export { isRecord }
|
|
66
71
|
export { isValidCssClassName }
|
67
72
|
export { memoize }
|
68
73
|
export { objectValidateFromPartial }
|
69
|
-
export {
|
74
|
+
export { random }
|
70
75
|
export { recordFormat }
|
76
|
+
export { regexp }
|
71
77
|
export { replaceAll }
|
72
78
|
export { responsiveHarmonics }
|
73
79
|
export { roundNumbers }
|
74
80
|
export { selectorToElement }
|
75
81
|
export { silentLog }
|
76
82
|
export { strToNodes }
|
83
|
+
export { stringMatches }
|
77
84
|
export { throttleDebounce }
|
85
|
+
export { toAlphanum }
|
78
86
|
export { transition }
|
79
87
|
export { wait }
|
80
88
|
export { dynamicCss }
|
package/package.json
CHANGED
@@ -0,0 +1,7 @@
|
|
1
|
+
type Filler<T = any> = (pos?: number) => T;
|
2
|
+
export declare function make<T>(filler: Filler<T>, length: number): T[];
|
3
|
+
export declare function findDuplicates<T>(arr: T[], stopAtFirst?: boolean): T[];
|
4
|
+
export declare const randomPickErrorSybol: unique symbol;
|
5
|
+
export type RandomPickErrorSymbol = typeof randomPickErrorSybol;
|
6
|
+
export default function randomPick<T>(arr: T[], exclude?: T[]): T | RandomPickErrorSymbol;
|
7
|
+
export {};
|
@@ -0,0 +1 @@
|
|
1
|
+
function f(e,t){return new Array(t).fill(null).map((r,o)=>e(o))}function s(e,t=!1){let r=new Set,o=new Set;for(let n of e){if(r.has(n)&&t)return[n];r.has(n)&&o.add(n),r.add(n)}return Array.from(o)}var a=Symbol();function i(e,t=[]){let r=[...e].filter(l=>!t.includes(l)),o=r.length;if(o===0)return a;let n=Math.floor(Math.random()*o);return r[n]}export{i as default,s as findDuplicates,f as make,a as randomPickErrorSybol};
|
@@ -0,0 +1 @@
|
|
1
|
+
function o(e){console.info(`\u2705 SUCCESS: "${e}"`)}function n(e){throw new Error(`\u{1F6AB} FAILURE: "${e}""`)}function s(e,r){if(Array.isArray(r))r.forEach((t,f)=>s(`${e} (${f})`,t));else if(typeof r=="function")try{r()===!1?n(e):o(e)}catch(t){n(`${t}`)}else r===!1?n(e):o(e)}export{s as default};
|
@@ -0,0 +1 @@
|
|
1
|
+
function o(e,t){return new Promise(async(a,n)=>{let c=setTimeout(()=>n(!1),t),l=await e();return clearTimeout(c),a(l)})}export{o as default};
|
@@ -0,0 +1,9 @@
|
|
1
|
+
export declare function random(bound1?: number): number | undefined;
|
2
|
+
export declare function random(bound1?: number, bound2?: number | undefined): number | undefined;
|
3
|
+
export default random;
|
4
|
+
export declare function randomInt(...args: Parameters<typeof random>): number | undefined;
|
5
|
+
export declare const hexChars: string[];
|
6
|
+
export declare function randomHexChar(): string;
|
7
|
+
export declare function randomHash(length?: number): string;
|
8
|
+
export declare function randomHashPattern(pattern: number[], joiner?: string): string;
|
9
|
+
export declare function randomUUID(): string;
|
@@ -0,0 +1 @@
|
|
1
|
+
function o(n=1,r){let e=r===void 0?0:n,t=r===void 0?n:r;if(e===t||e>t)return;let u=t-e;return Math.random()*u+e}var f=o;function c(...n){let r=o(...n);return r!==void 0?Math.floor(r):void 0}var d=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"];function a(){let n=Math.floor(Math.random()*16);return d[n]}function i(n=4){return new Array(n).fill(null).map(a).join("")}function m(n,r="-"){return n.map(i).join(r)}function s(){return m([8,4,4,4,12])}export{f as default,d as hexChars,o as random,i as randomHash,m as randomHashPattern,a as randomHexChar,c as randomInt,s as randomUUID};
|
@@ -0,0 +1,21 @@
|
|
1
|
+
export declare function mergeFlags(...flagStrs: string[]): string;
|
2
|
+
export declare function setFlags(regexp: RegExp, _flags: string): RegExp;
|
3
|
+
export declare function fromStart(regexp: RegExp, _flags?: string): RegExp;
|
4
|
+
export declare function toEnd(regexp: RegExp, _flags?: string): RegExp;
|
5
|
+
export declare function fromStartToEnd(regexp: RegExp, _flags?: string): RegExp;
|
6
|
+
export declare function stringStartsWith(string: string, _regexp: RegExp): boolean;
|
7
|
+
export declare function stringStartsWith(string: string, _regexp: RegExp, returnMatches: true): RegExpMatchArray | null;
|
8
|
+
export declare function stringStartsWith(string: string, _regexp: RegExp, returnMatches: false): boolean;
|
9
|
+
export declare function stringStartsWith(string: string, _regexp: RegExp, returnMatches: false, _flags: string): boolean;
|
10
|
+
export declare function stringStartsWith(string: string, _regexp: RegExp, returnMatches: true, _flags: string): RegExpMatchArray | null;
|
11
|
+
export declare function stringEndsWith(string: string, _regexp: RegExp): boolean;
|
12
|
+
export declare function stringEndsWith(string: string, _regexp: RegExp, returnMatches: true): RegExpMatchArray | null;
|
13
|
+
export declare function stringEndsWith(string: string, _regexp: RegExp, returnMatches: false): boolean;
|
14
|
+
export declare function stringEndsWith(string: string, _regexp: RegExp, returnMatches: false, _flags: string): boolean;
|
15
|
+
export declare function stringEndsWith(string: string, _regexp: RegExp, returnMatches: true, _flags: string): RegExpMatchArray | null;
|
16
|
+
export declare function stringIs(string: string, _regexp: RegExp): boolean;
|
17
|
+
export declare function stringIs(string: string, _regexp: RegExp, returnMatches: true): RegExpMatchArray | null;
|
18
|
+
export declare function stringIs(string: string, _regexp: RegExp, returnMatches: false): boolean;
|
19
|
+
export declare function stringIs(string: string, _regexp: RegExp, returnMatches: false, _flags: string): boolean;
|
20
|
+
export declare function stringIs(string: string, _regexp: RegExp, returnMatches: true, _flags: string): RegExpMatchArray | null;
|
21
|
+
export declare function stringsToRegexp(strings: string[]): RegExp;
|
@@ -0,0 +1 @@
|
|
1
|
+
function i(...t){let n=new Set;return t.forEach(e=>e.split("").forEach(r=>n.add(r))),[...n.values()].join("")}function M(t,n){let e=i(t.flags,n);return new RegExp(`${t.source}`,e)}function x(t,n="g"){let e=i(t.flags,n);return new RegExp(`^(${t.source})`,e)}function c(t,n="g"){let e=i(t.flags,n);return new RegExp(`(${t.source})$`,e)}function R(t,n="g"){let e=i(t.flags,n);return x(c(t,e),e)}function d(t,n,e=!0,r="g"){let s=x(n,r);return e?t.match(s):s.test(t)}function _(t,n,e=!0,r="g"){let s=c(n,r);return e?t.match(s):s.test(t)}function b(t,n,e=!1,r="g"){let s=R(n,r);return e?t.match(s):s.test(t)}function W(t){let n=a(t),e=f(n,!1);return new RegExp(e)}function l(t){return t.replace(/\s/igm,"\\s").replace(/\n/igm,"\\n").replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function a(t,n=new Map){return t.sort((r,s)=>r.length-s.length).forEach(r=>{let[s,...g]=r,E=g.length===0;if(s===void 0)return;let p=[...n.keys()].find(o=>new RegExp(`^(${l(o)})`).test(r)),u=p!==void 0?n.get(p)?.subRootsMap:void 0;if(p===void 0||u===void 0){let o=new Map;return a([g.join("")],o),n.set(s,{subRootsMap:o,isWordEnd:E})}a([g.join("")],u)}),n}function f(t,n){let e=[...t.entries()];if(e.length===0)return"";let r=e.map(([s,g])=>`${l(s)}${f(g.subRootsMap,g.isWordEnd)}`).join("|");return n?`(${r})?`:`(${r})`}export{x as fromStart,R as fromStartToEnd,i as mergeFlags,M as setFlags,_ as stringEndsWith,b as stringIs,d as stringStartsWith,W as stringsToRegexp,c as toEnd};
|
@@ -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 toAlphanum(string: string, replacer?: string): string;
|
@@ -0,0 +1 @@
|
|
1
|
+
function g(e,n=""){let t=e.replace(/[^a-z0-9]/igm,n);return n.length===0?t:t.replace(new RegExp(`${n}+`,"igm"),n)}export{g as default};
|
@@ -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};
|
@@ -1,3 +1,5 @@
|
|
1
1
|
export declare const forceExitEvents: string[];
|
2
2
|
export declare function beforeForcedExit(callback: () => void | Promise<void>): void;
|
3
3
|
export declare function beforeExit(callback: () => void | Promise<void>): void;
|
4
|
+
export declare function onExit(callback: () => void | Promise<void>): void;
|
5
|
+
export declare function anyway(callback: () => void | Promise<void>): void;
|
@@ -1 +1 @@
|
|
1
|
-
var i=["SIGINT","SIGTERM","uncaughtException"];function
|
1
|
+
var i=["SIGINT","SIGTERM","uncaughtException"];function t(o){i.forEach(e=>process.on(e,o))}function r(o){process.on("beforeExit",o)}function n(o){process.on("exit",o)}function s(o){t(o),r(o),n(o)}export{s as anyway,r as beforeExit,t as beforeForcedExit,i as forceExitEvents,n as onExit};
|
@@ -1 +0,0 @@
|
|
1
|
-
var f=Symbol();function a(t,e=[]){let r=[...t].filter(l=>!e.includes(l)),o=r.length;if(o===0)return f;let n=Math.floor(Math.random()*o);return r[n]}export{a as default,f as errorSybol};
|
@@ -1 +0,0 @@
|
|
1
|
-
export default function findDuplicatesInArray<T>(arr: T[], stopAtFirst?: boolean): T[];
|
@@ -1 +0,0 @@
|
|
1
|
-
function o(a,r=!1){let n=new Set,t=new Set;for(let e of a){if(n.has(e)&&r)return[e];n.has(e)&&t.add(e),n.add(e)}return Array.from(t)}export{o as default};
|
@@ -1,5 +0,0 @@
|
|
1
|
-
export declare const hexChars: string[];
|
2
|
-
export declare function randomHexChar(): string;
|
3
|
-
export declare function randomHash(length?: number): string;
|
4
|
-
export declare function randomHashPattern(pattern: number[], joiner?: string): string;
|
5
|
-
export default function randomUUID(): string;
|
@@ -1 +0,0 @@
|
|
1
|
-
var o=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"];function a(){let r=Math.floor(Math.random()*16);return o[r]}function e(r=4){return new Array(r).fill(null).map(n=>a()).join("")}function u(r,n="-"){return r.map(t=>e(t)).join(n)}function i(){return u([8,4,4,4,12])}export{i as default,o as hexChars,e as randomHash,u as randomHashPattern,a as randomHexChar};
|