@rtorcato/js-common 4.0.0 → 5.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.
Files changed (67) hide show
  1. package/AGENTS.md +16 -16
  2. package/README.md +25 -14
  3. package/dist/abortController/index.d.ts +3 -2
  4. package/dist/abortController/index.d.ts.map +1 -1
  5. package/dist/abortController/index.js +1 -1
  6. package/dist/arrays/arrays.test-d.js +1 -1
  7. package/dist/arrays/index.d.ts +52 -0
  8. package/dist/arrays/index.d.ts.map +1 -1
  9. package/dist/arrays/index.js +1 -1
  10. package/dist/chunks/chunk-6FGK7LS2.js +1 -0
  11. package/dist/chunks/chunk-NEODDZIS.js +1 -0
  12. package/dist/chunks/chunk-U2F5TMN2.js +1 -0
  13. package/dist/chunks/chunk-VSTXGIC3.js +1 -0
  14. package/dist/crypto/index.d.ts +15 -10
  15. package/dist/crypto/index.d.ts.map +1 -1
  16. package/dist/crypto/index.js +1 -1
  17. package/dist/date/index.d.ts +22 -2
  18. package/dist/date/index.d.ts.map +1 -1
  19. package/dist/date/index.js +1 -1
  20. package/dist/env/index.js +3 -1
  21. package/dist/fetch/index.d.ts +6 -3
  22. package/dist/fetch/index.d.ts.map +1 -1
  23. package/dist/fetch/index.js +1 -1
  24. package/dist/logger/index.d.ts.map +1 -1
  25. package/dist/logger/index.js +1 -1
  26. package/dist/numbers/index.d.ts +96 -3
  27. package/dist/numbers/index.d.ts.map +1 -1
  28. package/dist/numbers/index.js +1 -1
  29. package/dist/os/index.d.ts +0 -11
  30. package/dist/os/index.d.ts.map +1 -1
  31. package/dist/os/index.js +1 -1
  32. package/dist/promises/index.d.ts +51 -0
  33. package/dist/promises/index.d.ts.map +1 -1
  34. package/dist/promises/index.js +1 -1
  35. package/dist/promises/promises.test-d.js +1 -1
  36. package/dist/regex/index.d.ts +7 -0
  37. package/dist/regex/index.d.ts.map +1 -1
  38. package/dist/regex/index.js +1 -1
  39. package/dist/security/index.d.ts +0 -13
  40. package/dist/security/index.d.ts.map +1 -1
  41. package/dist/security/index.js +1 -1
  42. package/dist/sleep/index.d.ts +3 -2
  43. package/dist/sleep/index.d.ts.map +1 -1
  44. package/dist/sleep/index.js +1 -1
  45. package/dist/strings/index.d.ts +3 -2
  46. package/dist/strings/index.d.ts.map +1 -1
  47. package/dist/strings/index.js +1 -1
  48. package/dist/system/index.d.ts +22 -3
  49. package/dist/system/index.d.ts.map +1 -1
  50. package/dist/system/index.js +1 -1
  51. package/dist/try/index.d.ts +12 -0
  52. package/dist/try/index.d.ts.map +1 -1
  53. package/dist/try/index.js +1 -1
  54. package/dist/try/trycatch.test-d.js +1 -1
  55. package/dist/url/index.d.ts.map +1 -1
  56. package/dist/url/index.js +1 -1
  57. package/dist/validation/index.d.ts +0 -12
  58. package/dist/validation/index.d.ts.map +1 -1
  59. package/dist/validation/index.js +1 -1
  60. package/package.json +35 -24
  61. package/dist/chunks/chunk-AVPQVYSA.js +0 -1
  62. package/dist/chunks/chunk-FBDKWWIQ.js +0 -3
  63. package/dist/chunks/chunk-J4C2KNK5.js +0 -1
  64. package/dist/chunks/chunk-UQBVI52L.js +0 -1
  65. package/dist/index.d.ts +0 -2
  66. package/dist/index.d.ts.map +0 -1
  67. package/dist/index.js +0 -0
@@ -29,20 +29,41 @@ export declare function clamp(value: number, min: number, max: number): number;
29
29
  * @returns The rounded number.
30
30
  */
31
31
  export declare function roundTo(value: number, decimals?: number): number;
