@design-edito/tools 0.0.29 → 0.0.31

Sign up to get free protection for your applications and to get access to all the features.
Files changed (35) hide show
  1. package/chunks/{chunk-7MQW6NRB.js → chunk-BEZTX3QU.js} +1 -1
  2. package/chunks/chunk-XCKXCF4A.js +1 -0
  3. package/chunks/chunk-ZVJO36JU.js +1 -0
  4. package/index.js +14 -6
  5. package/package.json +1 -1
  6. package/utils/agnostic/array/index.d.ts +7 -0
  7. package/utils/agnostic/array/index.js +1 -0
  8. package/utils/agnostic/assert/index.d.ts +3 -0
  9. package/utils/agnostic/assert/index.js +1 -0
  10. package/utils/agnostic/await-timeout/index.d.ts +2 -0
  11. package/utils/agnostic/await-timeout/index.js +1 -0
  12. package/utils/agnostic/bem/index.js +1 -1
  13. package/utils/agnostic/cast/index.js +1 -1
  14. package/utils/agnostic/flatten-getters/index.js +1 -1
  15. package/utils/agnostic/is-falsy/index.d.ts +6 -2
  16. package/utils/agnostic/is-falsy/index.js +1 -1
  17. package/utils/agnostic/is-nullish/index.d.ts +4 -3
  18. package/utils/agnostic/is-nullish/index.js +1 -1
  19. package/utils/agnostic/random/index.d.ts +9 -0
  20. package/utils/agnostic/random/index.js +1 -0
  21. package/utils/agnostic/regexp/index.d.ts +21 -0
  22. package/utils/agnostic/regexp/index.js +1 -0
  23. package/utils/agnostic/throttle-debounce/index.js +1 -1
  24. package/utils/agnostic/to-alphanum/index.d.ts +1 -0
  25. package/utils/agnostic/to-alphanum/index.js +1 -0
  26. package/utils/node/process-exit/index.d.ts +5 -0
  27. package/utils/node/process-exit/index.js +1 -0
  28. package/chunks/chunk-PMZGSBLC.js +0 -1
  29. package/chunks/chunk-SL2VL6LV.js +0 -1
  30. package/utils/agnostic/array-random-pick/index.d.ts +0 -3
  31. package/utils/agnostic/array-random-pick/index.js +0 -1
  32. package/utils/agnostic/find-duplicates-in-array/index.d.ts +0 -1
  33. package/utils/agnostic/find-duplicates-in-array/index.js +0 -1
  34. package/utils/agnostic/random-uuid/index.d.ts +0 -5
  35. package/utils/agnostic/random-uuid/index.js +0 -1
@@ -1 +1 @@
1
- import{b as o}from"./chunk-SL2VL6LV.js";function f(r){return typeof r=="boolean"?r:typeof r=="string"?r.toLowerCase().trim()==="true":!o(r)}function e(r){return typeof r=="number"?r:typeof r=="string"?parseFloat(r):0}function c(r){return typeof r=="string"?r:String(r)}function p(r){return null}function u(r){return Array.isArray(r)?r:typeof r=="object"&&r!==null?Object.entries(r).map((t,n)=>({key:t,value:n})):[r]}function s(r){return u(r).map(n=>e(n))}function y(r){let t={};try{Object.keys(r).forEach(n=>{t[n]=r[n]})}catch{return t}return t}export{f as a,e as b,c,p as d,u as e,s as f,y as g};
1
+ import{d as o}from"./chunk-XCKXCF4A.js";function f(r){return typeof r=="boolean"?r:typeof r=="string"?r.toLowerCase().trim()==="true":!o(r)}function e(r){return typeof r=="number"?r:typeof r=="string"?parseFloat(r):0}function c(r){return typeof r=="string"?r:String(r)}function p(r){return null}function u(r){return Array.isArray(r)?r:typeof r=="object"&&r!==null?Object.entries(r).map((t,n)=>({key:t,value:n})):[r]}function s(r){return u(r).map(n=>e(n))}function y(r){let t={};try{Object.keys(r).forEach(n=>{t[n]=r[n]})}catch{return t}return t}export{f as a,e as b,c,p as d,u as e,s as f,y as g};
@@ -0,0 +1 @@
1
+ import{a as s}from"./chunk-ZVJO36JU.js";var t=[...s,!1,"",0,-0,NaN];typeof BigInt=="function"&&t.push(BigInt(0));function a(l){return t.includes(l)}function o(l){return!a(l)}var u=a;export{t as a,a as b,o as c,u as d};
@@ -0,0 +1 @@
1
+ var e=[null,void 0];function u(l){return e.includes(l)}function i(l){return!u(l)}var n=u;export{e as a,u as b,i as c,n as d};
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 arrayRandomPick from './utils/agnostic/array-random-pick/index.js'
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,8 +24,9 @@ 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 randomUuid from './utils/agnostic/random-uuid/index.js'
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'
@@ -32,6 +34,7 @@ import * as selectorToElement from './utils/agnostic/selector-to-element/index.j
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'
34
36
  import * as throttleDebounce from './utils/agnostic/throttle-debounce/index.js'
