@rtorcato/js-common 3.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.
- package/AGENTS.md +21 -23
- package/README.md +31 -20
- package/dist/abortController/index.d.ts +3 -2
- package/dist/abortController/index.d.ts.map +1 -1
- package/dist/abortController/index.js +1 -1
- package/dist/arrays/arrays.test-d.js +1 -1
- package/dist/arrays/index.d.ts +43 -54
- package/dist/arrays/index.d.ts.map +1 -1
- package/dist/arrays/index.js +1 -1
- package/dist/boolean/index.d.ts +0 -35
- package/dist/boolean/index.d.ts.map +1 -1
- package/dist/boolean/index.js +1 -1
- package/dist/chunks/chunk-6FGK7LS2.js +1 -0
- package/dist/chunks/chunk-H7PB4TAW.js +1 -0
- package/dist/chunks/chunk-HUTZTT4Y.js +1 -0
- package/dist/chunks/chunk-NEODDZIS.js +1 -0
- package/dist/chunks/chunk-U2F5TMN2.js +1 -0
- package/dist/chunks/chunk-VSTXGIC3.js +1 -0
- package/dist/crypto/index.d.ts +15 -10
- package/dist/crypto/index.d.ts.map +1 -1
- package/dist/crypto/index.js +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/date/index.d.ts +22 -2
- package/dist/date/index.d.ts.map +1 -1
- package/dist/date/index.js +1 -1
- package/dist/env/index.js +3 -1
- package/dist/fetch/index.d.ts +6 -3
- package/dist/fetch/index.d.ts.map +1 -1
- package/dist/fetch/index.js +1 -1
- package/dist/json/index.d.ts +0 -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/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.js +1 -1
- package/dist/numbers/index.d.ts +88 -19
- package/dist/numbers/index.d.ts.map +1 -1
- package/dist/numbers/index.js +1 -1
- package/dist/objects/index.d.ts +0 -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 +0 -11
- package/dist/os/index.d.ts.map +1 -1
- package/dist/os/index.js +1 -1
- package/dist/promises/index.d.ts +47 -28
- package/dist/promises/index.d.ts.map +1 -1
- package/dist/promises/index.js +1 -1
- package/dist/promises/promises.test-d.js +1 -1
- package/dist/regex/index.d.ts +7 -0
- package/dist/regex/index.d.ts.map +1 -1
- package/dist/regex/index.js +1 -1
- package/dist/security/index.d.ts +0 -13
- package/dist/security/index.d.ts.map +1 -1
- package/dist/security/index.js +1 -1
- package/dist/sleep/index.d.ts +3 -2
- package/dist/sleep/index.d.ts.map +1 -1
- package/dist/sleep/index.js +1 -1
- package/dist/strings/index.d.ts +3 -25
- package/dist/strings/index.d.ts.map +1 -1
- package/dist/strings/index.js +1 -1
- package/dist/system/index.d.ts +22 -3
- package/dist/system/index.d.ts.map +1 -1
- package/dist/system/index.js +1 -1
- package/dist/try/index.d.ts +64 -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/url/index.d.ts.map +1 -1
- package/dist/url/index.js +1 -1
- package/dist/uuid/index.d.ts +0 -10
- package/dist/uuid/index.d.ts.map +1 -1
- package/dist/uuid/index.js +1 -1
- package/dist/validation/index.d.ts +0 -12
- package/dist/validation/index.d.ts.map +1 -1
- package/dist/validation/index.js +1 -1
- package/package.json +35 -36
- package/dist/chunks/chunk-5IA77ERW.js +0 -1
- package/dist/chunks/chunk-7JQSIREC.js +0 -1
- package/dist/chunks/chunk-ARW46OJS.js +0 -1
- package/dist/chunks/chunk-FBDKWWIQ.js +0 -3
- package/dist/chunks/chunk-MFJ5XPUX.js +0 -1
- package/dist/chunks/chunk-W72HFHZY.js +0 -1
- package/dist/chunks/chunk-XAQ7VMV4.js +0 -1
- package/dist/emails/banned/index.d.ts +0 -9
- package/dist/emails/banned/index.d.ts.map +0 -1
- package/dist/index.d.ts +0 -2
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -0
- package/dist/interval/index.d.ts +0 -28
- package/dist/interval/index.d.ts.map +0 -1
- package/dist/interval/index.js +0 -1
- package/dist/logger/logger.d.ts +0 -17
- package/dist/logger/logger.d.ts.map +0 -1
- package/dist/logger/logger.js +0 -1
- package/dist/sets/index.d.ts +0 -67
- package/dist/sets/index.d.ts.map +0 -1
- package/dist/sets/index.js +0 -1
- package/dist/try/trycatch.d.ts +0 -53
- package/dist/try/trycatch.d.ts.map +0 -1
- package/dist/try/trycatch.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"db.d.ts","sourceRoot":"","sources":["../../src/mime-types/db.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"db.d.ts","sourceRoot":"","sources":["../../src/mime-types/db.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,QAAA,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAymHb,CAAA;AAEV;;GAEG;AACH,MAAM,MAAM,aAAa,GACxB,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,OAAO,iBAAiB,CAAC,CAAC,YAAY,CAAC,CAAC,MAAM,CAAC,CAAA;AAEjF;;GAEG;AACH,MAAM,MAAM,QAAQ,GAAG,MAAM,OAAO,iBAAiB,CAAA;AAErD,KAAK,cAAc,GAAG,MAAM,CAC3B,QAAQ,EACR;IACC,MAAM,EAAE,MAAM,CAAA;IACd,UAAU,EAAE,aAAa,EAAE,CAAA;CAC3B,CACD,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,SAAS,EAAmC,cAAc,CAAA;AAEvE;;GAEG;AACH,MAAM,MAAM,SAAS,GAAG,CAAC,OAAO,SAAS,CAAC,CAAC,QAAQ,CAAC,CAAA"}
|
package/dist/mime-types/db.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"../chunks/chunk-
|
|
1
|
+
import{a}from"../chunks/chunk-H7PB4TAW.js";import"../chunks/chunk-ANN5UYCF.js";export{a as mimeTypes};
|
package/dist/mime-types/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as t}from"../chunks/chunk-
|
|
1
|
+
import{a as t}from"../chunks/chunk-H7PB4TAW.js";import"../chunks/chunk-ANN5UYCF.js";function m(n){let e=n.lastIndexOf(".");return e<0?"":n.substring(e)}var p={},a={};u(p,a);function d(n){if(!n||typeof n!="string")return!1;let e=m(`x.${n}`).toLowerCase().substring(1);return e&&a[e]||!1}function u(n,e){let r=["nginx","apache",void 0,"iana"];for(let i of Object.keys(t)){let c=t[i],s=c.extensions;if(s?.length){n[i]=s;for(let o of s){if(e[o]){let f=r.indexOf(t[e[o]].source),x=r.indexOf(c.source);if(e[o]!=="application/octet-stream"&&(f>x||f===x&&e[o].startsWith("application/")))continue}e[o]=i}}}}export{p as extensions,d as lookup,t as mimeTypes,a as types};
|
|
2
2
|
/*!
|
|
3
3
|
* mime-types
|
|
4
4
|
* Copyright(c) 2014 Jonathan Ong
|
package/dist/numbers/index.d.ts
CHANGED
|
@@ -30,31 +30,40 @@ export declare function clamp(value: number, min: number, max: number): number;
|
|
|
30
30
|
*/
|
|
31
31
|
export declare function roundTo(value: number, decimals?: number): number;
|
|
32
32
|
/**
|
|
33
|
-
*
|
|
34
|
-
* @param value The value to check.
|
|
35
|
-
* @returns True if the value is a finite number, false otherwise.
|
|
33
|
+
* Options for {@link formatPercent}.
|
|
36
34
|
*/
|
|
37
|
-
export
|
|
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
|
+
}
|
|
38
46
|
/**
|
|
39
47
|
* Formats a number as a percentage string.
|
|
40
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
|
+
*
|
|
41
52
|
* @example
|
|
42
53
|
* ```typescript
|
|
43
54
|
* formatPercent(0.25) // '25%'
|
|
44
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)
|
|
45
60
|
* ```
|
|
46
61
|
*
|
|
47
|
-
* @param value The value to format (e.g. 0.25 for 25%).
|
|
48
|
-
* @param
|
|
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.
|
|
49
64
|
* @returns The formatted percentage string.
|
|
50
65
|
*/
|
|
51
|
-
export declare function formatPercent(value: number,
|
|
52
|
-
/**
|
|
53
|
-
* Checks if a value is an integer.
|
|
54
|
-
* @param value The value to check.
|
|
55
|
-
* @returns True if the value is an integer, false otherwise.
|
|
56
|
-
*/
|
|
57
|
-
export declare function isInteger(value: unknown): value is number;
|
|
66
|
+
export declare function formatPercent(value: number, fractionDigitsOrOptions?: number | FormatPercentOptions): string;
|
|
58
67
|
/**
|
|
59
68
|
* Checks if a number is between two values.
|
|
60
69
|
* @param value The number to check.
|
|
@@ -84,15 +93,75 @@ export declare function average(numbers: number[]): number;
|
|
|
84
93
|
*/
|
|
85
94
|
export declare function mod(n: number, m: number): number;
|
|
86
95
|
/**
|
|
87
|
-
* Returns the
|
|
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
|
+
*
|
|
88
144
|
* @param numbers The array of numbers.
|
|
89
|
-
* @returns The
|
|
145
|
+
* @returns The median, or 0 if the array is empty.
|
|
90
146
|
*/
|
|
91
|
-
export declare function
|
|
147
|
+
export declare function median(numbers: number[]): number;
|
|
92
148
|
/**
|
|
93
|
-
* Returns the
|
|
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
|
+
*
|
|
94
162
|
* @param numbers The array of numbers.
|
|
95
|
-
* @
|
|
163
|
+
* @param p The percentile to compute, 0–100 (clamped).
|
|
164
|
+
* @returns The percentile value, or 0 if the array is empty.
|
|
96
165
|
*/
|
|
97
|
-
export declare function
|
|
166
|
+
export declare function percentile(numbers: number[], p: number): number;
|
|
98
167
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/numbers/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAErE;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,SAAI,GAAG,MAAM,CAG3D;AAED
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/numbers/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAErE;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,SAAI,GAAG,MAAM,CAG3D;AAED;;GAEG;AACH,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bers/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import"../chunks/chunk-ANN5UYCF.js";function
|
|
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};
|
package/dist/objects/index.d.ts
CHANGED
|
@@ -48,11 +48,4 @@ export declare function omit<T extends object, K extends keyof T>(obj: T, keys:
|
|
|
48
48
|
* @returns {object}
|
|
49
49
|
*/
|
|
50
50
|
export declare function pick<T extends object, K extends keyof T>(obj: T, keys: K[]): Pick<T, K>;
|
|
51
|
-
/**
|
|
52
|
-
* Deep clones a value using the native structuredClone algorithm.
|
|
53
|
-
* Correctly handles Date, Map, Set, ArrayBuffer, and circular references.
|
|
54
|
-
* @param obj The value to clone.
|
|
55
|
-
* @returns A deep clone of the value.
|
|
56
|
-
*/
|
|
57
|
-
export declare function deepClone<T>(obj: T): T;
|
|
58
51
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/objects/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,wBAAgB,aAAa,CAAC,KAAK,EAAE,GAAG,GAAG,KAAK,IAAI,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAEtE;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,SAAS,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,SAAS,MAAM,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAUzF;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,IAAI,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,SAAS,MAAM,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,GAAG,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,CAMvF;AAED;;;;;GAKG;AACH,wBAAgB,IAAI,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,SAAS,MAAM,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,GAAG,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,CAQvF
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/objects/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,wBAAgB,aAAa,CAAC,KAAK,EAAE,GAAG,GAAG,KAAK,IAAI,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAEtE;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,SAAS,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,SAAS,MAAM,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAUzF;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,IAAI,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,SAAS,MAAM,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,GAAG,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,CAMvF;AAED;;;;;GAKG;AACH,wBAAgB,IAAI,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,SAAS,MAAM,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,GAAG,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,CAQvF"}
|
package/dist/objects/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a,b,c,d
|
|
1
|
+
import{a,b,c,d}from"../chunks/chunk-HUTZTT4Y.js";import"../chunks/chunk-ANN5UYCF.js";export{b as deepMerge,a as isPlainObject,c as omit,d as pick};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as
|
|
1
|
+
import{b as s,c as b,d as r}from"../chunks/chunk-HUTZTT4Y.js";import"../chunks/chunk-ANN5UYCF.js";import{describe as p,expectTypeOf as t,it as o}from"vitest";p("objects \u2014 types",()=>{o("pick narrows to the selected keys",()=>{let e=r({a:1,b:"two",c:!0},["a","c"]);t(e).toEqualTypeOf(),e.b}),o("omit drops the listed keys",()=>{let e=b({a:1,b:"two",c:!0},["b"]);t(e).toEqualTypeOf(),e.b}),o("deepMerge yields the intersection type",()=>{let n=s({x:1},{y:"two"});t(n).toEqualTypeOf()})});
|
package/dist/os/index.d.ts
CHANGED
|
@@ -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
|
*
|
package/dist/os/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/os/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,wBAAgB,
|
|
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.
|
|
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};
|
package/dist/promises/index.d.ts
CHANGED
|
@@ -1,17 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Returns a promise that resolves after a given delay (ms).
|
|
3
|
-
*
|
|
4
|
-
* @example
|
|
5
|
-
* ```typescript
|
|
6
|
-
* const started = Date.now()
|
|
7
|
-
* await delay(100)
|
|
8
|
-
* Date.now() - started >= 100 // true
|
|
9
|
-
* ```
|
|
10
|
-
*
|
|
11
|
-
* @param ms Milliseconds to wait.
|
|
12
|
-
* @returns {Promise<void>}
|
|
13
|
-
*/
|
|
14
|
-
export declare function delay(ms: number): Promise<void>;
|
|
15
1
|
/**
|
|
16
2
|
* Wraps a promise and returns a tuple [error, result].
|
|
17
3
|
* The error slot is `unknown` — narrow it at the call site before touching its properties.
|
|
@@ -45,22 +31,55 @@ export declare function to<T>(promise: Promise<T>): Promise<[unknown, T | undefi
|
|
|
45
31
|
* @returns {Promise<T>}
|
|
46
32
|
*/
|
|
47
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
|
+
};
|
|
48
49
|
/**
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
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>}
|
|
58
66
|
*/
|
|
59
|
-
export declare function
|
|
67
|
+
export declare function retry<T>(fn: (attempt: number, signal?: AbortSignal) => Promise<T>, opts?: RetryOptions): Promise<T>;
|
|
60
68
|
/**
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
*
|
|
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).
|
|
64
83
|
*/
|
|
65
|
-
export declare function
|
|
84
|
+
export declare function mapLimit<T, R>(items: Iterable<T>, limit: number, fn: (item: T, index: number) => Promise<R>): Promise<R[]>;
|
|
66
85
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/promises/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/promises/index.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;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;AAED,oDAAoD;AACpD,MAAM,MAAM,YAAY,GAAG;IAC1B,sFAAsF;IACtF,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,mGAAmG;IACnG,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,2DAA2D;IAC3D,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,+EAA+E;IAC/E,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,uFAAuF;IACvF,WAAW,CAAC,EAAE,CAAC,GAAG,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,KAAK,OAAO,CAAA;IACxD,4FAA4F;IAC5F,MAAM,CAAC,EAAE,WAAW,CAAA;CACpB,CAAA;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAsB,KAAK,CAAC,CAAC,EAC5B,EAAE,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,WAAW,KAAK,OAAO,CAAC,CAAC,CAAC,EACzD,IAAI,GAAE,YAAiB,GACrB,OAAO,CAAC,CAAC,CAAC,CAoBZ;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,QAAQ,CAAC,CAAC,EAAE,CAAC,EAClC,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,EAClB,KAAK,EAAE,MAAM,EACb,EAAE,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,CAAC,CAAC,GACxC,OAAO,CAAC,CAAC,EAAE,CAAC,CAqBd"}
|
package/dist/promises/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a,b,c,d
|
|
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{
|
|
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()})});
|
package/dist/regex/index.d.ts
CHANGED
|
@@ -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":["../../src/regex/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/regex/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAEhD;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAGxE;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,gBAAgB,EAAE,CASlF;AAED;;;;;;GAMG;AAEH,wBAAgB,eAAe,CAC9B,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,MAAM,GAAG,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"}
|
package/dist/regex/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import"../chunks/chunk-ANN5UYCF.js";function n(e){return e.replace(/[.*+?^${}()|[\]
|
|
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};
|
package/dist/security/index.d.ts
CHANGED
|
@@ -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":"
|
|
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"}
|
package/dist/security/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import"../chunks/chunk-ANN5UYCF.js";
|
|
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};
|
package/dist/sleep/index.d.ts
CHANGED
|
@@ -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
|
|
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
|
|
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"}
|
package/dist/sleep/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import"../chunks/chunk-
|
|
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};
|
package/dist/strings/index.d.ts
CHANGED
|
@@ -74,36 +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
|
-
*
|
|
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
|
-
* replace all items in a string using regex
|
|
100
|
-
* @param {string} str
|
|
101
|
-
* @param {string} search
|
|
102
|
-
* @param {string} replacement
|
|
103
|
-
*/
|
|
104
|
-
export declare const replaceString: (str: string, search: string, replacement: string) => string;
|
|
105
|
-
/**
|
|
106
|
-
* Reverses a string.
|
|
84
|
+
* Reverses a string by grapheme, so emoji sequences, flags and combining marks stay intact.
|
|
107
85
|
*
|
|
108
86
|
* @example
|
|
109
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,M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AAE,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
|
|
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};
|
package/dist/system/index.d.ts
CHANGED
|
@@ -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":"
|
|
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"}
|
package/dist/system/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import"../chunks/chunk-ANN5UYCF.js";function
|
|
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};
|