32
+ /**
33
+ * Options for {@link formatPercent}.
34
+ */
35
+ export interface FormatPercentOptions {
36
+ /** Number of decimal places (default: 0). */
37
+ fractionDigits?: number;
38
+ /**
39
+ * Force a leading `+` on positive values (e.g. `+2.14%`). Zero is never signed,
40
+ * regardless of this option, since `+0%` / `-0%` reads as noise — this is decided
41
+ * by the rounded, displayed value, so a value that rounds to zero at the given
42
+ * `fractionDigits` is unsigned too. Default: false.
43
+ */
44
+ signed?: boolean;
45
+ }
32
46
  /**
33
47
  * Formats a number as a percentage string.
34
48
  *
49
+ * `value` is always treated as a fraction (0.25 → "25%"), matching the existing
50
+ * behaviour — it is not a pre-multiplied percentage (25 would format as "2500%").
51
+ *
35
52
  * @example
36
53
  * ```typescript
37
54
  * formatPercent(0.25) // '25%'
38
55
  * formatPercent(0.1234, 1) // '12.3%'
56
+ * formatPercent(0.0214, { fractionDigits: 2, signed: true }) // '+2.14%'
57
+ * formatPercent(-0.0088, { fractionDigits: 2, signed: true }) // '-0.88%'
58
+ * formatPercent(0, { signed: true }) // '0%' (zero is never signed)
59
+ * formatPercent(0.00001, { fractionDigits: 2, signed: true }) // '0.00%' (rounds to zero)
39
60
  * ```
40
61
  *
41
- * @param value The value to format (e.g. 0.25 for 25%).
42
- * @param fractionDigits Number of decimal places (default: 0).
62
+ * @param value The value to format, as a fraction (e.g. 0.25 for 25%).
63
+ * @param fractionDigitsOrOptions Number of decimal places (default: 0), or an options object.
43
64
  * @returns The formatted percentage string.
44
65
  */
45
- export declare function formatPercent(value: number, fractionDigits?: number): string;
66
+ export declare function formatPercent(value: number, fractionDigitsOrOptions?: number | FormatPercentOptions): string;
46
67
  /**
47
68
  * Checks if a number is between two values.
48
69
  * @param value The number to check.
@@ -71,4 +92,76 @@ export declare function average(numbers: number[]): number;
71
92
  * @returns The modulus result.
72
93
  */
73
94
  export declare function mod(n: number, m: number): number;