37
+ import * as toAlphanum from './utils/agnostic/to-alphanum/index.js'
35
38
  import * as transition from './utils/agnostic/transition/index.js'
36
39
  import * as wait from './utils/agnostic/wait/index.js'
37
40
  import * as dynamicCss from './utils/browser/dynamic-css/index.js'
@@ -39,17 +42,19 @@ import * as getCurrentDownlink from './utils/browser/get-current-downlink/index.
39
42
  import * as getNodeAncestors from './utils/browser/get-node-ancestors/index.js'
40
43
  import * as isInDirectory from './utils/node/is-in-directory/index.js'
41
44
  import * as listSubpaths from './utils/node/list-subpaths/index.js'
45
+ import * as processExit from './utils/node/process-exit/index.js'
42
46
  import * as readWriteFile from './utils/node/read-write-file/index.js'
43
47
  export { Comp }
44
48
  export { absoluteModulo }
45
- export { arrayRandomPick }
49
+ export { array }
50
+ export { assert }
51
+ export { awaitTimeout }
46
52
  export { bem }
47
53
  export { cast }
48
54
  export { charcodeString }
49
55
  export { clamp }
50
56
  export { clientsideHtmlSanitizer }
51
57
  export { crossenv }
52
- export { findDuplicatesInArray }
53
58
  export { flattenGetters }
54
59
  export { generateHtmlPlaceholders }
55
60
  export { generateNiceColor }
@@ -65,8 +70,9 @@ export { isRecord }
65
70
  export { isValidCssClassName }
66
71
  export { memoize }
67
72
  export { objectValidateFromPartial }
68
- export { randomUuid }
73
+ export { random }
69
74
  export { recordFormat }
75
+ export { regexp }
70
76
  export { replaceAll }
71
77
  export { responsiveHarmonics }
72
78
  export { roundNumbers }
@@ -74,6 +80,7 @@ export { selectorToElement }
74
80
  export { silentLog }
75
81
  export { strToNodes }
76
82
  export { throttleDebounce }
83
+ export { toAlphanum }
77
84
  export { transition }
78
85
  export { wait }
79
86
  export { dynamicCss }
@@ -81,4 +88,5 @@ export { getCurrentDownlink }
81
88
  export { getNodeAncestors }
82
89
  export { isInDirectory }
83
90
  export { listSubpaths }
91
+ export { processExit }
84
92
  export { readWriteFile }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@design-edito/tools",
3
- "version": "0.0.29",
3
+ "version": "0.0.31",
4
4
  "description": "",
5
5
  "author": "Maxime Fabas",
6
6
  "license": "ISC",
