@rtorcato/js-common 2.8.2 → 4.0.0
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/AGENTS.md +114 -0
- package/CHANGELOG.md +23 -0
- package/CONTRIBUTORS.md +5 -0
- package/README.md +75 -26
- package/dist/abortController/index.d.ts +30 -0
- package/dist/abortController/index.d.ts.map +1 -1
- package/dist/arrays/arrays.test-d.js +1 -1
- package/dist/arrays/index.d.ts +0 -63
- package/dist/arrays/index.d.ts.map +1 -1
- package/dist/arrays/index.js +1 -1
- package/dist/boolean/index.d.ts +10 -33
- package/dist/boolean/index.d.ts.map +1 -1
- package/dist/boolean/index.js +1 -1
- package/dist/chunks/chunk-AVPQVYSA.js +1 -0
- package/dist/chunks/chunk-H7PB4TAW.js +1 -0
- package/dist/chunks/chunk-HUTZTT4Y.js +1 -0
- package/dist/chunks/chunk-RBXTRLWB.js +1 -0
- package/dist/chunks/chunk-UQBVI52L.js +1 -0
- package/dist/cli/catalog.js +131 -0
- package/dist/cli/cli.mjs +16 -109
- package/dist/colors/index.d.ts +23 -3
- package/dist/colors/index.d.ts.map +1 -1
- package/dist/console/index.d.ts +12 -0
- package/dist/console/index.d.ts.map +1 -1
- package/dist/crypto/index.d.ts +23 -0
- package/dist/crypto/index.d.ts.map +1 -1
- package/dist/currency/currencies.d.ts +1 -1
- package/dist/currency/currencies.d.ts.map +1 -1
- package/dist/currency/currencies.js +1 -1
- package/dist/currency/index.d.ts +0 -14
- package/dist/currency/index.d.ts.map +1 -1
- package/dist/currency/index.js +1 -1
- package/dist/date/index.d.ts +16 -0
- package/dist/date/index.d.ts.map +1 -1
- package/dist/datetime/index.d.ts +21 -9
- package/dist/datetime/index.d.ts.map +1 -1
- package/dist/datetime/index.js +1 -1
- package/dist/emails/index.d.ts +22 -0
- package/dist/emails/index.d.ts.map +1 -1
- package/dist/emails/index.js +1 -1
- package/dist/env/index.d.ts +24 -0
- package/dist/env/index.d.ts.map +1 -1
- package/dist/errors/index.d.ts +30 -2
- package/dist/errors/index.d.ts.map +1 -1
- package/dist/events/index.d.ts +25 -1
- package/dist/events/index.d.ts.map +1 -1
- package/dist/events/index.js +1 -1
- package/dist/fetch/index.d.ts +25 -0
- package/dist/fetch/index.d.ts.map +1 -1
- package/dist/file/index.d.ts +20 -0
- package/dist/file/index.d.ts.map +1 -1
- package/dist/functions/functions.test-d.d.ts +2 -0
- package/dist/functions/functions.test-d.d.ts.map +1 -0
- package/dist/functions/functions.test-d.js +1 -0
- package/dist/functions/index.d.ts +32 -2
- package/dist/functions/index.d.ts.map +1 -1
- package/dist/functions/index.js +1 -1
- package/dist/geometry/index.d.ts +21 -0
- package/dist/geometry/index.d.ts.map +1 -1
- package/dist/html/index.d.ts +38 -0
- package/dist/html/index.d.ts.map +1 -1
- package/dist/html/index.js +1 -1
- package/dist/i18n/index.d.ts +23 -7
- package/dist/i18n/index.d.ts.map +1 -1
- package/dist/i18n/index.js +1 -1
- package/dist/json/index.d.ts +27 -7
- package/dist/json/index.d.ts.map +1 -1
- package/dist/json/index.js +1 -1
- package/dist/logger/index.d.ts +16 -1
- package/dist/logger/index.d.ts.map +1 -1
- package/dist/logger/index.js +1 -1
- package/dist/logging/index.d.ts +19 -0
- package/dist/logging/index.d.ts.map +1 -1
- package/dist/maps/index.d.ts +21 -0
- package/dist/maps/index.d.ts.map +1 -1
- package/dist/mime-types/db.d.ts +5 -922
- package/dist/mime-types/db.d.ts.map +1 -1
- package/dist/mime-types/db.js +1 -1
- package/dist/mime-types/index.d.ts +20 -0
- package/dist/mime-types/index.d.ts.map +1 -1
- package/dist/mime-types/index.js +1 -1
- package/dist/node/index.d.ts +0 -9
- package/dist/node/index.d.ts.map +1 -1
- package/dist/node/index.js +1 -1
- package/dist/numbers/index.d.ts +28 -36
- package/dist/numbers/index.d.ts.map +1 -1
- package/dist/numbers/index.js +1 -1
- package/dist/objects/index.d.ts +23 -7
- package/dist/objects/index.d.ts.map +1 -1
- package/dist/objects/index.js +1 -1
- package/dist/objects/objects.test-d.js +1 -1
- package/dist/os/index.d.ts +18 -0
- package/dist/os/index.d.ts.map +1 -1
- package/dist/process/index.d.ts +18 -0
- package/dist/process/index.d.ts.map +1 -1
- package/dist/promises/index.d.ts +21 -26
- package/dist/promises/index.d.ts.map +1 -1
- package/dist/promises/index.js +1 -1
- package/dist/promises/promises.test-d.d.ts +2 -0
- package/dist/promises/promises.test-d.d.ts.map +1 -0
- package/dist/promises/promises.test-d.js +1 -0
- package/dist/random/index.d.ts +21 -0
- package/dist/random/index.d.ts.map +1 -1
- package/dist/regex/index.d.ts +23 -0
- package/dist/regex/index.d.ts.map +1 -1
- package/dist/security/index.d.ts +36 -4
- package/dist/security/index.d.ts.map +1 -1
- package/dist/security/index.js +1 -1
- package/dist/sleep/index.d.ts +20 -0
- package/dist/sleep/index.d.ts.map +1 -1
- package/dist/strings/index.d.ts +0 -75
- package/dist/strings/index.d.ts.map +1 -1
- package/dist/strings/index.js +1 -1
- package/dist/system/index.d.ts +18 -0
- package/dist/system/index.d.ts.map +1 -1
- package/dist/time/index.d.ts +23 -4
- package/dist/time/index.d.ts.map +1 -1
- package/dist/try/index.d.ts +52 -1
- package/dist/try/index.d.ts.map +1 -1
- package/dist/try/index.js +1 -1
- package/dist/try/trycatch.test-d.js +1 -1
- package/dist/types/index.d.ts +0 -1
- package/dist/url/index.d.ts +23 -0
- package/dist/url/index.d.ts.map +1 -1
- package/dist/url/index.js +1 -1
- package/dist/uuid/index.d.ts +5 -5
- package/dist/uuid/index.d.ts.map +1 -1
- package/dist/uuid/index.js +1 -1
- package/dist/validation/index.d.ts +25 -0
- package/dist/validation/index.d.ts.map +1 -1
- package/dist/validation/index.js +1 -1
- package/package.json +23 -37
- package/dist/chunks/chunk-5IA77ERW.js +0 -1
- package/dist/chunks/chunk-6J7HIWG6.js +0 -1
- package/dist/chunks/chunk-ARW46OJS.js +0 -1
- package/dist/chunks/chunk-W72HFHZY.js +0 -1
- package/dist/emails/banned/index.d.ts +0 -9
- package/dist/emails/banned/index.d.ts.map +0 -1
- package/dist/formatting/index.d.ts +0 -40
- package/dist/formatting/index.d.ts.map +0 -1
- package/dist/formatting/index.js +0 -1
- package/dist/interval/index.d.ts +0 -13
- package/dist/interval/index.d.ts.map +0 -1
- package/dist/interval/index.js +0 -1
- package/dist/logger/logger.d.ts +0 -7
- package/dist/logger/logger.d.ts.map +0 -1
- package/dist/logger/logger.js +0 -1
- package/dist/math/index.d.ts +0 -37
- package/dist/math/index.d.ts.map +0 -1
- package/dist/math/index.js +0 -1
- package/dist/sets/index.d.ts +0 -48
- package/dist/sets/index.d.ts.map +0 -1
- package/dist/sets/index.js +0 -1
- package/dist/try/attempt.d.ts +0 -8
- package/dist/try/attempt.d.ts.map +0 -1
- package/dist/try/attempt.js +0 -1
- package/dist/try/trycatch.d.ts +0 -29
- package/dist/try/trycatch.d.ts.map +0 -1
- package/dist/try/trycatch.js +0 -1
- /package/dist/chunks/{chunk-XAQ7VMV4.js → chunk-J4C2KNK5.js} +0 -0
package/dist/sleep/index.d.ts
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Returns a promise that resolves after the specified number of milliseconds.
|
|
3
|
+
*
|
|
4
|
+
* @example
|
|
5
|
+
* ```typescript
|
|
6
|
+
* const started = Date.now()
|
|
7
|
+
* await sleep(200)
|
|
8
|
+
* Date.now() - started >= 200 // true
|
|
9
|
+
* ```
|
|
10
|
+
*
|
|
3
11
|
* @param ms Number of milliseconds to sleep.
|
|
4
12
|
* @returns Promise that resolves after ms milliseconds.
|
|
5
13
|
*/
|
|
@@ -7,11 +15,23 @@ export declare const sleep: (ms: number) => Promise<void>;
|
|
|
7
15
|
/**
|
|
8
16
|
* Blocks the event loop for the specified number of milliseconds (synchronous sleep).
|
|
9
17
|
* Not recommended for production use, but useful for scripts or tests.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```typescript
|
|
21
|
+
* sleepSync(50) // blocks the event loop for ~50ms, no await needed
|
|
22
|
+
* ```
|
|
23
|
+
*
|
|
10
24
|
* @param ms Number of milliseconds to block.
|
|
11
25
|
*/
|
|
12
26
|
export declare function sleepSync(ms: number): void;
|
|
13
27
|
/**
|
|
14
28
|
* Returns a promise that resolves after a random delay between min and max milliseconds.
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```typescript
|
|
32
|
+
* await sleepRandom(100, 500) // resolves after 100–500ms — handy for jittered retries
|
|
33
|
+
* ```
|
|
34
|
+
*
|
|
15
35
|
* @param min Minimum milliseconds to sleep.
|
|
16
36
|
* @param max Maximum milliseconds to sleep.
|
|
17
37
|
* @returns Promise that resolves after a random delay.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/sleep/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/sleep/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,KAAK,GAAI,IAAI,MAAM,KAAG,OAAO,CAAC,IAAI,CACG,CAAA;AAElD;;;;;;;;;;GAUG;AACH,wBAAgB,SAAS,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CAG1C;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAGnE;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAU9E"}
|
package/dist/strings/index.d.ts
CHANGED
|
@@ -79,42 +79,6 @@ export declare function snakeCase(str: string): string;
|
|
|
79
79
|
* @returns The truncated string.
|
|
80
80
|
*/
|
|
81
81
|
export declare function truncate(str: string, maxLength: number): string;
|
|
82
|
-
/**
|
|
83
|
-
* Pads the start of a string to a given length.
|
|
84
|
-
* @param str The string to pad.
|
|
85
|
-
* @param targetLength The target length.
|
|
86
|
-
* @param padString The string to pad with.
|
|
87
|
-
* @returns The padded string.
|
|
88
|
-
*/
|
|
89
|
-
export declare function padStart(str: string, targetLength: number, padString?: string): string;
|
|
90
|
-
/**
|
|
91
|
-
* Pads the end of a string to a given length.
|
|
92
|
-
* @param str The string to pad.
|
|
93
|
-
* @param targetLength The target length.
|
|
94
|
-
* @param padString The string to pad with.
|
|
95
|
-
* @returns The padded string.
|
|
96
|
-
*/
|
|
97
|
-
export declare function padEnd(str: string, targetLength: number, padString?: string): string;
|
|
98
|
-
/**
|
|
99
|
-
* get a random string
|
|
100
|
-
* var rStr= randomString(32,'0123456789abcdefghijklmn');
|
|
101
|
-
* @param {number} length
|
|
102
|
-
* @param {string} chars
|
|
103
|
-
*/
|
|
104
|
-
export declare const randomString: (length: number, chars: string) => string;
|
|
105
|
-
/**
|
|
106
|
-
* replace all items in a string using regex
|
|
107
|
-
* @param {string} str
|
|
108
|
-
* @param {string} search
|
|
109
|
-
* @param {string} replacement
|
|
110
|
-
*/
|
|
111
|
-
export declare const replaceString: (str: string, search: string, replacement: string) => string;
|
|
112
|
-
/**
|
|
113
|
-
* Sanitizes a string by removing script tags and event handlers.
|
|
114
|
-
* @param str The string to sanitize.
|
|
115
|
-
* @returns The sanitized string.
|
|
116
|
-
*/
|
|
117
|
-
export declare function sanitizeString(str: string): string;
|
|
118
82
|
/**
|
|
119
83
|
* Reverses a string.
|
|
120
84
|
*
|
|
@@ -171,45 +135,6 @@ export declare function words(str: string): string[];
|
|
|
171
135
|
* @returns The word count
|
|
172
136
|
*/
|
|
173
137
|
export declare function wordCount(str: string): number;
|
|
174
|
-
/**
|
|
175
|
-
* Escapes HTML special characters to prevent XSS.
|
|
176
|
-
*
|
|
177
|
-
* @example
|
|
178
|
-
* ```typescript
|
|
179
|
-
* escapeHtml('<div>Hello & "World"</div>') // '<div>Hello & "World"</div>'
|
|
180
|
-
* escapeHtml("It's <script>") // "It's <script>"
|
|
181
|
-
* ```
|
|
182
|
-
*
|
|
183
|
-
* @param str The string to escape
|
|
184
|
-
* @returns The escaped string
|
|
185
|
-
*/
|
|
186
|
-
export declare function escapeHtml(str: string): string;
|
|
187
|
-
/**
|
|
188
|
-
* Unescapes HTML entities back to their original characters.
|
|
189
|
-
*
|
|
190
|
-
* @example
|
|
191
|
-
* ```typescript
|
|
192
|
-
* unescapeHtml('<div>') // '<div>'
|
|
193
|
-
* unescapeHtml('&"'') // '&"''
|
|
194
|
-
* ```
|
|
195
|
-
*
|
|
196
|
-
* @param str The string to unescape
|
|
197
|
-
* @returns The unescaped string
|
|
198
|
-
*/
|
|
199
|
-
export declare function unescapeHtml(str: string): string;
|
|
200
|
-
/**
|
|
201
|
-
* Removes all HTML tags from a string.
|
|
202
|
-
*
|
|
203
|
-
* @example
|
|
204
|
-
* ```typescript
|
|
205
|
-
* stripHtml('<p>Hello <b>World</b></p>') // 'Hello World'
|
|
206
|
-
* stripHtml('<script>alert(1)</script>Text') // 'Text'
|
|
207
|
-
* ```
|
|
208
|
-
*
|
|
209
|
-
* @param str The string to strip HTML from
|
|
210
|
-
* @returns The string without HTML tags
|
|
211
|
-
*/
|
|
212
|
-
export declare function stripHtml(str: string): string;
|
|
213
138
|
/**
|
|
214
139
|
* Returns the plural form of a word based on count.
|
|
215
140
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/strings/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAE7C;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAE9C;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAI7C;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAK7C;AAED;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAK7C;AAED;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAE/D;AAED
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/strings/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAE7C;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAE9C;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAI7C;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAK7C;AAED;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAK7C;AAED;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAE/D;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAE3C;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAU3C;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,KAAK,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,CAO3C;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAI7C;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAG9E;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAmB9C;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAE5C;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,SAAM,GAAG,MAAM,CAOhF;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAI3E"}
|
package/dist/strings/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import"../chunks/chunk-ANN5UYCF.js";function s(
|
|
1
|
+
import"../chunks/chunk-ANN5UYCF.js";function s(e){return e.replace(/\w\S*/g,r=>r.charAt(0).toUpperCase()+r.slice(1).toLowerCase())}function o(e){return e.length===0?"":(e[0]?.toUpperCase()??"")+e.slice(1)}function a(e){return e.replace(/[-_\s]+(.)?/g,(r,t)=>t?t.toUpperCase():"").replace(/^(.)/,r=>r.toLowerCase())}function g(e){return e.replace(/([a-z])([A-Z])/g,"$1-$2").replace(/[_\s]+/g,"-").toLowerCase()}function c(e){return e.replace(/([a-z])([A-Z])/g,"$1_$2").replace(/[-\s]+/g,"_").toLowerCase()}function u(e,r){return e.length>r?`${e.slice(0,r-1)}\u2026`:e}function l(e){return[...e].reverse().join("")}function p(e){return e.normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase().trim().replace(/[^a-z0-9\s-]/g,"").replace(/[\s_]+/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"")}function f(e){return e.replace(/([a-z])([A-Z])/g,"$1 $2").replace(/[-_]+/g," ").trim().split(/\s+/).filter(Boolean)}function $(e){let r=e.trim();return r===""?0:r.split(/\s+/).length}function x(e,r,t){return r===1?e:t??`${e}s`}function C(e){let r=Math.abs(e),t=r%100,n=r%10;if(t>=11&&t<=13)return`${e}th`;switch(n){case 1:return`${e}st`;case 2:return`${e}nd`;case 3:return`${e}rd`;default:return`${e}th`}}function b(e){return e.trim().length===0}function w(e,r,t,n="*"){if(r<0&&(r=0),t>e.length&&(t=e.length),r>=t)return e;let i=n.repeat(t-r);return e.slice(0,r)+i+e.slice(t)}function h(e,r){return e.replace(/\$\{(\w+)\}/g,(t,n)=>Object.hasOwn(r,n)?String(r[n]):t)}export{a as camelCase,o as capitalize,b as isBlank,g as kebabCase,w as mask,C as ordinalize,x as pluralize,l as reverse,p as slugify,c as snakeCase,h as template,s as titleCase,u as truncate,$ as wordCount,f as words};
|
package/dist/system/index.d.ts
CHANGED
|
@@ -1,15 +1,33 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Checks if the current OS is macOS.
|
|
3
|
+
*
|
|
4
|
+
* @example
|
|
5
|
+
* ```typescript
|
|
6
|
+
* isMacOs() // true on macOS (via process.platform in Node, userAgent in the browser)
|
|
7
|
+
* ```
|
|
8
|
+
*
|
|
3
9
|
* @returns {boolean} True if macOS, false otherwise.
|
|
4
10
|
*/
|
|
5
11
|
export declare function isMacOs(): boolean;
|
|
6
12
|
/**
|
|
7
13
|
* Checks if the current OS is Windows.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```typescript
|
|
17
|
+
* isWindows() // true when process.platform === 'win32'
|
|
18
|
+
* ```
|
|
19
|
+
*
|
|
8
20
|
* @returns {boolean} True if Windows, false otherwise.
|
|
9
21
|
*/
|
|
10
22
|
export declare function isWindows(): boolean;
|
|
11
23
|
/**
|
|
12
24
|
* Checks if the current OS is Linux.
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* ```typescript
|
|
28
|
+
* isLinux() // true when process.platform === 'linux'
|
|
29
|
+
* ```
|
|
30
|
+
*
|
|
13
31
|
* @returns {boolean} True if Linux, false otherwise.
|
|
14
32
|
*/
|
|
15
33
|
export declare function isLinux(): boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/system/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/system/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,wBAAgB,OAAO,IAAI,OAAO,CAQjC;AAED;;;;;;;;;GASG;AACH,wBAAgB,SAAS,IAAI,OAAO,CAQnC;AAED;;;;;;;;;GASG;AACH,wBAAgB,OAAO,IAAI,OAAO,CAQjC;AAED;;;GAGG;AACH,wBAAgB,KAAK,IAAI,OAAO,CAK/B;AAED;;;GAGG;AACH,wBAAgB,SAAS,IAAI,OAAO,CAKnC;AAED;;;GAGG;AACH,wBAAgB,WAAW,IAAI,MAAM,CAOpC;AAED;;;GAGG;AACH,wBAAgB,aAAa,IAAI,OAAO,CAMvC"}
|
package/dist/time/index.d.ts
CHANGED
|
@@ -1,16 +1,35 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Returns the current time as HH:MM:SS string.
|
|
2
|
+
* Returns the current time as an `HH:MM:SS` string.
|
|
3
|
+
*
|
|
4
|
+
* @example
|
|
5
|
+
* ```typescript
|
|
6
|
+
* nowTime() // '14:03:27'
|
|
7
|
+
* ```
|
|
8
|
+
*
|
|
3
9
|
* @returns {string}
|
|
4
10
|
*/
|
|
5
11
|
export declare function nowTime(): string;
|
|
6
12
|
/**
|
|
7
|
-
* Parses a time string (HH:MM or HH:MM:SS) into a Date object (today's date).
|
|
13
|
+
* Parses a time string (`HH:MM` or `HH:MM:SS`) into a Date object (today's date).
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```typescript
|
|
17
|
+
* parseTime('09:30').getHours() // 9
|
|
18
|
+
* parseTime('09:30:15').getSeconds() // 15
|
|
19
|
+
* ```
|
|
20
|
+
*
|
|
8
21
|
* @param timeStr The time string.
|
|
9
22
|
* @returns {Date}
|
|
10
23
|
*/
|
|
11
24
|
export declare function parseTime(timeStr: string): Date;
|
|
12
25
|
/**
|
|
13
|
-
* Formats a Date object as HH:MM:SS
|
|
26
|
+
* Formats a Date object as `HH:MM:SS`.
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```typescript
|
|
30
|
+
* formatTime(new Date(2026, 7, 11, 9, 5, 3)) // '09:05:03'
|
|
31
|
+
* ```
|
|
32
|
+
*
|
|
14
33
|
* @param date The Date object.
|
|
15
34
|
* @returns {string}
|
|
16
35
|
*/
|
|
@@ -23,7 +42,7 @@ export declare function formatTime(date: Date): string;
|
|
|
23
42
|
*/
|
|
24
43
|
export declare function secondsBetween(t1: string | Date, t2: string | Date): number;
|
|
25
44
|
/**
|
|
26
|
-
* Pads a number to two digits (e.g
|
|
45
|
+
* Pads a number to two digits (e.g. `5` → `'05'`).
|
|
27
46
|
* @param n The number.
|
|
28
47
|
* @returns {string}
|
|
29
48
|
*/
|
package/dist/time/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/time/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/time/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,wBAAgB,OAAO,IAAI,MAAM,CAGhC;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAK/C;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,CAE7C;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,EAAE,EAAE,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,CAI3E;AAED;;;;GAIG;AACH,wBAAgB,IAAI,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAEtC;AAED;;;GAGG;AACH,wBAAgB,YAAY,IAAI,MAAM,CAGrC"}
|
package/dist/try/index.d.ts
CHANGED
|
@@ -1,2 +1,53 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Successful branch of a `Result` — carries the value and a `null` error.
|
|
3
|
+
*/
|
|
4
|
+
export type Success<T> = {
|
|
5
|
+
data: T;
|
|
6
|
+
error: null;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Error branch of a `Result` — carries a `null` value and an error of type `E`.
|
|
10
|
+
*/
|
|
11
|
+
export type Failure<E> = {
|
|
12
|
+
data: null;
|
|
13
|
+
error: E;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Go-style discriminated union representing either a `Success<T>` or a `Failure<E>`,
|
|
17
|
+
* for async code that prefers explicit error returns over thrown exceptions.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```typescript
|
|
21
|
+
* const ok: Result<number> = { data: 42, error: null }
|
|
22
|
+
* const bad: Result<number> = { data: null, error: new Error('boom') }
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
export type Result<T, E = Error> = Success<T> | Failure<E>;
|
|
26
|
+
/**
|
|
27
|
+
* Type guard that narrows a `Result` to its `Success` branch when the error is `null`.
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```typescript
|
|
31
|
+
* const result = await tryCatch(async () => 42)
|
|
32
|
+
* if (isSuccess(result)) {
|
|
33
|
+
* result.data // 42, narrowed to number
|
|
34
|
+
* }
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
export declare function isSuccess<T, E>(result: Result<T, E>): result is Success<T>;
|
|
38
|
+
/**
|
|
39
|
+
* Run an async function and capture any thrown error into a `Result`, eliminating
|
|
40
|
+
* try/catch at the call site.
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* ```typescript
|
|
44
|
+
* const { data, error } = await tryCatch(() => fetch('/api/user').then((r) => r.json()))
|
|
45
|
+
* // success: { data: { id: 1 }, error: null }
|
|
46
|
+
* // failure: { data: null, error: Error }
|
|
47
|
+
*
|
|
48
|
+
* if (error) return console.error(error)
|
|
49
|
+
* console.log(data.id)
|
|
50
|
+
* ```
|
|
51
|
+
*/
|
|
52
|
+
export declare function tryCatch<T, E = Error>(fn: () => Promise<T>): Promise<Result<T, E>>;
|
|
2
53
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/try/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/try/index.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/try/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,MAAM,OAAO,CAAC,CAAC,IAAI;IAAE,IAAI,EAAE,CAAC,CAAC;IAAC,KAAK,EAAE,IAAI,CAAA;CAAE,CAAA;AAEjD;;GAEG;AACH,MAAM,MAAM,OAAO,CAAC,CAAC,IAAI;IAAE,IAAI,EAAE,IAAI,CAAC;IAAC,KAAK,EAAE,CAAC,CAAA;CAAE,CAAA;AAEjD;;;;;;;;;GASG;AACH,MAAM,MAAM,MAAM,CAAC,CAAC,EAAE,CAAC,GAAG,KAAK,IAAI,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAA;AAE1D;;;;;;;;;;GAUG;AACH,wBAAgB,SAAS,CAAC,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,MAAM,IAAI,OAAO,CAAC,CAAC,CAAC,CAE1E;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAsB,QAAQ,CAAC,CAAC,EAAE,CAAC,GAAG,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAOxF"}
|
package/dist/try/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a
|
|
1
|
+
import{a,b}from"../chunks/chunk-J4C2KNK5.js";import"../chunks/chunk-ANN5UYCF.js";export{a as isSuccess,b as tryCatch};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as u,b as t}from"../chunks/chunk-
|
|
1
|
+
import{a as u,b as t}from"../chunks/chunk-J4C2KNK5.js";import"../chunks/chunk-ANN5UYCF.js";import{describe as l,expectTypeOf as e,it as s}from"vitest";l("try \u2014 types",()=>{s("Result<T,E> is the union of Success<T> and Failure<E>",()=>{e().toEqualTypeOf(),e().toEqualTypeOf()}),s("isSuccess narrows Result to Success in the true branch",()=>{let r={data:1,error:null};u(r)?(e(r).toEqualTypeOf(),e(r.data).toEqualTypeOf(),e(r.error).toEqualTypeOf()):e(r).toEqualTypeOf()}),s("tryCatch returns Promise<Result<T, E>> with the resolved type",async()=>{let r=t(async()=>42);e(r).toEqualTypeOf();let o=t(async()=>"x");e(o).toEqualTypeOf()})});
|
package/dist/types/index.d.ts
CHANGED
package/dist/url/index.d.ts
CHANGED
|
@@ -1,17 +1,40 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Checks if a string is a valid URL.
|
|
3
|
+
*
|
|
4
|
+
* @example
|
|
5
|
+
* ```typescript
|
|
6
|
+
* isValidUrl('https://example.com/a?b=1') // true
|
|
7
|
+
* isValidUrl('example.com') // false (no protocol)
|
|
8
|
+
* ```
|
|
9
|
+
*
|
|
3
10
|
* @param str The string to check.
|
|
4
11
|
* @returns True if valid URL, false otherwise.
|
|
5
12
|
*/
|
|
6
13
|
export declare function isValidUrl(str: string): boolean;
|
|
7
14
|
/**
|
|
8
15
|
* Gets the query parameters from a URL as an object.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```typescript
|
|
19
|
+
* getQueryParams('https://example.com/s?q=cats&page=2') // { q: 'cats', page: '2' }
|
|
20
|
+
* getQueryParams('not a url') // {}
|
|
21
|
+
* ```
|
|
22
|
+
*
|
|
9
23
|
* @param url The URL string.
|
|
10
24
|
* @returns An object of query parameters.
|
|
11
25
|
*/
|
|
12
26
|
export declare function getQueryParams(url: string): Record<string, string>;
|
|
13
27
|
/**
|
|
14
28
|
* Adds or updates a query parameter in a URL.
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```typescript
|
|
32
|
+
* setQueryParam('https://example.com/s?q=cats', 'page', '2')
|
|
33
|
+
* // 'https://example.com/s?q=cats&page=2'
|
|
34
|
+
* setQueryParam('https://example.com/s?q=cats', 'q', 'dogs')
|
|
35
|
+
* // 'https://example.com/s?q=dogs'
|
|
36
|
+
* ```
|
|
37
|
+
*
|
|
15
38
|
* @param url The URL string.
|
|
16
39
|
* @param key The query parameter key.
|
|
17
40
|
* @param value The query parameter value.
|
package/dist/url/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/url/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/url/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAO/C;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAWlE;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAQ7E;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAQjE;AAgBD;;;;GAIG;AACH,wBAAgB,OAAO,CAAC,GAAG,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM,CAKlD;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAM/C"}
|
package/dist/url/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import"../chunks/chunk-ANN5UYCF.js";function
|
|
1
|
+
import"../chunks/chunk-ANN5UYCF.js";function o(r){try{return new URL(r),!0}catch{return!1}}function a(r){try{let e=new URL(r).searchParams,t={};return e.forEach((n,s)=>{t[s]=n}),t}catch{return{}}}function c(r,e,t){try{let n=new URL(r);return n.searchParams.set(e,t),n.toString()}catch{return r}}function g(r,e){try{let t=new URL(r);return t.searchParams.delete(e),t.toString()}catch{return r}}function i(r,e){let t=0,n=r.length;if(e)for(;t<n&&r[t]==="/";)t++;for(;n>t&&r[n-1]==="/";)n--;return r.slice(t,n)}function u(...r){return r.map((e,t)=>i(e,t>0)).filter(Boolean).join("/")}function l(r){try{return new URL(r).hostname}catch{return""}}export{l as getHostname,a as getQueryParams,o as isValidUrl,u as joinUrl,g as removeQueryParam,c as setQueryParam};
|
package/dist/uuid/index.d.ts
CHANGED
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Generates a UUID v4 string.
|
|
3
|
-
* @returns {string} A new UUID v4 string.
|
|
4
|
-
*/
|
|
5
|
-
export declare const getUUID: () => string;
|
|
6
1
|
/**
|
|
7
2
|
* Generates a UUID v7 string (time-ordered).
|
|
8
3
|
* UUID v7 embeds a Unix timestamp, making them sortable and ideal for database primary keys.
|
|
@@ -17,6 +12,11 @@ export declare const getUUIDv7: () => string;
|
|
|
17
12
|
/**
|
|
18
13
|
* Generates a short UUID string using short-uuid.
|
|
19
14
|
* @returns {string} A new short UUID string.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```typescript
|
|
18
|
+
* getShortUUID() // 'mhvXdrZT4jP5T8vBxuvm75'
|
|
19
|
+
* ```
|
|
20
20
|
*/
|
|
21
21
|
export declare const getShortUUID: () => string;
|
|
22
22
|
/**
|
package/dist/uuid/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/uuid/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/uuid/index.ts"],"names":[],"mappings":"AAYA;;;;;;;;;GASG;AACH,eAAO,MAAM,SAAS,QAAO,MAE5B,CAAA;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,YAAY,QAAO,MAE/B,CAAA;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,WAAW,GAAI,MAAM,MAAM,KAAG,MAE1C,CAAA;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,aAAa,GAAI,OAAO,MAAM,KAAG,MAE7C,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,MAAM,GAAI,IAAI,MAAM,KAAG,OAA2B,CAAA;AAE/D;;;;GAIG;AACH,eAAO,MAAM,QAAQ,GAAI,IAAI,MAAM,KAAG,OAAoD,CAAA;AAE1F;;;;;;;;;;GAUG;AACH,eAAO,MAAM,SAAS,GAAI,IAAI,MAAM,KAAG,OAA0B,CAAA;AAEjE;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,cAAc,GAAI,IAAI,MAAM,KAAG,MAK3C,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,UAAU,QAAO,MAAkB,CAAA;AAEhD;;;;GAIG;AACH,eAAO,MAAM,WAAW,GAAI,IAAI,MAAM,KAAG,UAA2B,CAAA;AAEpE;;;;GAIG;AACH,eAAO,MAAM,WAAW,GAAI,OAAO,UAAU,KAAG,MAA8B,CAAA"}
|
package/dist/uuid/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import"../chunks/chunk-ANN5UYCF.js";import{createTranslator as e}from"short-uuid";import{NIL as n,parse as i,stringify as U,validate as r,version as s,
|
|
1
|
+
import"../chunks/chunk-ANN5UYCF.js";import{createTranslator as e}from"short-uuid";import{NIL as n,parse as i,stringify as U,validate as r,version as s,v7 as a}from"uuid";var o=e(),I=()=>a(),p=()=>o.generate(),D=t=>o.fromUUID(t),c=t=>o.toUUID(t),x=t=>r(t),l=t=>r(t)&&s(t)===4,d=t=>t===n,f=t=>{if(!r(t))throw new Error("Invalid UUID");return s(t)},m=()=>n,v=t=>i(t),y=t=>U(t);export{y as bytesToUUID,c as fromShortUUID,m as getNilUUID,p as getShortUUID,f as getUUIDVersion,I as getUUIDv7,d as isNilUUID,x as isUUID,l as isUUIDv4,D as toShortUUID,v as uuidToBytes};
|
|
@@ -1,17 +1,42 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Checks if a value is defined (not null or undefined).
|
|
3
|
+
*
|
|
4
|
+
* @example
|
|
5
|
+
* ```typescript
|
|
6
|
+
* isDefined(0) // true
|
|
7
|
+
* isDefined('') // true
|
|
8
|
+
* isDefined(null) // false
|
|
9
|
+
* isDefined(undefined) // false
|
|
10
|
+
* ```
|
|
11
|
+
*
|
|
3
12
|
* @param value The value to check.
|
|
4
13
|
* @returns {boolean}
|
|
5
14
|
*/
|
|
6
15
|
export declare function isDefined<T>(value: T | null | undefined): value is T;
|
|
7
16
|
/**
|
|
8
17
|
* Check if a value is a string.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```typescript
|
|
21
|
+
* isString('hi') // true
|
|
22
|
+
* isString(42) // false
|
|
23
|
+
* isString(new String('hi')) // false (boxed, not a primitive)
|
|
24
|
+
* ```
|
|
25
|
+
*
|
|
9
26
|
* @param value - The value to check.
|
|
10
27
|
* @returns `true` if the value is a string, `false` otherwise.
|
|
11
28
|
*/
|
|
12
29
|
export declare function isString(value: unknown): value is string;
|
|
13
30
|
/**
|
|
14
31
|
* Checks if a value is a number (and not NaN).
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* ```typescript
|
|
35
|
+
* isNumber(42) // true
|
|
36
|
+
* isNumber(Number.NaN) // false
|
|
37
|
+
* isNumber('42') // false
|
|
38
|
+
* ```
|
|
39
|
+
*
|
|
15
40
|
* @param value The value to check.
|
|
16
41
|
* @returns {boolean}
|
|
17
42
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/validation/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/validation/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,wBAAgB,SAAS,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,IAAI,GAAG,SAAS,GAAG,KAAK,IAAI,CAAC,CAEpE;AAED;;;;;;;;;;;;GAYG;AAEH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAExD;AAED;;;;;;;;;;;;GAYG;AAEH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAExD;AAED;;;;GAIG;AAEH,wBAAgB,SAAS,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,OAAO,CAE1D;AAED;;;;GAIG;AAEH,wBAAgB,OAAO,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,OAAO,EAAE,CAE1D;AAED;;;;GAIG;AAEH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAExD;AAED;;;;GAIG;AACH,wBAAgB,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAI5C;AAED;;;;GAIG;AACH,wBAAgB,KAAK,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAO1C"}
|
package/dist/validation/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import"../chunks/chunk-ANN5UYCF.js";function r(n){return n!=null}function e(n){return typeof n=="string"}function t(n){return typeof n=="number"&&!Number.isNaN(n)}function o(n){return typeof n=="boolean"}function u(n){return Array.isArray(n)}function i(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)}function s(n){return/^[^\s@]+@[^\s
|
|
1
|
+
import"../chunks/chunk-ANN5UYCF.js";function r(n){return n!=null}function e(n){return typeof n=="string"}function t(n){return typeof n=="number"&&!Number.isNaN(n)}function o(n){return typeof n=="boolean"}function u(n){return Array.isArray(n)}function i(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)}function s(n){return/^[^\s@]+@[^\s@.]+(?:\.[^\s@.]+)+$/.test(n)}function a(n){try{return new URL(n),!0}catch{return!1}}export{u as isArray,o as isBoolean,r as isDefined,s as isEmail,t as isNumber,i as isObject,e as isString,a as isUrl};
|
package/package.json
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rtorcato/js-common",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0",
|
|
4
4
|
"description": "JavaScript and TypeScript common code",
|
|
5
5
|
"type": "module",
|
|
6
|
+
"packageManager": "pnpm@11.17.0",
|
|
6
7
|
"main": "dist/index.js",
|
|
7
8
|
"module": "dist/index.js",
|
|
8
9
|
"types": "dist/index.d.ts",
|
|
@@ -43,10 +44,14 @@
|
|
|
43
44
|
"size": "size-limit",
|
|
44
45
|
"benchmark": "node scripts/benchmark.mjs",
|
|
45
46
|
"docs:generate": "node scripts/generate-module-docs.mjs",
|
|
47
|
+
"sync:agents": "node scripts/sync-agents.mjs",
|
|
48
|
+
"check:readme": "node scripts/check-readme-exports.mjs --check",
|
|
46
49
|
"commit": "cz",
|
|
50
|
+
"verify": "pnpm typecheck && pnpm check && pnpm exec vitest run",
|
|
47
51
|
"================================================": ""
|
|
48
52
|
},
|
|
49
53
|
"files": [
|
|
54
|
+
"AGENTS.md",
|
|
50
55
|
"CHANGELOG.md",
|
|
51
56
|
"CONTRIBUTORS.md",
|
|
52
57
|
"dist",
|
|
@@ -118,10 +123,6 @@
|
|
|
118
123
|
"import": "./dist/file/index.js",
|
|
119
124
|
"types": "./dist/file/index.d.ts"
|
|
120
125
|
},
|
|
121
|
-
"./formatting": {
|
|
122
|
-
"import": "./dist/formatting/index.js",
|
|
123
|
-
"types": "./dist/formatting/index.d.ts"
|
|
124
|
-
},
|
|
125
126
|
"./functions": {
|
|
126
127
|
"import": "./dist/functions/index.js",
|
|
127
128
|
"types": "./dist/functions/index.d.ts"
|
|
@@ -138,10 +139,6 @@
|
|
|
138
139
|
"import": "./dist/i18n/index.js",
|
|
139
140
|
"types": "./dist/i18n/index.d.ts"
|
|
140
141
|
},
|
|
141
|
-
"./interval": {
|
|
142
|
-
"import": "./dist/interval/index.js",
|
|
143
|
-
"types": "./dist/interval/index.d.ts"
|
|
144
|
-
},
|
|
145
142
|
"./json": {
|
|
146
143
|
"import": "./dist/json/index.js",
|
|
147
144
|
"types": "./dist/json/index.d.ts"
|
|
@@ -158,10 +155,6 @@
|
|
|
158
155
|
"import": "./dist/maps/index.js",
|
|
159
156
|
"types": "./dist/maps/index.d.ts"
|
|
160
157
|
},
|
|
161
|
-
"./math": {
|
|
162
|
-
"import": "./dist/math/index.js",
|
|
163
|
-
"types": "./dist/math/index.d.ts"
|
|
164
|
-
},
|
|
165
158
|
"./mime-types": {
|
|
166
159
|
"import": "./dist/mime-types/index.js",
|
|
167
160
|
"types": "./dist/mime-types/index.d.ts"
|
|
@@ -202,10 +195,6 @@
|
|
|
202
195
|
"import": "./dist/security/index.js",
|
|
203
196
|
"types": "./dist/security/index.d.ts"
|
|
204
197
|
},
|
|
205
|
-
"./sets": {
|
|
206
|
-
"import": "./dist/sets/index.js",
|
|
207
|
-
"types": "./dist/sets/index.d.ts"
|
|
208
|
-
},
|
|
209
198
|
"./sleep": {
|
|
210
199
|
"import": "./dist/sleep/index.js",
|
|
211
200
|
"types": "./dist/sleep/index.d.ts"
|
|
@@ -243,50 +232,47 @@
|
|
|
243
232
|
}
|
|
244
233
|
},
|
|
245
234
|
"devDependencies": {
|
|
246
|
-
"@biomejs/biome": "^2.
|
|
247
|
-
"@commitlint/cli": "^
|
|
248
|
-
"@commitlint/config-conventional": "^
|
|
249
|
-
"@rtorcato/
|
|
250
|
-
"@semantic-release/changelog": "^
|
|
235
|
+
"@biomejs/biome": "^2.5.0",
|
|
236
|
+
"@commitlint/cli": "^21.2.1",
|
|
237
|
+
"@commitlint/config-conventional": "^21.2.0",
|
|
238
|
+
"@rtorcato/repo-tooling": "^3.11.0",
|
|
239
|
+
"@semantic-release/changelog": "^7.0.0",
|
|
251
240
|
"@semantic-release/commit-analyzer": "^13.0.1",
|
|
252
|
-
"@semantic-release/git": "^
|
|
241
|
+
"@semantic-release/git": "^11.0.1",
|
|
253
242
|
"@semantic-release/github": "^12.0.0",
|
|
254
243
|
"@semantic-release/npm": "^13.1.1",
|
|
255
244
|
"@semantic-release/release-notes-generator": "^14.1.0",
|
|
256
|
-
"@size-limit/preset-small-lib": "^
|
|
245
|
+
"@size-limit/preset-small-lib": "^13.0.3",
|
|
257
246
|
"@types/chalk-animation": "^1.6.3",
|
|
258
247
|
"@types/figlet": "^1.7.0",
|
|
259
|
-
"@types/
|
|
260
|
-
"@
|
|
261
|
-
"@vitest/coverage-istanbul": "^4.0.17",
|
|
248
|
+
"@types/node": "^26.1.2",
|
|
249
|
+
"@vitest/coverage-v8": "^4.0.17",
|
|
262
250
|
"cross-env": "^10.1.0",
|
|
263
|
-
"esbuild": "^0.
|
|
251
|
+
"esbuild": "^0.28.1",
|
|
264
252
|
"fast-check": "^4.8.0",
|
|
265
253
|
"husky": "^9.1.7",
|
|
266
|
-
"jsdom": "^
|
|
254
|
+
"jsdom": "^30.0.1",
|
|
267
255
|
"knip": "^6.14.2",
|
|
268
256
|
"rimraf": "^6.0.1",
|
|
269
257
|
"semantic-release": "^25.0.1",
|
|
270
|
-
"size-limit": "^
|
|
258
|
+
"size-limit": "^13.0.3",
|
|
271
259
|
"typescript": "^6.0.2",
|
|
272
260
|
"vitest": "^4.0.17"
|
|
273
261
|
},
|
|
274
262
|
"dependencies": {
|
|
275
|
-
"date-fns": "^4.1.0",
|
|
276
|
-
"date-fns-tz": "^3.2.0",
|
|
277
|
-
"luxon": "^3.7.2",
|
|
278
263
|
"pino": "^10.1.0",
|
|
279
264
|
"short-uuid": "^6.0.3",
|
|
280
|
-
"uuid": "^
|
|
265
|
+
"uuid": "^14.0.1",
|
|
281
266
|
"zod": "^4.1.12"
|
|
282
267
|
},
|
|
283
268
|
"optionalDependencies": {
|
|
284
269
|
"@inquirer/prompts": "^8.5.0",
|
|
285
|
-
"chalk": "^
|
|
270
|
+
"chalk": "^6.0.0",
|
|
286
271
|
"chalk-animation": "^2.0.3",
|
|
287
|
-
"commander": "^
|
|
272
|
+
"commander": "^15.0.0",
|
|
288
273
|
"figlet": "^1.9.3",
|
|
289
|
-
"gradient-string": "^3.0.0"
|
|
274
|
+
"gradient-string": "^3.0.0",
|
|
275
|
+
"pino-pretty": "^13.0.0"
|
|
290
276
|
},
|
|
291
277
|
"config": {
|
|
292
278
|
"commitizen": {
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
function u(n){return n[0]}function T(n){return n.length?n[n.length-1]:void 0}function f(n){return Array.from(new Set(n))}function i(n){return n.flat()}function l(n,e){if(e<1)throw new Error("Chunk size must be at least 1");let t=[];for(let r=0;r<n.length;r+=e)t.push(n.slice(r,r+e));return t}function s(n){return n.filter(Boolean)}function c(n){let e=n.slice();for(let t=e.length-1;t>0;t--){let r=Math.floor(Math.random()*(t+1));[e[t],e[r]]=[e[r],e[t]]}return e}function h(n,e){return n.reduce((t,r)=>{let o=e(r);return t[o]||(t[o]=[]),t[o].push(r),t},{})}export{u as a,T as b,f as c,i as d,l as e,s as f,c as g,h};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{b as e}from"./chunk-FBDKWWIQ.js";import o from"pino";var i=e()?o({level:"debug",transport:{target:"pino-pretty",options:{colorize:!0,ignore:"pid,hostname,time",levelFirst:!1,singleLine:!0,customColors:"err:red,info:blue",translateTime:"HH:MM:ss"}}}):o({level:"info"});export{i as a};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
function r(n){return Object.prototype.toString.call(n)==="[object Object]"}function s(n,o){let t={...n};for(let e in o)r(o[e])&&r(t[e])?t[e]=s(t[e],o[e]):t[e]=o[e];return t}function c(n,o){let t={...n};for(let e of o)delete t[e];return t}function i(n,o){let t={};for(let e of o)e in n&&(t[e]=n[e]);return t}function T(n){return structuredClone(n)}export{r as a,s as b,c,i as d,T as e};
|