95
+ /**
96
+ * Returns the variance of an array of numbers.
97
+ *
98
+ * Defaults to the **population** variance (divide by `n`). Pass
99
+ * `{ sample: true }` for the sample variance (Bessel's correction, `n - 1`) —
100
+ * the right choice when the values are a sample drawn from a larger population,
101
+ * such as a volatility estimate.
102
+ *
103
+ * @example
104
+ * ```typescript
105
+ * variance([2, 4, 4, 4, 5, 5, 7, 9]) // 4
106
+ * variance([2, 4, 4, 4, 5, 5, 7, 9], { sample: true }) // 4.571428...
107
+ * ```
108
+ *
109
+ * @param numbers The array of numbers.
110
+ * @param options `sample` divides by `n - 1` instead of `n`.
111
+ * @returns The variance, or 0 when there are too few values (empty array, or a
112
+ * single value with `sample: true`).
113
+ */
114
+ export declare function variance(numbers: number[], options?: {
115
+ sample?: boolean;
116
+ }): number;
117
+ /**
118
+ * Returns the standard deviation of an array of numbers — the square root of
119
+ * {@link variance}, with the same population/sample choice.
120
+ *
121
+ * @example
122
+ * ```typescript
123
+ * stdDev([2, 4, 4, 4, 5, 5, 7, 9]) // 2
124
+ * stdDev([2, 4, 4, 4, 5, 5, 7, 9], { sample: true }) // 2.13808...
125
+ * ```
126
+ *
127
+ * @param numbers The array of numbers.
128
+ * @param options `sample` divides by `n - 1` instead of `n`.
129
+ * @returns The standard deviation, or 0 when there are too few values.
130
+ */
131
+ export declare function stdDev(numbers: number[], options?: {
132
+ sample?: boolean;
133
+ }): number;
134
+ /**
135
+ * Returns the median of an array of numbers. Even-length inputs return the mean
136
+ * of the two middle values. The input array is not mutated.
137
+ *
138
+ * @example
139
+ * ```typescript
140
+ * median([3, 1, 2]) // 2
141
+ * median([4, 1, 3, 2]) // 2.5
142
+ * ```
143
+ *
144
+ * @param numbers The array of numbers.
145
+ * @returns The median, or 0 if the array is empty.
146
+ */
147
+ export declare function median(numbers: number[]): number;
148
+ /**
149
+ * Returns the `p`th percentile of an array of numbers using **linear
150
+ * interpolation between closest ranks** (the R-7 method, matching Excel's
151
+ * `PERCENTILE.INC` and NumPy's default): the value at position
152
+ * `(n - 1) * p / 100` in the sorted values, interpolated between neighbours.
153
+ * The input array is not mutated.
154
+ *
155
+ * @example
156
+ * ```typescript
157
+ * percentile([1, 2, 3, 4], 50) // 2.5
158
+ * percentile([1, 2, 3, 4], 25) // 1.75
159
+ * percentile([1, 2, 3, 4], 100) // 4
160
+ * ```
161
+ *
162
+ * @param numbers The array of numbers.
163
+ * @param p The percentile to compute, 0–100 (clamped).
164
+ * @returns The percentile value, or 0 if the array is empty.
165
+ */
166
+ export declare function percentile(numbers: number[], p: number): number;
74
167
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../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n,r=0){return`${(n*100).toFixed(r)}%`}function c(n,r,e,t=!0){return t?n>=r&&n<=e:n>r&&n<e}function u(n){return n.reduce((r,e)=>r+e,0)}function f(n){return n.length===0?0:u(n)/n.length}function i(n,r){return(n%r+r)%r}export{f as average,c as between,o as clamp,m as formatPercent,i as mod,b as roundTo,u as sum};
1
+ import"../chunks/chunk-ANN5UYCF.js";function i(e,n,r){return Math.max(n,Math.min(r,e))}function l(e,n=2){let r=10**n;return Math.round(e*r)/r}function d(e,n){let{fractionDigits:r=0,signed:t=!1}=typeof n=="number"?{fractionDigits:n}:n??{},o=(e*100).toFixed(r);if(!t)return`${o}%`;let u=Number(o);return u===0?`${o.replace("-","")}%`:`${u>0?"+":""}${o}%`}function x(e,n,r,t=!0){return t?e>=n&&e<=r:e>n&&e<r}function m(e){return e.reduce((n,r)=>n+r,0)}function f(e){return e.length===0?0:m(e)/e.length}function h(e,n){return(e%n+n)%n}function p(e,n={}){let r=n.sample?e.length-1:e.length;if(r<=0)return 0;let t=f(e);return m(e.map(o=>(o-t)**2))/r}function g(e,n={}){return Math.sqrt(p(e,n))}function M(e){return s(e,50)}function s(e,n){if(e.length===0)return 0;let r=e.toSorted((b,a)=>b-a),t=(r.length-1)*i(n,0,100)/100,o=Math.floor(t),u=r[o],c=r[Math.ceil(t)];return u+(c-u)*(t-o)}export{f as average,x as between,i as clamp,d as formatPercent,M as median,h as mod,s as percentile,l as roundTo,g as stdDev,m as sum,p as variance};
@@ -1,14 +1,3 @@
1
- /**
2
- * Returns the current operating system platform (Node.js only).
3
- *
4
- * @example
5
- * ```typescript
6
- * getOsPlatform() // 'darwin' on macOS, 'win32' on Windows, undefined in a browser
7
- * ```
8
- *
9
- * @returns {string | undefined} The platform (e.g., 'darwin', 'win32', 'linux').
10
- */
11
- export declare function getOsPlatform(): string | undefined;
12
1
  /**
13
2
  * Returns the OS release/version (Node.js only).
14
3
  *
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/os/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,wBAAgB,aAAa,IAAI,MAAM,GAAG,SAAS,CAGlD;AAED;;;;;;;;;GASG;AACH,wBAAgB,YAAY,IAAI,MAAM,GAAG,SAAS,CAIjD;AAED;;;;;;;;;GASG;AACH,wBAAgB,SAAS,IAAI,MAAM,GAAG,SAAS,CAG9C;AAED;;;GAGG;AACH,wBAAgB,UAAU,IAAI,MAAM,GAAG,SAAS,CAM/C;AAED;;;GAGG;AACH,wBAAgB,SAAS,IAAI,MAAM,GAAG,SAAS,CAO9C"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/os/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,wBAAgB,YAAY,IAAI,MAAM,GAAG,SAAS,CAIjD;AAED;;;;;;;;;GASG;AACH,wBAAgB,SAAS,IAAI,MAAM,GAAG,SAAS,CAG9C;AAED;;;GAGG;AACH,wBAAgB,UAAU,IAAI,MAAM,GAAG,SAAS,CAM/C;AAED;;;GAGG;AACH,wBAAgB,SAAS,IAAI,MAAM,GAAG,SAAS,CAO9C"}
package/dist/os/index.js CHANGED
@@ -1 +1 @@
1
- import"../chunks/chunk-ANN5UYCF.js";function e(){if(typeof process<"u"&&process.platform)return process.platform}function n(){if(typeof process<"u"&&process.release&&process.release.name)return process.release.name}function r(){if(typeof process<"u"&&process.arch)return process.arch}function s(){if(typeof process<"u"&&process.env&&process.env.HOME)return process.env.HOME;if(typeof process<"u"&&process.env&&process.env.USERPROFILE)return process.env.USERPROFILE}function o(){if(typeof process<"u"&&process.env&&process.env.TMPDIR)return process.env.TMPDIR;if(typeof process<"u"&&process.env&&process.env.TEMP)return process.env.TEMP;if(typeof process<"u"&&process.env&&process.env.TMP)return process.env.TMP}export{s as getHomeDir,r as getOsArch,e as getOsPlatform,n as getOsRelease,o as getTmpDir};
1
+ import"../chunks/chunk-ANN5UYCF.js";function e(){if(typeof process<"u"&&process.release&&process.release.name)return process.release.name}function n(){if(typeof process<"u"&&process.arch)return process.arch}function r(){if(typeof process<"u"&&process.env&&process.env.HOME)return process.env.HOME;if(typeof process<"u"&&process.env&&process.env.USERPROFILE)return process.env.USERPROFILE}function s(){if(typeof process<"u"&&process.env&&process.env.TMPDIR)return process.env.TMPDIR;if(typeof process<"u"&&process.env&&process.env.TEMP)return process.env.TEMP;if(typeof process<"u"&&process.env&&process.env.TMP)return process.env.TMP}export{r as getHomeDir,n as getOsArch,e as getOsRelease,s as getTmpDir};
@@ -31,4 +31,55 @@ export declare function to<T>(promise: Promise<T>): Promise<[unknown, T | undefi
31
31
  * @returns {Promise<T>}
32
32
  */