@@ -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,3 @@
1
+ type Assertion = (() => boolean) | boolean;
2
+ export default function assert(label: string, assertion: Assertion | Array<Assertion>): void;
3
+ export {};
@@ -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,2 @@
1
+ export type Callback<T> = () => T;
2
+ export default function awaitTimeout<T extends any>(callback: Callback<T>, timeoutMs: number): Promise<unknown>;
@@ -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};
@@ -1 +1 @@
1
- import{b as c}from"../../../chunks/chunk-WZBNXYN3.js";import{b as h}from"../../../chunks/chunk-SL2VL6LV.js";import"../../../chunks/chunk-PMZGSBLC.js";function r(e){let i=[];return typeof e=="string"?e.trim().split(/\s+/gm).forEach(t=>{c(t)&&i.push(t)}):Array.isArray(e)?e.forEach(t=>i.push(...r(t))):typeof e=="object"&&e!==null&&Object.entries(e).forEach(([t,s])=>{h(s)||i.push(...r(t))}),i}var n=r;var o=class e{constructor(){this.findBlockByName=this.findBlockByName.bind(this),this.addBlock=this.addBlock.bind(this),this.addElement=this.addElement.bind(this),this.addModifier=this.addModifier.bind(this),this.copy=this.copy.bind(this),this.block=this.block.bind(this),this.element=this.element.bind(this),this.modifier=this.modifier.bind(this),this.blk=this.blk.bind(this),this.elt=this.elt.bind(this),this.mod=this.mod.bind(this),this.cp=this.cp.bind(this),this.addSingleBlock=this.addSingleBlock.bind(this),this.addSingleElement=this.addSingleElement.bind(this),this.addSingleModifier=this.addSingleModifier.bind(this),this.setCurrentBlockByName=this.setCurrentBlockByName.bind(this),this.createBlockByName=this.createBlockByName.bind(this),this.getCurrentBlock=this.getCurrentBlock.bind(this)}addBlock(i){return n(i).forEach(this.addSingleBlock),this}addElement(i){return n(i).forEach(this.addSingleElement),this}addModifier(i){return this.getCurrentBlock()===void 0?this:(n(i).forEach(this.addSingleModifier),this)}copy(){let i=new e;return this.blocks.forEach(t=>{i.addBlock(t.name),t.modifiers.forEach(i.addModifier)}),i}block(i){return this.copy().addBlock(i)}element(i){return this.copy().addElement(i)}modifier(i){return this.copy().addModifier(i)}blk(i){return this.block(i)}elt(i){return this.element(i)}mod(i){return this.modifier(i)}cp(){return this.copy()}get value(){return this.blocks.map(i=>[i.name,...i.modifiers.map(t=>`${i.name}_${t}`)].join(" ")).join(" ")}get val(){return this.value}blocks=[];findBlockByName(i){return this.blocks.find(t=>t.name===i)}addSingleBlock(i){if(this.findBlockByName(i)!==void 0)this.setCurrentBlockByName(i);else{let t=this.createBlockByName(i);this.blocks.push(t)}return this}addSingleElement(i){let t=this.getCurrentBlock();return t===void 0?this.addBlock(i):t.name=t.name+"__"+i,this}addSingleModifier(i){let t=this.getCurrentBlock();return t!==void 0&&t.modifiers.push(i),this}setCurrentBlockByName(i){let t=this.findBlockByName(i);if(t!==void 0){let s=this.blocks.indexOf(t);this.blocks=[...this.blocks.slice(0,s),...this.blocks.slice(s+1),t]}return this}createBlockByName(i){return{name:i,modifiers:[]}}getCurrentBlock(){return this.blocks.slice(-1)[0]}},d=o;function l(e){let i=new d;return e instanceof d?e.copy():i.addBlock(e)}var y=l;export{d as BEM,l as bem,y as default,n as getNamesArr};
1
+ import{b as c}from"../../../chunks/chunk-WZBNXYN3.js";import{d as h}from"../../../chunks/chunk-XCKXCF4A.js";import"../../../chunks/chunk-ZVJO36JU.js";function r(e){let i=[];return typeof e=="string"?e.trim().split(/\s+/gm).forEach(t=>{c(t)&&i.push(t)}):Array.isArray(e)?e.forEach(t=>i.push(...r(t))):typeof e=="object"&&e!==null&&Object.entries(e).forEach(([t,s])=>{h(s)||i.push(...r(t))}),i}var n=r;var o=class e{constructor(){this.findBlockByName=this.findBlockByName.bind(this),this.addBlock=this.addBlock.bind(this),this.addElement=this.addElement.bind(this),this.addModifier=this.addModifier.bind(this),this.copy=this.copy.bind(this),this.block=this.block.bind(this),this.element=this.element.bind(this),this.modifier=this.modifier.bind(this),this.blk=this.blk.bind(this),this.elt=this.elt.bind(this),this.mod=this.mod.bind(this),this.cp=this.cp.bind(this),this.addSingleBlock=this.addSingleBlock.bind(this),this.addSingleElement=this.addSingleElement.bind(this),this.addSingleModifier=this.addSingleModifier.bind(this),this.setCurrentBlockByName=this.setCurrentBlockByName.bind(this),this.createBlockByName=this.createBlockByName.bind(this),this.getCurrentBlock=this.getCurrentBlock.bind(this)}addBlock(i){return n(i).forEach(this.addSingleBlock),this}addElement(i){return n(i).forEach(this.addSingleElement),this}addModifier(i){return this.getCurrentBlock()===void 0?this:(n(i).forEach(this.addSingleModifier),this)}copy(){let i=new e;return this.blocks.forEach(t=>{i.addBlock(t.name),t.modifiers.forEach(i.addModifier)}),i}block(i){return this.copy().addBlock(i)}element(i){return this.copy().addElement(i)}modifier(i){return this.copy().addModifier(i)}blk(i){return this.block(i)}elt(i){return this.element(i)}mod(i){return this.modifier(i)}cp(){return this.copy()}get value(){return this.blocks.map(i=>[i.name,...i.modifiers.map(t=>`${i.name}_${t}`)].join(" ")).join(" ")}get val(){return this.value}blocks=[];findBlockByName(i){return this.blocks.find(t=>t.name===i)}addSingleBlock(i){if(this.findBlockByName(i)!==void 0)this.setCurrentBlockByName(i);else{let t=this.createBlockByName(i);this.blocks.push(t)}return this}addSingleElement(i){let t=this.getCurrentBlock();return t===void 0?this.addBlock(i):t.name=t.name+"__"+i,this}addSingleModifier(i){let t=this.getCurrentBlock();return t!==void 0&&t.modifiers.push(i),this}setCurrentBlockByName(i){let t=this.findBlockByName(i);if(t!==void 0){let s=this.blocks.indexOf(t);this.blocks=[...this.blocks.slice(0,s),...this.blocks.slice(s+1),t]}return this}createBlockByName(i){return{name:i,modifiers:[]}}getCurrentBlock(){return this.blocks.slice(-1)[0]}},d=o;function l(e){let i=new d;return e instanceof d?e.copy():i.addBlock(e)}var y=l;export{d as BEM,l as bem,y as default,n as getNamesArr};
@@ -1 +1 @@
1
- import{a,b,c,d,e,f,g}from"../../../chunks/chunk-7MQW6NRB.js";import"../../../chunks/chunk-SL2VL6LV.js";import"../../../chunks/chunk-PMZGSBLC.js";export{e as toArray,a as toBoolean,d as toNull,b as toNumber,f as toNumberArr,g as toRecord,c as toString};
1
+ import{a,b,c,d,e,f,g}from"../../../chunks/chunk-BEZTX3QU.js";import"../../../chunks/chunk-XCKXCF4A.js";import"../../../chunks/chunk-ZVJO36JU.js";export{e as toArray,a as toBoolean,d as toNull,b as toNumber,f as toNumberArr,g as toRecord,c as toString};
@@ -1 +1 @@
1
- import{g as o}from"../../../chunks/chunk-7MQW6NRB.js";import"../../../chunks/chunk-SL2VL6LV.js";import"../../../chunks/chunk-PMZGSBLC.js";function f(r){try{let{entries:n,getOwnPropertyDescriptors:c}=Object,s=o(r),i=n(c(r)).filter(([t,u])=>typeof u.get=="function").map(([t])=>t),e={...s};return i.forEach(t=>{e[t]=r[t]}),e}catch{return{}}}export{f as default};
1
+ import{g as o}from"../../../chunks/chunk-BEZTX3QU.js";import"../../../chunks/chunk-XCKXCF4A.js";import"../../../chunks/chunk-ZVJO36JU.js";function f(r){try{let{entries:n,getOwnPropertyDescriptors:c}=Object,s=o(r),i=n(c(r)).filter(([t,u])=>typeof u.get=="function").map(([t])=>t),e={...s};return i.forEach(t=>{e[t]=r[t]}),e}catch{return{}}}export{f as default};
@@ -1,4 +1,8 @@
1
- declare const falsyValues: (string | number | bigint | boolean | null | undefined)[];
2
- declare const isFalsy: (val: any) => boolean;
1
+ import { Nullish } from '~/utils/agnostic/is-nullish';
2
+ export type Falsy = Nullish | false | '' | 0 | -0 | typeof NaN | 0n;
3
+ export type NotFalsy<T> = Exclude<T, Exclude<Falsy, number>>;
4
+ declare const falsyValues: Falsy[];
3
5
  export { falsyValues };
