@tempots/std 0.20.0 → 0.21.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/number.d.ts CHANGED
@@ -165,25 +165,29 @@ export declare const interpolate: (a: number, b: number, t: number) => number;
165
165
  **/
166
166
  export declare const interpolateAngle: (a: number, b: number, t: number, turn?: number) => number;
167
167
  /**
168
- * Calculates the widest angle difference between two angles.
168
+ * Calculates the minimum difference between two angles in degrees.
169
+ * Note: Despite the name "widest", this function actually calculates the shortest
170
+ * angle difference, identical to `angleDifference`. The name is misleading for
171
+ * historical reasons.
169
172
  *
170
173
  * @param a - The first angle in degrees.
171
174
  * @param b - The second angle in degrees.
172
175
  * @param turn - The total angle of a full turn. Defaults to 360 degrees.
173
- * @returns The widest angle difference between `a` and `b`.
176
+ * @returns The shortest angle difference between `a` and `b`.
174
177
  * @public
175
178
  * @example
176
179
  * ```ts
177
- * widestAngleDifference(0, 90) // returns 90
178
- * widestAngleDifference(90, 0) // returns -90
179
- * widestAngleDifference(0, 270) // returns -90
180
- * widestAngleDifference(270, 0) // returns 90
180
+ * widestAngleDifference(0, 90) // returns 90 (shortest path)
181
+ * widestAngleDifference(90, 0) // returns -90 (shortest path)
182
+ * widestAngleDifference(0, 270) // returns -90 (shortest path, not +270)
183
+ * widestAngleDifference(270, 0) // returns 90 (shortest path, not -270)
181
184
  * ```
182
185
  */
183
186
  export declare const widestAngleDifference: (a: number, b: number, turn?: number) => number;
184
187
  /**
185
- * Interpolates values in a polar coordinate system looking for the wideset delta angle.
186
- * It can be either clock-wise or counter-clock-wise.
188
+ * Interpolates values in a polar coordinate system looking for the shortest delta angle.
189
+ * Note: Despite the name "widest", this function actually uses the shortest angle
190
+ * difference, identical to `interpolateAngle`. The name is misleading for historical reasons.
187
191
  *
188
192
  * @param a - The first angle in degrees.
189
193
  * @param b - The second angle in degrees.
@@ -193,10 +197,10 @@ export declare const widestAngleDifference: (a: number, b: number, turn?: number
193
197
  * @public
194
198
  * @example
195
199
  * ```ts
196
- * interpolateWidestAngle(0, 90, 0.5) // returns 45
197
- * interpolateWidestAngle(0, 270, 0.5) // returns 315
198
- * interpolateWidestAngle(0, 90, 0.25) // returns 22.5
199
- * interpolateWidestAngle(0, 270, 0.25) // returns 337.5
200
+ * interpolateWidestAngle(0, 90, 0.5) // returns 45 (using shortest path)
201
+ * interpolateWidestAngle(0, 270, 0.5) // returns 315 (using shortest path)
202
+ * interpolateWidestAngle(0, 90, 0.25) // returns 22.5 (using shortest path)
203
+ * interpolateWidestAngle(0, 270, 0.25) // returns 337.5 (using shortest path)
200
204
  * ```
201
205
  **/
202
206
  export declare const interpolateWidestAngle: (a: number, b: number, t: number, turn?: number) => number;