33
33
  export declare function withTimeout<T>(promise: Promise<T>, ms: number, error?: any): Promise<T>;
34
+ /** Options for `retry`. Every field is optional. */
35
+ export type RetryOptions = {
36
+ /** Retries after the first attempt, so `retries + 1` attempts in total. Default 3. */
37
+ retries?: number;
38
+ /** Base delay in ms; the cap doubles each retry (`minDelay * 2 ** (attempt - 1)`). Default 100. */
39
+ minDelay?: number;
40
+ /** Upper bound on a single wait, in ms. Default 10_000. */
41
+ maxDelay?: number;
42
+ /** Full jitter: wait a random 0..cap instead of the full cap. Default true. */
43
+ jitter?: boolean;
44
+ /** Return false to stop retrying and reject with `err`. Default: retry every error. */
45
+ shouldRetry?: (err: unknown, attempt: number) => boolean;
46
+ /** Stops further attempts and aborts the wait; the promise rejects with `signal.reason`. */
47
+ signal?: AbortSignal;
48
+ };
49
+ /**
50
+ * Runs `fn` until it resolves, retrying rejections with exponential backoff and full jitter.
51
+ * `attempt` is 1-based. Rejects with the last error once retries run out or `shouldRetry`
52
+ * says no, or with `signal.reason` if the signal aborts.
53
+ *
54
+ * @example
55
+ * ```typescript
56
+ * const report = await retry((attempt, signal) => fetch('/api/report', { signal }), {
57
+ * retries: 4,
58
+ * shouldRetry: (err) => !(err instanceof HttpError) || err.status >= 500,
59
+ * signal: AbortSignal.timeout(30_000),
60
+ * })
61
+ * ```
62
+ *
63
+ * @param fn The operation to run; receives the attempt number and the caller's signal.
64
+ * @param opts Retry count, backoff bounds, jitter, retry predicate and abort signal.
65
+ * @returns {Promise<T>}
66
+ */
67
+ export declare function retry<T>(fn: (attempt: number, signal?: AbortSignal) => Promise<T>, opts?: RetryOptions): Promise<T>;
68
+ /**
69
+ * Maps `items` through an async `fn` with at most `limit` calls in flight, resolving to the
70
+ * results in input order. On the first rejection no new calls are started and the returned
71
+ * promise rejects with that error, like `Promise.all`; calls already in flight are not cancelled.
72
+ *
73
+ * @example
74
+ * ```typescript
75
+ * const users = await mapLimit(ids, 4, (id) => getUser(id))
76
+ * ```
77
+ *
78
+ * @param items The values to map.
79
+ * @param limit Maximum number of concurrent calls — a positive integer.
80
+ * @param fn Async mapper, called with each item and its index.
81
+ * @returns {Promise<R[]>}
82
+ * @throws {RangeError} If `limit` is not a positive integer (the promise rejects).
83
+ */
84
+ export declare function mapLimit<T, R>(items: Iterable<T>, limit: number, fn: (item: T, index: number) => Promise<R>): Promise<R[]>;
34
85
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/promises/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,wBAAsB,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,OAAO,EAAE,CAAC,GAAG,SAAS,CAAC,CAAC,CAOlF;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAC5B,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,EACnB,EAAE,EAAE,MAAM,EACV,KAAK,GAAE,GAA0B,GAC/B,OAAO,CAAC,CAAC,CAAC,CAEZ"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/promises/index.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;GAgBG;AAEH,wBAAsB,EAAE,CAAC,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Bd"}
@@ -1 +1 @@
1
- import{a,b}from"../chunks/chunk-AVPQVYSA.js";import"../chunks/chunk-ANN5UYCF.js";export{a as to,b as withTimeout};
1
+ import{a,b,c,d}from"../chunks/chunk-NEODDZIS.js";import"../chunks/chunk-VSTXGIC3.js";import"../chunks/chunk-ANN5UYCF.js";export{d as mapLimit,c as retry,a as to,b as withTimeout};
@@ -1 +1 @@
1
- import{a as o,b as e}from"../chunks/chunk-AVPQVYSA.js";import"../chunks/chunk-ANN5UYCF.js";import{describe as t,expectTypeOf as r,it as i}from"vitest";t("promises \u2014 types",()=>{i("withTimeout preserves the awaited type",()=>{r(e(Promise.resolve(42),10)).toEqualTypeOf(),r(e(Promise.resolve({id:1}),10)).toEqualTypeOf()}),i("to returns an [error, value] tuple with the value widened to undefined",()=>{r(o(Promise.resolve("x"))).toEqualTypeOf()})});
1
+ import{a as o,b as e}from"../chunks/chunk-NEODDZIS.js";import"../chunks/chunk-VSTXGIC3.js";import"../chunks/chunk-ANN5UYCF.js";import{describe as t,expectTypeOf as r,it as i}from"vitest";t("promises \u2014 types",()=>{i("withTimeout preserves the awaited type",()=>{r(e(Promise.resolve(42),10)).toEqualTypeOf(),r(e(Promise.resolve({id:1}),10)).toEqualTypeOf()}),i("to returns an [error, value] tuple with the value widened to undefined",()=>{r(o(Promise.resolve("x"))).toEqualTypeOf()})});
@@ -1,6 +1,13 @@
1
1
  /**
2
2
  * Escapes special regex characters in a string so it can be used in a RegExp.
3
3
  *
4
+ * The output is safe with or without the `u` flag, inside a character class, and
5
+ * inside a regex literal: `/` is escaped, and `-` becomes `\x2d` because `\-` is a
6
+ * syntax error outside a class in `u` mode.
7
+ *
8
+ * Native `RegExp.escape` (Node 24+) is the eventual replacement once the engine
9
+ * floor reaches it.
10
+ *
4
11
  * @example
5
12
  * ```typescript
6
13
  * escapeRegExp('1 + 1 = 2?') // '1 \\+ 1 = 2\\?'
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../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G,MAAM,EACxB,WAAW,EAAE,MAAM,GAAG,CAAC,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,MAAM,CAAC,GACnE,MAAM,CASR;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,EAAE,CAG5E"}
@@ -1 +1 @@
1
- import"../chunks/chunk-ANN5UYCF.js";function n(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function i(e,g){return(typeof g=="string"?new RegExp(g):g).test(e)}function x(e,g){let s=typeof g=="string"?new RegExp(g,"g"):new RegExp(g.source,g.flags.includes("g")?g.flags:`${g.flags}g`);return Array.from(e.matchAll(s))}function t(e,g,s){let r=typeof g=="string"?new RegExp(g,"g"):new RegExp(g.source,g.flags.includes("g")?g.flags:`${g.flags}g`);return e.replace(r,s)}function o(e,g){let s=typeof g=="string"?new RegExp(g):g;return e.split(s)}export{n as escapeRegExp,x as matchAll,t as replaceAllRegex,o as splitByRegex,i as testRegex};
1
+ import"../chunks/chunk-ANN5UYCF.js";function n(e){return e.replace(/[.*+?^${}()|[\]\\/]/g,"\\$&").replace(/-/g,"\\x2d")}function i(e,g){return(typeof g=="string"?new RegExp(g):g).test(e)}function x(e,g){let s=typeof g=="string"?new RegExp(g,"g"):new RegExp(g.source,g.flags.includes("g")?g.flags:`${g.flags}g`);return Array.from(e.matchAll(s))}function t(e,g,s){let r=typeof g=="string"?new RegExp(g,"g"):new RegExp(g.source,g.flags.includes("g")?g.flags:`${g.flags}g`);return e.replace(r,s)}function o(e,g){let s=typeof g=="string"?new RegExp(g):g;return e.split(s)}export{n as escapeRegExp,x as matchAll,t as replaceAllRegex,o as splitByRegex,i as testRegex};
@@ -35,17 +35,4 @@ export declare function stripScriptish(str: string): string;
35
35
  * @returns True if the password is strong, false otherwise.
36
36
  */