6
+ export declare function isFalsy<T>(val: T | Falsy): val is Falsy;
7
+ export declare function isNotFalsy<T>(val: T): val is NotFalsy<T>;
4
8
  export default isFalsy;
@@ -1 +1 @@
1
- import{a,b}from"../../../chunks/chunk-SL2VL6LV.js";import"../../../chunks/chunk-PMZGSBLC.js";export{b as default,a as falsyValues};
1
+ import{a,b,c,d}from"../../../chunks/chunk-XCKXCF4A.js";import"../../../chunks/chunk-ZVJO36JU.js";export{d as default,a as falsyValues,b as isFalsy,c as isNotFalsy};
@@ -1,4 +1,5 @@
1
- declare const nullishValues: (null | undefined)[];
2
- declare function isNullish(val: any): boolean;
3
- export { nullishValues };
1
+ export declare const nullishValues: (null | undefined)[];
2
+ export type Nullish = null | undefined;
3
+ export declare function isNullish<T>(val: T | Nullish): val is Nullish;
4
+ export declare function isNotNullish<T>(val: T): val is Exclude<T, Nullish>;
4
5
  export default isNullish;
@@ -1 +1 @@
1
- import{a,b}from"../../../chunks/chunk-PMZGSBLC.js";export{b as default,a as nullishValues};
1
+ import{a,b,c,d}from"../../../chunks/chunk-ZVJO36JU.js";export{d as default,c as isNotNullish,b as isNullish,a as nullishValues};
@@ -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};
@@ -1 +1 @@
1
- function T(s,c){let t=c,o=[],n=0,l,e=null;function r(){e!==null&&(clearTimeout(e),e=null);let a=Date.now(),i=n+t-a;e=setTimeout(()=>{e=null,l=s(...o),n=a},i)??null}function m(...a){let u=Date.now();return o=a,u-n>=c?(l=s(...o),n=u,{returnValue:l,lastExecutedOn:n,delayMs:t,isCached:!1}):(e===null&&r(),{returnValue:l,lastExecutedOn:n,delayMs:t,isCached:!0})}function d(a){t=a,e!==null&&r()}return{throttled:m,setDelay:d}}function y(s,c){let t=c,o=[],n=0,l=0,e,r=null;function m(){typeof r=="number"&&(window.clearTimeout(r),r=null);let u=Date.now(),x=n+t-u;r=setTimeout(()=>{r=null,e=s(...o),l=u},x)??null}function d(...u){let i=Date.now();return o=u,i-n>=t?(n=i,e=s(...o),l=i,{returnValue:e,lastExecutedOn:l,delayMs:t,isCached:!1}):(n=i,m(),{returnValue:e,lastExecutedOn:l,delayMs:t,isCached:!0})}function a(u){t=u,r!==null&&m()}return{debounced:d,setDelay:a}}export{y as debounce,T as throttle};
1
+ function T(s,c){let t=c,o=[],n=0,l,e=null;function r(){e!==null&&(clearTimeout(e),e=null);let a=Date.now(),i=n+t-a;e=setTimeout(()=>{e=null,l=s(...o),n=a},i)??null}function m(...a){let u=Date.now();return o=a,u-n>=c?(l=s(...o),n=u,{returnValue:l,lastExecutedOn:n,delayMs:t,isCached:!1}):(e===null&&r(),{returnValue:l,lastExecutedOn:n,delayMs:t,isCached:!0})}function d(a){t=a,e!==null&&r()}return{throttled:m,setDelay:d}}function y(s,c){let t=c,o=[],n=0,l=0,e,r=null;function m(){typeof r=="number"&&(clearTimeout(r),r=null);let u=Date.now(),x=n+t-u;r=setTimeout(()=>{r=null,e=s(...o),l=u},x)??null}function d(...u){let i=Date.now();return o=u,i-n>=t?(n=i,e=s(...o),l=i,{returnValue:e,lastExecutedOn:l,delayMs:t,isCached:!1}):(n=i,m(),{returnValue:e,lastExecutedOn:l,delayMs:t,isCached:!0})}function a(u){t=u,r!==null&&m()}return{debounced:d,setDelay:a}}export{y as debounce,T as throttle};
@@ -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};
@@ -0,0 +1,5 @@
1
+ export declare const forceExitEvents: string[];
2
+ export declare function beforeForcedExit(callback: () => void | Promise<void>): void;
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;
@@ -0,0 +1 @@
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 l=[null,void 0];function e(n){return l.includes(n)}var u=e;export{l as a,u as b};
@@ -1 +0,0 @@
1
- import{a as n}from"./chunk-PMZGSBLC.js";var e=[...n,!1,"",0,-0,NaN];window.BigInt!==void 0&&e.push(window.BigInt(0));var l=i=>e.includes(i);var o=l;export{e as a,o as b};
@@ -1,3 +0,0 @@
1
- export declare const errorSybol: unique symbol;
2
- export type ErrorSymbol = typeof errorSybol;
3
- export default function arrayRandomPick<T>(arr: T[], exclude?: T[]): T | ErrorSymbol;
@@ -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};