@@ -321,19 +325,6 @@ export declare const root: (base: number, index: number) => number;
321
325
  * ```
322
326
  **/
323
327
  export declare const roundTo: (f: number, decimals: number) => number;
324
- /**
325
- * `sign` returns `-1` if `value` is a negative number, `1` otherwise.
326
- *
327
- * @param value - The number to check.
328
- * @returns `-1` if the number is negative, `1` otherwise.
329
- * @public
330
- * @example
331
- * ```ts
332
- * sign(-5) // returns -1
333
- * sign(5) // returns 1
334
- * ```
335
- */
336
- export declare const sign: <T extends number>(value: T) => number;
337
328
  /**
338
329
  * Passed two boundaries values (`min`, `max`), `wrap` ensures that the passed value `v` will
339
330
  * be included in the boundaries. If the value exceeds `max`, the value is reduced by `min`
package/number.js CHANGED
@@ -1,32 +1,32 @@
1
1
  import { lpad as a } from "./string.js";
2
- const c = 1e-9, i = (t, e, n = 360) => {
3
- let o = (e - t) % n;
4
- return o < 0 && (o += n), o > n / 2 && (o -= n), o;
2
+ const i = 1e-9, c = (t, e, r = 360) => {
3
+ let n = (e - t) % r;
4
+ return n < 0 && (n += r), n > r / 2 && (n -= r), n;
5
5
  }, h = (t, e) => {
6
- const n = Math.pow(10, e);
7
- return Math.ceil(t * n) / n;
8
- }, l = (t, e, n) => Math.min(Math.max(t, e), n), M = (t, e, n) => Math.trunc(l(t, e, n)), u = (t, e) => l(t, -e, e), g = (t, e) => t < e ? -1 : t > e ? 1 : 0, N = (t, e) => {
9
- const n = Math.pow(10, e);
10
- return Math.floor(t * n) / n;
11
- }, w = (t, e = 0) => a(t.toString(16), "0", e), s = (t, e, n) => (e - t) * n + t, A = (t, e, n, o = 360) => r(s(t, t + i(t, e, o), n), o), f = (t, e, n = 360) => {
12
- let o = (e - t) % n;
13
- return o < 0 && (o += n), o > n / 2 && (o -= n), o;
14
- }, d = (t, e, n, o = 360) => r(s(t, t + f(t, e, o), n), o), m = (t, e, n, o = 360) => (t = r(t, o), e = r(e, o), e < t && (e += o), r(s(t, e, n), o)), C = (t, e, n, o = 360) => (t = r(t, o), e = r(e, o), e > t && (e -= o), r(s(t, e, n), o)), E = (t, e, n = c) => isFinite(t) ? isFinite(e) ? Math.abs(t - e) <= n : !1 : isNaN(t) ? isNaN(e) : isNaN(e) || isFinite(e) ? !1 : t > 0 == e > 0, F = (t, e, n = 360, o = c) => Math.abs(i(t, e, n)) <= o, S = (t, e = c) => Math.abs(t) <= e, T = (t, e) => Math.pow(t, 1 / e), W = (t, e) => {
15
- const n = Math.pow(10, e);
16
- return Math.round(t * n) / n;
17
- }, q = (t) => t < 0 ? -1 : 1, D = (t, e, n) => {
18
- const o = n - e + 1;
19
- return t < e && (t += o * ((e - t) / o + 1)), e + (t - e) % o;
20
- }, r = (t, e) => (t = t % e, t < 0 && (t += e), t);
6
+ const r = Math.pow(10, e);
7
+ return Math.ceil(t * r) / r;
8
+ }, l = (t, e, r) => Math.min(Math.max(t, e), r), u = (t, e, r) => Math.trunc(l(t, e, r)), M = (t, e) => l(t, -e, e), N = (t, e) => t < e ? -1 : t > e ? 1 : 0, g = (t, e) => {
9
+ const r = Math.pow(10, e);
10
+ return Math.floor(t * r) / r;
11
+ }, w = (t, e = 0) => a(t.toString(16), "0", e), s = (t, e, r) => (e - t) * r + t, A = (t, e, r, n = 360) => o(s(t, t + c(t, e, n), r), n), f = (t, e, r = 360) => {
12
+ let n = (e - t) % r;
13
+ return n < 0 && (n += r), n > r / 2 && (n -= r), n;
14
+ }, d = (t, e, r, n = 360) => o(s(t, t + f(t, e, n), r), n), m = (t, e, r, n = 360) => (t = o(t, n), e = o(e, n), e < t && (e += n), o(s(t, e, r), n)), C = (t, e, r, n = 360) => (t = o(t, n), e = o(e, n), e > t && (e -= n), o(s(t, e, r), n)), E = (t, e, r = i) => isFinite(t) ? isFinite(e) ? Math.abs(t - e) <= r : !1 : isNaN(t) && isNaN(e) ? !0 : isNaN(t) || isNaN(e) || isFinite(e) ? !1 : t > 0 == e > 0, F = (t, e, r = 360, n = i) => Math.abs(c(t, e, r)) <= n, S = (t, e = i) => Math.abs(t) <= e, T = (t, e) => Math.pow(t, 1 / e), W = (t, e) => {
15
+ const r = Math.pow(10, e);
16
+ return Math.round(t * r) / r;
17
+ }, q = (t, e, r) => {
18
+ const n = r - e + 1;
19
+ return t < e && (t += n * ((e - t) / n + 1)), e + (t - e) % n;
20
+ }, o = (t, e) => (t = t % e, t < 0 && (t += e), t);
21
21
  export {
22
- c as EPSILON,
23
- i as angleDifference,
22
+ i as EPSILON,
23
+ c as angleDifference,
24
24
  h as ceilTo,
25
25
  l as clamp,
26
- M as clampInt,
27
- u as clampSym,
28
- g as compareNumbers,
29
- N as floorTo,
26
+ u as clampInt,
27
+ M as clampSym,
28
+ N as compareNumbers,
29
+ g as floorTo,
30
30
  s as interpolate,
31
31
  A as interpolateAngle,
32
32
  C as interpolateAngleCCW,
@@ -37,9 +37,8 @@ export {
37
37
  S as nearZero,
38
38
  T as root,
39
39
  W as roundTo,
40
- q as sign,
41
40
  w as toHex,
42
41
  f as widestAngleDifference,
43
- D as wrap,
44
- r as wrapCircular
42
+ q as wrap,
43
+ o as wrapCircular
45
44
  };
package/object.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=e=>Object.keys(e),r=e=>Object.values(e),b=e=>Object.entries(e),j=e=>Object.fromEntries(e),i=(e,t)=>{const n=o(e),c=o(t);if(n.length!==c.length)return!1;for(const s of n)if(!(s in t))return!1;return!0},O=e=>e!=null&&Object.getPrototypeOf(e)===Object.prototype,l=(e,...t)=>o(e).reduce((c,s)=>(t.includes(s)||(c[s]=e[s]),c),{}),u=(e,t)=>Object.assign({},e,t),m=e=>Object.keys(e).length===0;exports.isEmptyObject=m;exports.isObject=O;exports.mergeObjects=u;exports.objectEntries=b;exports.objectFromEntries=j;exports.objectKeys=o;exports.objectValues=r;exports.removeObjectFields=l;exports.sameObjectKeys=i;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=e=>Object.keys(e),i=e=>Object.values(e),l=e=>Object.entries(e),f=e=>Object.fromEntries(e),u=(e,t)=>{const n=r(e),s=r(t);if(n.length!==s.length)return!1;for(const c of n)if(!(c in t))return!1;return!0},O=e=>e!=null&&Object.getPrototypeOf(e)===Object.prototype,a=(e,...t)=>r(e).reduce((s,c)=>(t.includes(c)||(s[c]=e[c]),s),{}),y=(e,t)=>Object.assign({},e,t),b=e=>Object.keys(e).length===0,j=(e,t)=>{const n={};for(const s of t)s in e&&(n[s]=e[s]);return n},m=(e,t)=>{const n={...e};for(const s of t)delete n[s];return n},o=e=>{if(e===null||typeof e!="object")return e;if(e instanceof Date)return new Date(e.getTime());if(e instanceof Array)return e.map(t=>o(t));if(typeof e=="object"){const t={};for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=o(e[n]));return t}return e};exports.deepClone=o;exports.isEmptyObject=b;exports.isObject=O;exports.mergeObjects=y;exports.objectEntries=l;exports.objectFromEntries=f;exports.objectKeys=r;exports.objectValues=i;exports.omit=m;exports.pick=j;exports.removeObjectFields=a;exports.sameObjectKeys=u;
package/object.d.ts CHANGED
@@ -1,33 +1,109 @@
1
1
  import { IndexKey, Merge, TupleToUnion } from './domain';
2
2
  /**
3
- * Returns an array of keys from the given object.
3
+ * Returns an array of keys from the given object with proper type inference.
4
+ *
5
+ * This function provides better type safety than `Object.keys()` by returning
6
+ * `Array<keyof T>` instead of `string[]`, ensuring type correctness when working
7
+ * with the keys in TypeScript.
8
+ *
9
+ * @example
10
+ * ```typescript
11
+ * const user = { id: 1, name: 'Alice', active: true }
12
+ * const keys = objectKeys(user)
13
+ * // Type: Array<'id' | 'name' | 'active'>
14
+ * // Result: ['id', 'name', 'active']
15
+ *
16
+ * // Type-safe iteration
17
+ * keys.forEach(key => {
18
+ * console.log(user[key]) // TypeScript knows this is valid
19
+ * })
20
+ * ```
4
21
  *
5
22
  * @param obj - The object from which to extract keys.
6
- * @returns An array of keys from the object.
23
+ * @returns An array of keys from the object with proper typing.
7
24
  * @public
8
25
  */
9
26
  export declare const objectKeys: <T extends object>(obj: T) => Array<keyof T>;
10
27
  /**
11
- * Returns an array of values from the given object.
28
+ * Returns an array of values from the given object with proper type inference.
29
+ *
30
+ * This function provides better type safety than `Object.values()` by returning
31
+ * `Array<T[keyof T]>` instead of `unknown[]`, preserving the union type of all
32
+ * possible values in the object.
33
+ *
34
+ * @example
35
+ * ```typescript
36
+ * const user = { id: 1, name: 'Alice', active: true }
37
+ * const values = objectValues(user)
38
+ * // Type: Array<number | string | boolean>
39
+ * // Result: [1, 'Alice', true]
40
+ *
41
+ * // Type-safe processing
42
+ * values.forEach(value => {
43
+ * // TypeScript knows value can be number | string | boolean
44
+ * if (typeof value === 'string') {
45
+ * console.log(value.toUpperCase())
46
+ * }
47
+ * })
48
+ * ```
12
49
  *
13
50
  * @param obj - The object from which to extract values.
14
- * @returns An array of values from the object.
51
+ * @returns An array of values from the object with proper typing.
15
52
  * @public
16
53
  */
17
54
  export declare const objectValues: <T extends object>(obj: T) => Array<T[keyof T]>;
18
55
  /**
19
- * Returns an array of entries (key-value pairs) from the given object.
56
+ * Returns an array of entries (key-value pairs) from the given object with proper type inference.
57
+ *
58
+ * This function provides better type safety than `Object.entries()` by returning
59
+ * `[keyof T, T[keyof T]][]` instead of `[string, unknown][]`, preserving both
60
+ * key and value types for type-safe destructuring and iteration.
61
+ *
62
+ * @example
63
+ * ```typescript
64
+ * const user = { id: 1, name: 'Alice', active: true }
65
+ * const entries = objectEntries(user)
66
+ * // Type: Array<['id' | 'name' | 'active', number | string | boolean]>
67
+ * // Result: [['id', 1], ['name', 'Alice'], ['active', true]]
68
+ *
69
+ * // Type-safe destructuring
70
+ * entries.forEach(([key, value]) => {
71
+ * // TypeScript knows key is 'id' | 'name' | 'active'
72
+ * // TypeScript knows value is number | string | boolean
73
+ * console.log(`${key}: ${value}`)
74
+ * })
75
+ * ```
20
76
  *
21
77
  * @param obj - The object from which to extract entries.
22
- * @returns An array of tuples, where each tuple contains a key and its corresponding value from the object.
78
+ * @returns An array of tuples with proper typing, where each tuple contains a key and its corresponding value.
23
79
  * @public
24
80
  */
25
81
  export declare const objectEntries: <T extends object>(obj: T) => [keyof T, T[keyof T]][];
26
82
  /**
27
- * Creates an object from an array of entries.
83
+ * Creates an object from an array of entries with proper type inference.
84
+ *
85
+ * This function provides better type safety than `Object.fromEntries()` by
86
+ * accepting properly typed entries and returning a typed object instead of
87
+ * `{ [k: string]: unknown }`.
88
+ *
89
+ * @example
90
+ * ```typescript
91
+ * const entries: [string, number][] = [['a', 1], ['b', 2], ['c', 3]]
92
+ * const obj = objectFromEntries(entries)
93
+ * // Type: { [x: string]: number }
94
+ * // Result: { a: 1, b: 2, c: 3 }
95
+ *
96
+ * // Works with union types
97
+ * const mixedEntries: Array<['id' | 'name', number | string]> = [
98
+ * ['id', 123],
99
+ * ['name', 'Alice']
100
+ * ]
101
+ * const user = objectFromEntries(mixedEntries)
102
+ * // Type: { [x: string]: number | string }
103
+ * ```
28
104
  *
29
105
  * @param entries - The array of entries to create an object from.
30
- * @returns The created object.
106
+ * @returns The created object with proper typing.
31
107
  * @public
32
108
  */
33
109
  export declare const objectFromEntries: <T extends object>(entries: [keyof T, T[keyof T]][]) => T;
@@ -77,3 +153,65 @@ export declare const mergeObjects: <A extends Record<IndexKey, unknown>, B exten
77
153
  * @public
78
154
  */
79
155
  export declare const isEmptyObject: (obj: object) => boolean;
156
+ /**
157
+ * Creates a new object with only the specified keys from the source object.
158
+ *
159
+ * This function provides type-safe property selection, ensuring that only
160
+ * valid keys can be picked and the result type reflects the selected properties.
161
+ *
162
+ * @example
163
+ * ```typescript
164
+ * const user = { id: 1, name: 'Alice', email: 'alice@example.com', password: 'secret' }
165
+ * const publicUser = pick(user, ['id', 'name', 'email'])
166
+ * // Result: { id: 1, name: 'Alice', email: 'alice@example.com' }
167
+ * // Type: Pick<typeof user, 'id' | 'name' | 'email'>
168
+ * ```
169
+ *
170
+ * @param obj - The source object
171
+ * @param keys - Array of keys to pick
172
+ * @returns A new object containing only the specified keys
173
+ * @public
174
+ */
175
+ export declare const pick: <T extends object, K extends keyof T>(obj: T, keys: readonly K[]) => Pick<T, K>;
176
+ /**
177
+ * Creates a new object with all keys except the specified ones from the source object.
178
+ *
179
+ * This function provides type-safe property exclusion, ensuring that only
180
+ * valid keys can be omitted and the result type reflects the remaining properties.
181
+ *
182
+ * @example
183
+ * ```typescript
184
+ * const user = { id: 1, name: 'Alice', email: 'alice@example.com', password: 'secret' }
185
+ * const publicUser = omit(user, ['password'])
186
+ * // Result: { id: 1, name: 'Alice', email: 'alice@example.com' }
187
+ * // Type: Omit<typeof user, 'password'>
188
+ * ```
189
+ *
190
+ * @param obj - The source object
191
+ * @param keys - Array of keys to omit
192
+ * @returns A new object without the specified keys
193
+ * @public
194
+ */
195
+ export declare const omit: <T extends object, K extends keyof T>(obj: T, keys: readonly K[]) => Omit<T, K>;
196
+ /**
197
+ * Creates a deep clone of an object.
198
+ *
199
+ * This function recursively clones objects, arrays, and primitive values.
200
+ * It handles Date objects specially and avoids infinite recursion.
201
+ *
202
+ * @example
203
+ * ```typescript
204
+ * const original = {
205
+ * name: 'Alice',
206
+ * settings: { theme: 'dark', notifications: true },
207
+ * tags: ['user', 'admin']
208
+ * }
209
+ * const cloned = deepClone(original)
210
+ * cloned.settings.theme = 'light' // Original remains unchanged
211
+ * ```
212
+ *
213
+ * @param obj - The object to clone
214
+ * @returns A deep clone of the object
215
+ * @public
216
+ */
217
+ export declare const deepClone: <T>(obj: T) => T;
package/object.js CHANGED
@@ -1,18 +1,45 @@
1
- const o = (e) => Object.keys(e), r = (e) => Object.values(e), j = (e) => Object.entries(e), b = (e) => Object.fromEntries(e), O = (e, t) => {
2
- const n = o(e), c = o(t);
3
- if (n.length !== c.length) return !1;
4
- for (const s of n)
5
- if (!(s in t)) return !1;
1
+ const c = (e) => Object.keys(e), i = (e) => Object.values(e), f = (e) => Object.entries(e), u = (e) => Object.fromEntries(e), l = (e, t) => {
2
+ const n = c(e), s = c(t);
3
+ if (n.length !== s.length) return !1;
4
+ for (const r of n)
5
+ if (!(r in t)) return !1;
6
6
  return !0;
7
- }, i = (e) => e != null && Object.getPrototypeOf(e) === Object.prototype, l = (e, ...t) => o(e).reduce((c, s) => (t.includes(s) || (c[s] = e[s]), c), {}), u = (e, t) => Object.assign({}, e, t), f = (e) => Object.keys(e).length === 0;
7
+ }, O = (e) => e != null && Object.getPrototypeOf(e) === Object.prototype, a = (e, ...t) => c(e).reduce((s, r) => (t.includes(r) || (s[r] = e[r]), s), {}), p = (e, t) => Object.assign({}, e, t), y = (e) => Object.keys(e).length === 0, k = (e, t) => {
8
+ const n = {};
9
+ for (const s of t)
10
+ s in e && (n[s] = e[s]);
11
+ return n;
12
+ }, m = (e, t) => {
13
+ const n = { ...e };
14
+ for (const s of t)
15
+ delete n[s];
16
+ return n;
17
+ }, o = (e) => {
18
+ if (e === null || typeof e != "object")
19
+ return e;
20
+ if (e instanceof Date)
21
+ return new Date(e.getTime());
22
+ if (e instanceof Array)
23
+ return e.map((t) => o(t));
24
+ if (typeof e == "object") {
25
+ const t = {};
26
+ for (const n in e)
27
+ Object.prototype.hasOwnProperty.call(e, n) && (t[n] = o(e[n]));
28
+ return t;
29
+ }
30
+ return e;
31
+ };
8
32
  export {
9
- f as isEmptyObject,
10
- i as isObject,
11
- u as mergeObjects,
12
- j as objectEntries,
13
- b as objectFromEntries,
14
- o as objectKeys,
15
- r as objectValues,
16
- l as removeObjectFields,
17
- O as sameObjectKeys
33
+ o as deepClone,
34
+ y as isEmptyObject,
35
+ O as isObject,
36
+ p as mergeObjects,
37
+ f as objectEntries,
38
+ u as objectFromEntries,
39
+ c as objectKeys,
40
+ i as objectValues,
41
+ m as omit,
42
+ k as pick,
43
+ a as removeObjectFields,
44
+ l as sameObjectKeys
18
45
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tempots/std",
3
- "version": "0.20.0",
3
+ "version": "0.21.0",
4
4
  "priority": 8,
5
5
  "description": "Std library for TypeScript. Natural complement to the Tempo libraries.",
6
6
  "keywords": [
@@ -41,6 +41,10 @@
41
41
  "import": "./boolean.js",
42
42
  "require": "./boolean.cjs"
43
43
  },
44
+ "./date": {
45
+ "import": "./date.js",
46
+ "require": "./date.cjs"
47
+ },
44
48
  "./deferred": {
45
49
  "import": "./deferred.js",
46
50
  "require": "./deferred.cjs"
@@ -61,10 +65,18 @@
61
65
  "import": "./function.js",
62
66
  "require": "./function.cjs"
63
67
  },
68
+ "./iterator": {
69
+ "import": "./iterator.js",
70
+ "require": "./iterator.cjs"
71
+ },
64
72
  "./json": {
65
73
  "import": "./json.js",
66
74
  "require": "./json.cjs"
67
75
  },
76
+ "./map": {
77
+ "import": "./map.js",
78
+ "require": "./map.cjs"
79
+ },
68
80
  "./number": {
69
81
  "import": "./number.js",
70
82
  "require": "./number.cjs"
@@ -77,6 +89,10 @@
77
89
  "import": "./promise.js",
78
90
  "require": "./promise.cjs"
79
91
  },
92
+ "./random": {
93
+ "import": "./random.js",
94
+ "require": "./random.cjs"
95
+ },
80
96
  "./regexp": {
81
97
  "import": "./regexp.js",
82
98
  "require": "./regexp.cjs"
@@ -85,6 +101,10 @@
85
101
  "import": "./result.js",
86
102
  "require": "./result.cjs"
87
103
  },
104
+ "./set": {
105
+ "import": "./set.js",
106
+ "require": "./set.cjs"
107
+ },
88
108
  "./string": {
89
109
  "import": "./string.js",
90
110
  "require": "./string.cjs"
@@ -97,6 +117,10 @@
97
117
  "import": "./union.js",
98
118
  "require": "./union.cjs"
99
119
  },
120
+ "./url": {
121
+ "import": "./url.js",
122
+ "require": "./url.cjs"
123
+ },
100
124
  "./validation": {
101
125
  "import": "./validation.js",
102
126
  "require": "./validation.cjs"
@@ -124,6 +148,9 @@
124
148
  "boolean": [
125
149
  "./boolean.d.ts"
126
150
  ],
151
+ "date": [
152
+ "./date.d.ts"
153
+ ],
127
154
  "deferred": [
128
155
  "./deferred.d.ts"
129
156
  ],
@@ -139,9 +166,15 @@
139
166
  "function": [
140
167
  "./function.d.ts"
141
168
  ],
169
+ "iterator": [
170
+ "./iterator.d.ts"
171
+ ],
142
172
  "json": [
143
173
  "./json.d.ts"
144
174
  ],
175
+ "map": [
176
+ "./map.d.ts"
177
+ ],
145
178
  "number": [
146
179
  "./number.d.ts"
147
180
  ],
@@ -151,12 +184,18 @@
151
184
  "promise": [
152
185
  "./promise.d.ts"
153
186
  ],
187
+ "random": [
188
+ "./random.d.ts"
189
+ ],
154
190
  "regexp": [
155
191
  "./regexp.d.ts"
156
192
  ],
157
193
  "result": [
158
194
  "./result.d.ts"
159
195
  ],
196
+ "set": [
197
+ "./set.d.ts"
198
+ ],
160
199
  "string": [
161
200
  "./string.d.ts"
162
201
  ],
@@ -166,6 +205,9 @@
166
205
  "union": [
167
206
  "./union.d.ts"
168
207
  ],
208
+ "url": [
209
+ "./url.d.ts"
210
+ ],
169
211
  "validation": [
170
212
  "./validation.d.ts"
171
213
  ]
package/random.cjs ADDED
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=(t,e)=>{if(t>e)throw new Error("min must be less than or equal to max");return Math.floor(Math.random()*(e-t+1))+t},l=(t,e,n=!1)=>{if(t>e)throw new Error("min must be less than or equal to max");const r=Math.random(),o=e-t;return r*o+t},x=t=>{if(t.length===0)throw new Error("Cannot choose from empty array");const e=s(0,t.length-1);return t[e]},c=(t,e)=>{if(t.length===0)throw new Error("Cannot choose from empty array");if(e>t.length)throw new Error("Cannot select more elements than available in array");if(e<=0)return[];const n=[...t];for(let r=n.length-1;r>0;r--){const o=s(0,r);[n[r],n[o]]=[n[o],n[r]]}return n.slice(0,e)},h=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{const e=Math.random()*16|0;return(t==="x"?e:e&3|8).toString(16)}),d=t=>{if(t<=0)return"";const e="0123456789abcdef";let n="";for(let r=0;r<t;r++)n+=e[s(0,e.length-1)];return n},f=t=>{if(t<=0)return new Uint8Array(0);const e=new Uint8Array(t);for(let n=0;n<t;n++)e[n]=s(0,255);return e},u=t=>{let e=0;for(let r=0;r<t.length;r++){const o=t.charCodeAt(r);e=(e<<5)-e+o,e=e&e}let n=Math.abs(e);return()=>(n=(n*1664525+1013904223)%4294967296,n/4294967296)},a=t=>{for(let e=t.length-1;e>0;e--){const n=s(0,e);[t[e],t[n]]=[t[n],t[e]]}return t},i=t=>a([...t]);exports.randomBytes=f;exports.randomChoice=x;exports.randomChoices=c;exports.randomFloat=l;exports.randomHex=d;exports.randomInt=s;exports.randomUuid=h;exports.seedRandom=u;exports.shuffle=a;exports.shuffled=i;