37
37
  export declare function isStrongPassword(password: string): boolean;
38
- /**
39
- * Generates a cryptographically secure random token (hex string).
40
- *
41
- * @example
42
- * ```typescript
43
- * generateSecureToken() // 64 hex chars (32 bytes)
44
- * generateSecureToken(8) // 'c1f0a4e29b73d518'
45
- * ```
46
- *
47
- * @param length The number of bytes (not hex chars).
48
- * @returns A random hex string.
49
- */
50
- export declare function generateSecureToken(length?: number): string;
51
38
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/security/index.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAgBlD;AAgDD;;;;;;;;;;;;GAYG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAI1D;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,SAAK,GAAG,MAAM,CAEvD"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/security/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAgBlD;AAgDD;;;;;;;;;;;;GAYG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAI1D"}
@@ -1 +1 @@
1
- import"../chunks/chunk-ANN5UYCF.js";import{randomBytes as a}from"node:crypto";function u(t){let e=d(t),n;do n=e,e=e.replace(/[\s/]on\w+\s*=\s*(?:"[^"]*"|'[^']*'|[^\s>]*)/gi,"");while(e!==n);return e}function d(t){let e=t.toLowerCase(),n="",i=0,s=0;for(;;){let r=e.indexOf("<script",s);if(r===-1)break;let o=e[r+7];if(o!==void 0&&o!==">"&&o!=="/"&&!/\s/.test(o)){s=r+7;continue}let c=e.indexOf(">",r);if(c===-1)break;let f=e.indexOf("</script",c);if(f===-1)break;let l=e.indexOf(">",f);if(l===-1)break;n+=t.slice(i,r),i=l+1,s=i}return n+t.slice(i)}function g(t){return/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[!@#$%^&*()_+\-=[\]{};':"\\|,.<>/?]).{8,}$/.test(t)}function x(t=32){return a(t).toString("hex")}export{x as generateSecureToken,g as isStrongPassword,u as stripScriptish};
1
+ import"../chunks/chunk-ANN5UYCF.js";function a(t){let e=d(t),n;do n=e,e=e.replace(/[\s/]on\w+\s*=\s*(?:"[^"]*"|'[^']*'|[^\s>]*)/gi,"");while(e!==n);return e}function d(t){let e=t.toLowerCase(),n="",s=0,r=0;for(;;){let i=e.indexOf("<script",r);if(i===-1)break;let o=e[i+7];if(o!==void 0&&o!==">"&&o!=="/"&&!/\s/.test(o)){r=i+7;continue}let c=e.indexOf(">",i);if(c===-1)break;let f=e.indexOf("</script",c);if(f===-1)break;let l=e.indexOf(">",f);if(l===-1)break;n+=t.slice(s,i),s=l+1,r=s}return n+t.slice(s)}function p(t){return/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[!@#$%^&*()_+\-=[\]{};':"\\|,.<>/?]).{8,}$/.test(t)}export{p as isStrongPassword,a as stripScriptish};
@@ -38,10 +38,11 @@ export declare function sleepSync(ms: number): void;
38
38
  */
39
39
  export declare function sleepRandom(min: number, max: number): Promise<void>;
40
40
  /**
41
- * Returns a promise that resolves after ms, or rejects if aborted via AbortSignal.
41
+ * Returns a promise that resolves after ms, or rejects with `signal.reason` if aborted.
42
+ * An already-aborted signal rejects immediately.
42
43
  * @param ms Milliseconds to sleep.
43
44
  * @param signal Optional AbortSignal to cancel the sleep.
44
- * @returns Promise that resolves after ms or rejects if aborted.
45
+ * @returns Promise that resolves after ms or rejects with `signal.reason` if aborted.
45
46
  */
46
47
  export declare function sleepWithAbort(ms: number, signal?: AbortSignal): Promise<void>;
47
48
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
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"}
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;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAgB9E"}
@@ -1 +1 @@
1
- import"../chunks/chunk-ANN5UYCF.js";var i=e=>new Promise(o=>setTimeout(o,e));function m(e){let o=Date.now()+e;for(;Date.now()<o;);}function s(e,o){let t=Math.floor(Math.random()*(o-e+1))+e;return new Promise(r=>setTimeout(r,t))}function u(e,o){return new Promise((t,r)=>{let n=setTimeout(t,e);o&&o.addEventListener("abort",()=>{clearTimeout(n),r(new Error("Sleep aborted"))})})}export{i as sleep,s as sleepRandom,m as sleepSync,u as sleepWithAbort};
1
+ import{a,b,c,d}from"../chunks/chunk-VSTXGIC3.js";import"../chunks/chunk-ANN5UYCF.js";export{a as sleep,c as sleepRandom,b as sleepSync,d as sleepWithAbort};
@@ -74,13 +74,14 @@ export declare function kebabCase(str: string): string;
74
74
  export declare function snakeCase(str: string): string;
75
75
  /**
76
76
  * Truncates a string to a maximum length, adding ellipsis if needed.
77
+ * Length is counted in graphemes, so emoji and combining marks are never split.
77
78
  * @param str The string to truncate.
78
- * @param maxLength The maximum length.
79
+ * @param maxLength The maximum length in graphemes, ellipsis included. `<= 0` returns `''`.
79
80
  * @returns The truncated string.
80
81
  */
81
82
  export declare function truncate(str: string, maxLength: number): string;
82
83
  /**
83
- * Reverses a string.
84
+ * Reverses a string by grapheme, so emoji sequences, flags and combining marks stay intact.
84
85
  *
85
86
  * @example
86
87
  * ```typescript
@@ -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;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,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAI3E"}
@@ -1 +1 @@
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};
1
+ import"../chunks/chunk-ANN5UYCF.js";function g(e){return e.replace(/\w\S*/g,r=>r.charAt(0).toUpperCase()+r.slice(1).toLowerCase())}function a(e){return e.length===0?"":(e[0]?.toUpperCase()??"")+e.slice(1)}function c(e){return e.replace(/[-_\s]+(.)?/g,(r,t)=>t?t.toUpperCase():"").replace(/^(.)/,r=>r.toLowerCase())}function u(e){return e.replace(/([a-z])([A-Z])/g,"$1-$2").replace(/[_\s]+/g,"-").toLowerCase()}function l(e){return e.replace(/([a-z])([A-Z])/g,"$1_$2").replace(/[-\s]+/g,"_").toLowerCase()}var o=new Intl.Segmenter(void 0,{granularity:"grapheme"});function i(e){return Array.from(o.segment(e),r=>r.segment)}function p(e,r){if(r<=0)return"";let t=i(e);return t.length>r?`${t.slice(0,r-1).join("")}\u2026`:e}function f(e){return i(e).reverse().join("")}function m(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 $(e){return e.replace(/([a-z])([A-Z])/g,"$1 $2").replace(/[-_]+/g," ").trim().split(/\s+/).filter(Boolean)}function h(e){let r=e.trim();return r===""?0:r.split(/\s+/).length}function w(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 x(e,r,t,n="*"){if(r<0&&(r=0),t>e.length&&(t=e.length),r>=t)return e;let s=n.repeat(t-r);return e.slice(0,r)+s+e.slice(t)}function z(e,r){return e.replace(/\$\{(\w+)\}/g,(t,n)=>Object.hasOwn(r,n)?String(r[n]):t)}export{c as camelCase,a as capitalize,b as isBlank,u as kebabCase,x as mask,C as ordinalize,w as pluralize,f as reverse,m as slugify,l as snakeCase,z as template,g as titleCase,p as truncate,h as wordCount,$ as words};
@@ -1,6 +1,10 @@
1
1
  /**
2
2
  * Checks if the current OS is macOS.
3
3
  *
4
+ * The user-agent branch is deprecated — browser detection belongs to
5
+ * `@rtorcato/browser-common` and will be removed in the next major. In Node this
6
+ * reads `process.platform` and stays.
7
+ *
4
8
  * @example
5
9
  * ```typescript
6
10
  * isMacOs() // true on macOS (via process.platform in Node, userAgent in the browser)
@@ -12,6 +16,10 @@ export declare function isMacOs(): boolean;
12
16
  /**
13
17
  * Checks if the current OS is Windows.
14
18
  *
19
+ * The user-agent branch is deprecated — browser detection belongs to
20
+ * `@rtorcato/browser-common` and will be removed in the next major. In Node this
21
+ * reads `process.platform` and stays.
22
+ *
15
23
  * @example
16
24
  * ```typescript
17
25
  * isWindows() // true when process.platform === 'win32'
@@ -23,6 +31,10 @@ export declare function isWindows(): boolean;
23
31
  /**
24
32
  * Checks if the current OS is Linux.
25
33
  *
34
+ * The user-agent branch is deprecated — browser detection belongs to
35
+ * `@rtorcato/browser-common` and will be removed in the next major. In Node this
36
+ * reads `process.platform` and stays.
37
+ *
26
38
  * @example
27
39
  * ```typescript
28
40
  * isLinux() // true when process.platform === 'linux'
@@ -32,22 +44,29 @@ export declare function isWindows(): boolean;
32
44
  */
33
45
  export declare function isLinux(): boolean;
34
46
  /**
35
- * Checks if the device is running iOS.
47
+ * Checks if the device is running iOS. Always `false` in Node.
48
+ * @deprecated Browser detection belongs to `@rtorcato/browser-common`; removed in the next major.
36
49
  * @returns {boolean} True if iOS, false otherwise.
37
50
  */
38
51
  export declare function isIOS(): boolean;
39
52
  /**
40
- * Checks if the device is running Android.
53
+ * Checks if the device is running Android. Always `false` in Node.
54
+ * @deprecated Browser detection belongs to `@rtorcato/browser-common`; removed in the next major.
41
55
  * @returns {boolean} True if Android, false otherwise.
42
56
  */
43
57
  export declare function isAndroid(): boolean;
44
58
  /**
45
59
  * Returns a string representing the detected platform.
60
+ *
61
+ * The user-agent branch is deprecated — browser detection belongs to
62
+ * `@rtorcato/browser-common` and will be removed in the next major. In Node this
63
+ * reads `process.platform` and stays.
46
64
  * @returns {string} The platform name (e.g., 'macos', 'windows', 'linux', 'ios', 'android', or 'unknown').
47
65
  */
48
66
  export declare function getPlatform(): string;
49
67
  /**
50
- * Checks if the device supports touch events.
68
+ * Checks if the device supports touch events. Always `false` in Node.
69
+ * @deprecated Browser detection belongs to `@rtorcato/browser-common`; removed in the next major.
51
70
  * @returns {boolean} True if touch is supported, false otherwise.
52
71
  */
53
72
  export declare function isTouchDevice(): boolean;
@@ -1 +1 @@
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"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/system/index.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;GAaG;AACH,wBAAgB,OAAO,IAAI,OAAO,CAUjC;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,SAAS,IAAI,OAAO,CAQnC;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,OAAO,IAAI,OAAO,CASjC;AAED;;;;GAIG;AACH,wBAAgB,KAAK,IAAI,OAAO,CAK/B;AAED;;;;GAIG;AACH,wBAAgB,SAAS,IAAI,OAAO,CAKnC;AAED;;;;;;;GAOG;AACH,wBAAgB,WAAW,IAAI,MAAM,CAQpC;AAED;;;;GAIG;AACH,wBAAgB,aAAa,IAAI,OAAO,CAMvC"}
@@ -1 +1 @@
1
- import"../chunks/chunk-ANN5UYCF.js";function n(){return typeof window<"u"?window.navigator.userAgent.includes("Mac"):typeof process<"u"&&process.platform?process.platform==="darwin":!1}function e(){return typeof window<"u"?window.navigator.userAgent.includes("Windows"):typeof process<"u"&&process.platform?process.platform==="win32":!1}function o(){return typeof window<"u"?window.navigator.userAgent.includes("Linux"):typeof process<"u"&&process.platform?process.platform==="linux":!1}function r(){return typeof window<"u"?/iPad|iPhone|iPod/.test(window.navigator.userAgent)&&!window.MSStream:!1}function i(){return typeof window<"u"?window.navigator.userAgent.includes("Android"):!1}function t(){return n()?"macos":e()?"windows":o()?"linux":r()?"ios":i()?"android":"unknown"}function u(){return typeof window>"u"?!1:"ontouchstart"in window||typeof navigator.maxTouchPoints=="number"&&navigator.maxTouchPoints>0}export{t as getPlatform,i as isAndroid,r as isIOS,o as isLinux,n as isMacOs,u as isTouchDevice,e as isWindows};
1
+ import"../chunks/chunk-ANN5UYCF.js";var e=/iPad|iPhone|iPod/;function o(){if(typeof window<"u"){let n=window.navigator.userAgent;return n.includes("Mac")&&!e.test(n)}return typeof process<"u"&&process.platform?process.platform==="darwin":!1}function r(){return typeof window<"u"?window.navigator.userAgent.includes("Windows"):typeof process<"u"&&process.platform?process.platform==="win32":!1}function i(){if(typeof window<"u"){let n=window.navigator.userAgent;return n.includes("Linux")&&!n.includes("Android")}return typeof process<"u"&&process.platform?process.platform==="linux":!1}function t(){return typeof window<"u"?e.test(window.navigator.userAgent)&&!window.MSStream:!1}function u(){return typeof window<"u"?window.navigator.userAgent.includes("Android"):!1}function s(){return t()?"ios":u()?"android":o()?"macos":r()?"windows":i()?"linux":"unknown"}function f(){return typeof window>"u"?!1:"ontouchstart"in window||typeof navigator.maxTouchPoints=="number"&&navigator.maxTouchPoints>0}export{s as getPlatform,u as isAndroid,t as isIOS,i as isLinux,o as isMacOs,f as isTouchDevice,r as isWindows};
@@ -50,4 +50,16 @@ export declare function isSuccess<T, E>(result: Result<T, E>): result is Success
50
50
  * ```
51
51
  */
52
52
  export declare function tryCatch<T, E = Error>(fn: () => Promise<T>): Promise<Result<T, E>>;
53
+ /**
54
+ * Synchronous counterpart to {@link tryCatch} — run a function and capture any thrown
55
+ * error into a `Result`, so `Result` is usable outside async boundaries.
56
+ *
57
+ * @example
58
+ * ```typescript
59
+ * const { data, error } = tryCatchSync(() => JSON.parse(raw) as Config)
60
+ * if (error) return defaults
61
+ * console.log(data.port)
62
+ * ```
63
+ */
64
+ export declare function tryCatchSync<T, E = Error>(fn: () => T): Result<T, E>;
53
65
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
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"}
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;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,YAAY,CAAC,CAAC,EAAE,CAAC,GAAG,KAAK,EAAE,EAAE,EAAE,MAAM,CAAC,GAAG,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAMpE"}
package/dist/try/index.js CHANGED
@@ -1 +1 @@
1
- import{a,b}from"../chunks/chunk-J4C2KNK5.js";import"../chunks/chunk-ANN5UYCF.js";export{a as isSuccess,b as tryCatch};
1
+ import{a,b,c}from"../chunks/chunk-6FGK7LS2.js";import"../chunks/chunk-ANN5UYCF.js";export{a as isSuccess,b as tryCatch,c as tryCatchSync};
@@ -1 +1 @@
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()})});
1
+ import{a as o,b as s,c as u}from"../chunks/chunk-6FGK7LS2.js";import"../chunks/chunk-ANN5UYCF.js";import{describe as l,expectTypeOf as r,it as t}from"vitest";l("try \u2014 types",()=>{t("Result<T,E> is the union of Success<T> and Failure<E>",()=>{r().toEqualTypeOf(),r().toEqualTypeOf()}),t("isSuccess narrows Result to Success in the true branch",()=>{let e={data:1,error:null};o(e)?(r(e).toEqualTypeOf(),r(e.data).toEqualTypeOf(),r(e.error).toEqualTypeOf()):r(e).toEqualTypeOf()}),t("tryCatch returns Promise<Result<T, E>> with the resolved type",async()=>{let e=s(async()=>42);r(e).toEqualTypeOf();let y=s(async()=>"x");r(y).toEqualTypeOf()})});l("tryCatchSync \u2014 types",()=>{t("returns Result<T, E> directly, not a promise",()=>{r(u(()=>42)).toEqualTypeOf(),r(u(()=>"x")).toEqualTypeOf()})});
@@ -1 +1 @@
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"}
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,CAE/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 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};
1
+ import"../chunks/chunk-ANN5UYCF.js";function o(r){return URL.canParse(r)}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};
@@ -59,16 +59,4 @@ export declare function isArray(value: unknown): value is unknown[];
59
59
  * @returns {boolean}
60
60
  */
61
61
  export declare function isObject(value: unknown): value is object;
62
- /**
63
- * Checks if a string is a valid email address (simple regex).
64
- * @param str The string to check.
65
- * @returns {boolean}
66
- */
67
- export declare function isEmail(str: string): boolean;
68
- /**
69
- * Checks if a string is a valid URL.
70
- * @param str The string to check.
71
- * @returns {boolean}
72
- */
73
- export declare function isUrl(str: string): boolean;
74
62
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
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"}
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"}
@@ -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@.]+(?:\.[^\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};
1
+ import"../chunks/chunk-ANN5UYCF.js";function r(n){return n!=null}function e(n){return typeof n=="string"}function o(n){return typeof n=="number"&&!Number.isNaN(n)}function u(n){return typeof n=="boolean"}function t(n){return Array.isArray(n)}function i(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)}export{t as isArray,u as isBoolean,r as isDefined,o as isNumber,i as isObject,e as isString};