@rzl-zone/utils-js 3.0.2-beta.2 → 3.1.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 (198) hide show
  1. package/README.md +56 -27
  2. package/dist/NumberRangeUnion-DC-C3_Kq.d.ts +23 -23
  3. package/dist/any-BmdI8UbK.d.ts +56 -56
  4. package/dist/arrays-normalize-recursive-CnjYJ9xg.d.ts +66 -66
  5. package/dist/assertions/index.cjs +1 -1
  6. package/dist/assertions/index.d.ts +398 -418
  7. package/dist/assertions/index.js +1 -1
  8. package/dist/chunk-26XIKDJI.cjs +1 -0
  9. package/dist/chunk-2NWHDDM5.js +1 -0
  10. package/dist/chunk-2UIRWYE3.js +1 -0
  11. package/dist/chunk-3KBHD3BS.cjs +1 -0
  12. package/dist/chunk-4HD2O5A4.js +1 -0
  13. package/dist/chunk-5C2SMIGX.cjs +1 -0
  14. package/dist/chunk-5I2B5DOG.js +1 -0
  15. package/dist/chunk-6HQDHIOD.js +1 -0
  16. package/dist/chunk-735HJXBT.cjs +1 -0
  17. package/dist/chunk-7BXIZM57.cjs +1 -0
  18. package/dist/chunk-7KJBDGEP.js +1 -0
  19. package/dist/chunk-7U44T63D.cjs +1 -0
  20. package/dist/chunk-AJ65QFV2.js +1 -0
  21. package/dist/chunk-APHDUCVQ.js +1 -0
  22. package/dist/chunk-BSVZRN7C.js +1 -0
  23. package/dist/chunk-C6JFHUR2.cjs +1 -0
  24. package/dist/chunk-CPLBRGST.js +1 -0
  25. package/dist/chunk-CTBRLEOG.js +1 -0
  26. package/dist/chunk-DUK2K4FB.js +1 -0
  27. package/dist/chunk-DVMHRLKP.cjs +1 -0
  28. package/dist/chunk-E63WVPZE.cjs +1 -0
  29. package/dist/chunk-EBMHQW7X.cjs +1 -0
  30. package/dist/chunk-EGNZCW4K.js +1 -0
  31. package/dist/chunk-FEKDB32T.js +1 -0
  32. package/dist/chunk-FIAAX3UE.js +1 -0
  33. package/dist/chunk-FUS3DVLB.cjs +1 -0
  34. package/dist/chunk-GGRMHIFJ.cjs +1 -0
  35. package/dist/chunk-HQ5GQTEE.js +1 -0
  36. package/dist/chunk-I5X5IN4H.js +1 -0
  37. package/dist/chunk-I7YGXQPI.cjs +1 -0
  38. package/dist/chunk-INUFZJLX.cjs +1 -0
  39. package/dist/chunk-IREHUBF7.js +1 -0
  40. package/dist/chunk-J2RGTPGK.cjs +1 -0
  41. package/dist/chunk-KHO2SBNA.cjs +1 -0
  42. package/dist/chunk-KXIXXSWX.cjs +1 -0
  43. package/dist/chunk-LBMEEJWA.js +1 -0
  44. package/dist/chunk-MC3LXMCQ.js +1 -0
  45. package/dist/chunk-MMSYCIJ2.cjs +1 -1
  46. package/dist/chunk-NU3N4WHD.cjs +1 -0
  47. package/dist/chunk-ODZQXH7E.cjs +1 -0
  48. package/dist/chunk-ONZFBJVW.js +1 -0
  49. package/dist/chunk-PXDRHFIE.js +1 -0
  50. package/dist/chunk-Q6NHYWVX.js +1 -0
  51. package/dist/chunk-QNKGP5DY.js +1 -0
  52. package/dist/chunk-S6Z6I2EG.cjs +1 -0
  53. package/dist/chunk-SMADKXZE.js +1 -0
  54. package/dist/chunk-TSLYDPBJ.js +1 -0
  55. package/dist/chunk-TVXADXCC.cjs +1 -0
  56. package/dist/chunk-UDA26MCU.cjs +1 -0
  57. package/dist/chunk-UET567YM.cjs +1 -0
  58. package/dist/chunk-VEYMQ3UA.js +1 -0
  59. package/dist/chunk-W2W3L2M5.js +1 -0
  60. package/dist/chunk-WBWTXKMC.cjs +1 -0
  61. package/dist/chunk-WVSPXFTY.js +1 -0
  62. package/dist/chunk-XC2PYCT4.cjs +1 -0
  63. package/dist/chunk-XIXA5KDF.cjs +1 -0
  64. package/dist/chunk-Y4O5KZF6.cjs +1 -0
  65. package/dist/chunk-YRM7IJLX.js +1 -0
  66. package/dist/chunk-YT3MSZKK.cjs +1 -0
  67. package/dist/chunk-YXHCULSO.cjs +1 -0
  68. package/dist/chunk-YZR5OGJA.cjs +1 -0
  69. package/dist/chunk-Z4DXK7A6.cjs +1 -0
  70. package/dist/chunk-ZXIWDFEQ.js +1 -0
  71. package/dist/conversions/index.cjs +1 -1
  72. package/dist/conversions/index.d.ts +1368 -1515
  73. package/dist/conversions/index.js +1 -1
  74. package/dist/env/index.cjs +1 -1
  75. package/dist/env/index.d.ts +14 -17
  76. package/dist/env/index.js +1 -1
  77. package/dist/events/index.cjs +1 -1
  78. package/dist/events/index.d.ts +111 -108
  79. package/dist/events/index.js +1 -1
  80. package/dist/extends-Bk_SBGdT.d.ts +367 -0
  81. package/dist/formatting/index.cjs +1 -1
  82. package/dist/formatting/index.d.ts +878 -840
  83. package/dist/formatting/index.js +1 -1
  84. package/dist/generator/index.cjs +1 -1
  85. package/dist/generator/index.d.ts +173 -150
  86. package/dist/generator/index.js +1 -1
  87. package/dist/if-CvT4R7Kh.d.ts +16 -16
  88. package/dist/is-array-Cymwrsmm.d.ts +1119 -0
  89. package/dist/isPlainObject-BVhBAPHX.d.ts +169 -0
  90. package/dist/never-BfayMBF9.d.ts +64 -64
  91. package/dist/next/index.cjs +1 -8
  92. package/dist/next/index.d.ts +196 -176
  93. package/dist/next/index.js +1 -8
  94. package/dist/next/server/index.cjs +1 -2
  95. package/dist/next/server/index.d.ts +26 -40
  96. package/dist/next/server/index.js +1 -2
  97. package/dist/nils-DMz3kU7M.d.ts +155 -155
  98. package/dist/omit-VvmIsZmX.d.ts +25 -25
  99. package/dist/operations/index.cjs +1 -1
  100. package/dist/operations/index.d.ts +121 -176
  101. package/dist/operations/index.js +1 -1
  102. package/dist/or-DyZCRvaU.d.ts +89 -0
  103. package/dist/parsers/index.cjs +1 -1
  104. package/dist/parsers/index.d.ts +35 -36
  105. package/dist/parsers/index.js +1 -1
  106. package/dist/predicates/index.cjs +1 -1
  107. package/dist/predicates/index.d.ts +1797 -1677
  108. package/dist/predicates/index.js +1 -1
  109. package/dist/prettify-C4xLcYOP.d.ts +328 -328
  110. package/dist/promise/index.cjs +1 -1
  111. package/dist/promise/index.d.ts +29 -38
  112. package/dist/promise/index.js +1 -1
  113. package/dist/rzl-utils.global.js +1 -4
  114. package/dist/string-XA-til3C.d.ts +351 -0
  115. package/dist/strings/index.cjs +1 -1
  116. package/dist/strings/index.d.ts +712 -787
  117. package/dist/strings/index.js +1 -1
  118. package/dist/tailwind/index.cjs +1 -0
  119. package/dist/tailwind/index.d.ts +565 -0
  120. package/dist/tailwind/index.js +1 -0
  121. package/dist/type-data-DDs-u2kq.d.ts +241 -241
  122. package/dist/types/index.d.ts +3266 -3266
  123. package/dist/urls/index.cjs +1 -1
  124. package/dist/urls/index.d.ts +384 -409
  125. package/dist/urls/index.js +1 -1
  126. package/package.json +61 -18
  127. package/dist/array-CIZRbqTF.d.ts +0 -223
  128. package/dist/chunk-2TRAPBZ7.cjs +0 -1
  129. package/dist/chunk-3D74QO5D.cjs +0 -1
  130. package/dist/chunk-4DK3RCC4.js +0 -2
  131. package/dist/chunk-4JOQ45HL.js +0 -1
  132. package/dist/chunk-55CZALRS.js +0 -1
  133. package/dist/chunk-56QBKKRE.js +0 -1
  134. package/dist/chunk-5JFV3GDE.cjs +0 -4
  135. package/dist/chunk-5SZUSNGZ.js +0 -1
  136. package/dist/chunk-62HX5Z45.cjs +0 -1
  137. package/dist/chunk-7NA6DUHR.cjs +0 -2
  138. package/dist/chunk-7YWAQOA4.cjs +0 -1
  139. package/dist/chunk-BVPMMWDL.cjs +0 -1
  140. package/dist/chunk-BYZAD3XN.cjs +0 -1
  141. package/dist/chunk-CEFYHEM4.cjs +0 -1
  142. package/dist/chunk-CN53M4QZ.cjs +0 -1
  143. package/dist/chunk-D47MHBSD.cjs +0 -1
  144. package/dist/chunk-DGH75GJD.js +0 -1
  145. package/dist/chunk-E5NUI7PN.js +0 -1
  146. package/dist/chunk-ELDDNERR.js +0 -1
  147. package/dist/chunk-EXZ47NOW.js +0 -1
  148. package/dist/chunk-FDITZ5C6.cjs +0 -1
  149. package/dist/chunk-FF76ISQ2.js +0 -1
  150. package/dist/chunk-FIEZKTAZ.cjs +0 -1
  151. package/dist/chunk-FSSV24W7.cjs +0 -1
  152. package/dist/chunk-GCGU2WB7.js +0 -1
  153. package/dist/chunk-GECI2YBP.js +0 -1
  154. package/dist/chunk-GQE4OVHC.cjs +0 -1
  155. package/dist/chunk-GRVZXQXL.cjs +0 -1
  156. package/dist/chunk-I4AVNHPA.cjs +0 -1
  157. package/dist/chunk-JFRL7NKU.js +0 -4
  158. package/dist/chunk-JWHM3WZQ.cjs +0 -1
  159. package/dist/chunk-KCQDDZJE.cjs +0 -1
  160. package/dist/chunk-L54ZPSYJ.js +0 -1
  161. package/dist/chunk-LVKAYEZ4.js +0 -1
  162. package/dist/chunk-MBDWTK54.cjs +0 -1
  163. package/dist/chunk-MNGGDB2G.js +0 -1
  164. package/dist/chunk-MY7BA4GI.cjs +0 -1
  165. package/dist/chunk-N2IJPIND.cjs +0 -1
  166. package/dist/chunk-NIMNTEGV.js +0 -1
  167. package/dist/chunk-NNM7QCNB.js +0 -1
  168. package/dist/chunk-PUQXRLZH.cjs +0 -1
  169. package/dist/chunk-PVJF2JHM.js +0 -1
  170. package/dist/chunk-QCFXEUKL.js +0 -1
  171. package/dist/chunk-QFCGBBSY.js +0 -1
  172. package/dist/chunk-QQYAUPSK.cjs +0 -1
  173. package/dist/chunk-RN3TP3S3.js +0 -1
  174. package/dist/chunk-RV2VULM7.cjs +0 -1
  175. package/dist/chunk-SW6HYEW7.cjs +0 -1
  176. package/dist/chunk-SYJC7UAW.js +0 -1
  177. package/dist/chunk-TC4VBE4Y.cjs +0 -1
  178. package/dist/chunk-TUXDINHF.cjs +0 -1
  179. package/dist/chunk-U5Y2FXMN.cjs +0 -1
  180. package/dist/chunk-UUPQI6ND.cjs +0 -1
  181. package/dist/chunk-VYCGZ2S6.js +0 -1
  182. package/dist/chunk-W5EDKJK3.js +0 -1
  183. package/dist/chunk-WHAVUFEU.js +0 -1
  184. package/dist/chunk-XCFIOTCV.js +0 -1
  185. package/dist/chunk-XE27XPJR.js +0 -1
  186. package/dist/chunk-XH6MCRLP.js +0 -1
  187. package/dist/chunk-XVB3ZZEB.js +0 -1
  188. package/dist/chunk-ZBSIGJFO.cjs +0 -1
  189. package/dist/chunk-ZYAML74V.js +0 -1
  190. package/dist/extends-Mp81Hq9-.d.ts +0 -145
  191. package/dist/index.cjs +0 -1
  192. package/dist/index.d.ts +0 -1
  193. package/dist/index.js +0 -1
  194. package/dist/is-array-Ckm_47hw.d.ts +0 -1557
  195. package/dist/isPlainObject-BKYaI6a8.d.ts +0 -182
  196. package/dist/stylings/index.cjs +0 -1
  197. package/dist/stylings/index.d.ts +0 -49
  198. package/dist/stylings/index.js +0 -1
@@ -1 +1 @@
1
- export{h as censorEmail,i as chunkString,a as formatCurrency,f as formatDateFns,e as formatDateIntl,d as formatDateTime,b as formatNumber,c as formatPhoneNumber,g as getGMTOffset,j as truncateString}from'../chunk-XE27XPJR.js';import'../chunk-XH6MCRLP.js';import'../chunk-4JOQ45HL.js';import'../chunk-GECI2YBP.js';import'../chunk-NIMNTEGV.js';import'../chunk-XVB3ZZEB.js';import'../chunk-ELDDNERR.js';import'../chunk-MNGGDB2G.js';import'../chunk-5SZUSNGZ.js';import'../chunk-XCFIOTCV.js';
1
+ export{censorEmail,chunkString,formatCurrency,formatDateFns,formatDateIntl,formatDateTime,formatNumber,formatPhoneNumber,getGMTOffset,truncateString}from"../chunk-4HD2O5A4.js";import"../chunk-VEYMQ3UA.js";import"../chunk-DUK2K4FB.js";import"../chunk-Q6NHYWVX.js";import"../chunk-TSLYDPBJ.js";import"../chunk-W2W3L2M5.js";import"../chunk-WVSPXFTY.js";import"../chunk-AJ65QFV2.js";import"../chunk-QNKGP5DY.js";import"../chunk-2UIRWYE3.js";
@@ -1 +1 @@
1
- 'use strict';var chunkQQYAUPSK_cjs=require('../chunk-QQYAUPSK.cjs'),chunkRV2VULM7_cjs=require('../chunk-RV2VULM7.cjs');require('../chunk-PUQXRLZH.cjs'),require('../chunk-U5Y2FXMN.cjs'),require('../chunk-7YWAQOA4.cjs'),require('../chunk-CN53M4QZ.cjs');Object.defineProperty(exports,"getRandomItem",{enumerable:true,get:function(){return chunkQQYAUPSK_cjs.a}});Object.defineProperty(exports,"randomInt",{enumerable:true,get:function(){return chunkQQYAUPSK_cjs.b}});Object.defineProperty(exports,"randomIntByLength",{enumerable:true,get:function(){return chunkQQYAUPSK_cjs.c}});Object.defineProperty(exports,"randomStr",{enumerable:true,get:function(){return chunkQQYAUPSK_cjs.d}});Object.defineProperty(exports,"noop",{enumerable:true,get:function(){return chunkRV2VULM7_cjs.a}});
1
+ "use strict";var e=require("../chunk-TVXADXCC.cjs"),r=require("../chunk-5C2SMIGX.cjs");require("../chunk-DVMHRLKP.cjs"),require("../chunk-E63WVPZE.cjs"),require("../chunk-UDA26MCU.cjs"),require("../chunk-INUFZJLX.cjs"),Object.defineProperty(exports,"getRandomItem",{enumerable:!0,get:function(){return e.getRandomItem}}),Object.defineProperty(exports,"randomInt",{enumerable:!0,get:function(){return e.randomInt}}),Object.defineProperty(exports,"randomIntByLength",{enumerable:!0,get:function(){return e.randomIntByLength}}),Object.defineProperty(exports,"randomStr",{enumerable:!0,get:function(){return e.randomStr}}),Object.defineProperty(exports,"noop",{enumerable:!0,get:function(){return r.noop}});
@@ -1,163 +1,186 @@
1
- import{b as IfNonEmptyArray}from'../array-CIZRbqTF.js';import{F as FixNeverArrayRecursive}from'../arrays-normalize-recursive-CnjYJ9xg.js';import{g as NullToUndefined}from'../nils-DMz3kU7M.js';import'../if-CvT4R7Kh.js';import'../never-BfayMBF9.js';type RandomStringOptions={
2
- /** Ensures no whitespace characters in the generated string. Default: `true`. */
1
+ import{f as IfNonEmptyArray,E as Extends}from'../extends-Bk_SBGdT.js';import{F as FixNeverArrayRecursive}from'../arrays-normalize-recursive-CnjYJ9xg.js';import{g as NullToUndefined}from'../nils-DMz3kU7M.js';import'../if-CvT4R7Kh.js';import'../never-BfayMBF9.js';type OptionsRandomStr={
2
+ /** Ensures no whitespace characters in the generated string, defaultValue: `true`.
3
+ *
4
+ * @default true
5
+ */
3
6
  avoidWhiteSpace?:boolean;
4
- /** Custom characters to replace the default number set if `type` is "number". */
7
+ /** Custom characters to replace the default number set if `type` is `"number"`, defaultValue: `undefined`.
8
+ *
9
+ * @default undefined
10
+ */
5
11
  replaceGenInt?:string;
6
- /** Custom characters to replace the default string set if `type` is "string". */
12
+ /** Custom characters to replace the default string set if `type` is `"string"`, defaultValue: `undefined`.
13
+ *
14
+ * @default undefined
15
+ */
7
16
  replaceGenStr?:string;
8
- /** Additional characters to include in the generated string. */
17
+ /** Additional characters to include in the generated string, defaultValue: `undefined`.
18
+ *
19
+ * @default undefined
20
+ */
9
21
  addChar?:string;
10
- /** Minimum length of the generated string (1 to 5000). Default: `40`. */
22
+ /** Minimum length of the generated string (1 to 5000), defaultValue: `40`.
23
+ *
24
+ * @default 40
25
+ */
11
26
  minLength?:number;
12
- /** Maximum length of the generated string (1 to 5000). Default: `40`. */
27
+ /** Maximum length of the generated string (1 to 5000), defaultValue: `40`.
28
+ *
29
+ * @default 40
30
+ */
13
31
  maxLength?:number;
14
- /** Type of output: "string" (default) or "number". */
32
+ /** Type of output: `"string"` or `"number"`, defaultValue: `"string"`.
33
+ *
34
+ * @default "string"
35
+ */
15
36
  type?:"string"|"number";};
16
37
  /** ---------------------------------
17
- * * ***Returns a random element from a given array.***
18
- * ---------------------------------
19
- *
20
- * @template T - The type of the input array.
21
- *
22
- * @param array - The input array. Can be `null`, `undefined`, or an empty array.
23
- * @returns
24
- * - If `array` is a non-empty tuple, returns one of its elements.
25
- * - If `array` is empty, `null`, or `undefined`, returns `undefined`.
26
- *
27
- * @example
28
- * getRandomItem([]); // undefined
29
- * getRandomItem(null); // undefined
30
- * getRandomItem(undefined); // undefined
31
- * getRandomItem([1, 2, 3, 4]); // number
32
- * getRandomItem(["apple", "banana", "cherry"]); // string
33
- * getRandomItem(["apple", 123, true]); // string | number | boolean
34
- * getRandomItem(["apple", 123, true, null]); // string | number | boolean | undefined
35
- * getRandomItem(["apple", 123, true, undefined]); // string | number | boolean | undefined
36
- *
37
- * // Tuple example:
38
- * const tuple = [1, "two", true] as const;
39
- * getRandomItem(tuple); // 1 | "two" | true
40
- */
41
- declare function getRandomItem(array?:[]|undefined|null):undefined;declare function getRandomItem<T extends readonly unknown[]>(array:T):T extends never[][]?[]:number extends T["length"]?NullToUndefined<FixNeverArrayRecursive<T[number]>>:IfNonEmptyArray<T,NullToUndefined<FixNeverArrayRecursive<T[number]>>,undefined>;declare function getRandomItem<T extends readonly unknown[]|undefined|null>(array?:T):T extends readonly unknown[]?NullToUndefined<FixNeverArrayRecursive<T[number]>>|undefined:undefined;declare function getRandomItem(array:unknown):unknown;
42
- /** ----------------------------
43
- * * ***Generates a random integer within a specified range (inclusive).***
44
- * ----------------------------
45
- *
46
- * @description
47
- * Generates a random integer between `min` and `max` (inclusive),
48
- * with safety constraints:
49
- * - `min` will be forced to be at least `1`.
50
- * - `max` will be capped at `Number.MAX_SAFE_INTEGER`.
51
- *
52
- * Validates input parameters to ensure robust behavior.
53
- *
54
- * @param {number} min - The minimum value (inclusive). Must be an integer.
55
- * @param {number} max - The maximum value (inclusive). Must be an integer.
56
- *
57
- * @returns {number} A random integer N where `min ≤ N ≤ max`.
58
- *
59
- * @throws {Error} If:
60
- * - `min` or `max` is not an integer and value is Number.MIN_VALUE.
61
- * - `min` is greater than `max`.
62
- *
63
- * @example
64
- * randomInt(1, 10); // returns 1 to 10
65
- * randomInt(50, 100); // returns 50 to 100
66
- * randomInt(5, 5); // → always returns 5
67
- *
68
- * @example
69
- * randomInt(-5, 3); // always returns 1, since min is adjusted
70
- *
71
- * @example
72
- * randomInt(1, Number.MAX_SAFE_INTEGER + 10000);
73
- * // → still safely capped at MAX_SAFE_INTEGER
74
- *
75
- * @example
76
- * randomInt(Number.MIN_VALUE, 3); // → Error, min or max cant be as `Number.MIN_VALUE` value.
77
- */
78
- declare const randomInt:(min:number,max:number)=>number;
79
- /** ----------------------------------------------------------
80
- * * ***Generates a random integer within a specified range of digit lengths.***
81
- * ----------------------------------------------------------
82
- *
83
- * @description
84
- * This function allows generating random integers that strictly conform to
85
- * a specified minimum and maximum digit length. It is useful for scenarios
86
- * such as generating realistic-looking IDs, codes, or random test data.
87
- *
88
- * The function ensures:
89
- * - `minLength` is at least 1 and not greater than `maxLength`.
90
- * - `maxLength` is no more than 16 (due to JavaScript's Number.MAX_SAFE_INTEGER).
91
- * - If `avoidZero` is `true`, ensures that `0` is never returned.
92
- *
93
- * @param {object} [options] - Configuration options.
94
- * @param {number} [options.minLength=1] - Minimum number of digits (must be ≥1 and ≤ `maxLength`).
95
- * @param {number} [options.maxLength=16] - Maximum number of digits (must be ≤16).
96
- * @param {boolean} [options.avoidZero=false] - If true, will ensure the result is never zero.
97
- *
98
- * @returns {number} A randomly generated integer within the specified constraints.
99
- *
100
- * @throws {Error} If parameters are invalid, such as:
101
- * - `minLength` < 1
102
- * - `maxLength` > 16
103
- * - `minLength` > `maxLength`
104
- * - non-integer values for `minLength` or `maxLength`
105
- *
106
- * @example
107
- * randomIntByLength({ minLength: 3, maxLength: 5 }); // → (`4829` << random), (`192` << random) or (`71492` << random).
108
- * randomIntByLength({ minLength: 4, maxLength: 4 }); // → `5930` (exact 4 digits)
109
- * randomIntByLength({ avoidZero: true }); // → never 0
110
- */
111
- declare const randomIntByLength:(options?:{
112
- /** * Minimum length of the random number, the `allowed` `minimal` `value` `integer` is `1` `and` `not` `bigger` `than` `value` `of` `maxLength`.
113
- * @default 1
114
- */
38
+ * * ***Returns a random element from a given array.***
39
+ * ---------------------------------
40
+ * @template T - The type of the input array.
41
+ * @param {*} array - The input array. Can be `null`, `undefined`, or an empty array.
42
+ * @returns
43
+ * - If `array` is a non-empty tuple, returns one of its elements.
44
+ * - If `array` is empty, `null`, or `undefined`, returns `undefined`.
45
+ * @example
46
+ * getRandomItem([]);
47
+ * // ➔ undefined
48
+ * getRandomItem(null);
49
+ * // undefined
50
+ * getRandomItem(undefined);
51
+ * // undefined
52
+ * getRandomItem([1, 2, 3, 4]);
53
+ * // number
54
+ * getRandomItem(["apple", "banana", "cherry"]);
55
+ * // string
56
+ * getRandomItem(["apple", 123, true]);
57
+ * // ➔ string | number | boolean
58
+ * getRandomItem(["apple", 123, true, null]);
59
+ * // string | number | boolean | undefined
60
+ * getRandomItem(["apple", 123, true, undefined]);
61
+ * // ➔ string | number | boolean | undefined
62
+ *
63
+ * // Tuple example:
64
+ * const tuple = [1, "two", true] as const;
65
+ * getRandomItem(tuple); // 1 | "two" | true
66
+ */
67
+ declare function getRandomItem(array:undefined):undefined;declare function getRandomItem(array:null):undefined;declare function getRandomItem(array:[]):undefined;declare function getRandomItem<T extends readonly unknown[]>(array:T):T extends never[][]?[]:number extends T["length"]?NullToUndefined<FixNeverArrayRecursive<T[number]>>:IfNonEmptyArray<T,NullToUndefined<FixNeverArrayRecursive<T[number]>>,undefined>;declare function getRandomItem<T extends readonly unknown[]|undefined|null>(array:T):T extends readonly unknown[]?NullToUndefined<FixNeverArrayRecursive<T[number]>>|undefined:undefined;declare function getRandomItem<T>(array:T):unknown extends T?unknown:Extends<any[]|readonly any[],T>extends true?Extract<T,unknown[]|readonly unknown[]>[number]|undefined:Extends<any[],T>extends true?Extract<T,unknown[]|readonly unknown[]>[number]|undefined:Extends<readonly any[],T>extends true?Extract<T,unknown[]|readonly unknown[]>[number]|undefined:undefined;
68
+ /** -----------------------------------------------------------------------
69
+ * * ***Generates a random integer within a specified range (inclusive).***
70
+ * ------------------------------------------------------------------------
71
+ * Generates a random integer between `min` and `max` (inclusive), with safety constraints:
72
+ * - `min` will be forced to be at least `1`.
73
+ * - `max` will be capped at `Number.MAX_SAFE_INTEGER`.
74
+ *
75
+ * Validates input parameters to ensure robust behavior.
76
+ * @param {number} min - The minimum value (inclusive), must be an integer.
77
+ * @param {number} max - The maximum value (inclusive), must be an integer.
78
+ * @returns {number} A random integer N where `min ≤ N ≤ max`.
79
+ * @throws {TypeError} If:
80
+ * - `min` or `max` is not an integer and value is `Number.MIN_VALUE`.
81
+ * - `min` is greater than `max`.
82
+ * @example
83
+ * randomInt(1, 10); // ➔ returns 1 to 10
84
+ * randomInt(50, 100); // ➔ returns 50 to 100
85
+ * randomInt(5, 5); // always returns 5
86
+ * randomInt(-5, 3); // always returns 1, since min is adjusted
87
+ * randomInt(1, Number.MAX_SAFE_INTEGER + 10000);
88
+ * // ➔ still safely capped at MAX_SAFE_INTEGER
89
+ * randomInt(Number.MIN_VALUE, 3);
90
+ * // Error, min or max cant be as `Number.MIN_VALUE` value.
91
+ */
92
+ declare const randomInt:(min:number,max:number)=>number;type OptionsRandomIntByLength={
93
+ /** * Minimum length of the random number, the `allowed minimal value` `integer` is `1` `and not bigger than value of` `maxLength`, defaultValue: `1`.
94
+ *
95
+ * @default 1
96
+ */
115
97
  minLength?:number;
116
- /** * Maximum length of the random number, the `allowed` `maximal` `value` `integer` is `16`.
117
- *
118
- * @default 16
119
- */
98
+ /** * Maximum length of the random number, the `allowed maximal value` `integer` is `16`, defaultValue: `16`.
99
+ *
100
+ * @default 16
101
+ */
120
102
  maxLength?:number;
121
- /** * If true, prevents the result from being zero.
122
- * @default false
123
- */
124
- avoidZero?:boolean;})=>number;
103
+ /** * If true, prevents the result from being zero, defaultValue: `false`.
104
+ *
105
+ * @default false
106
+ */
107
+ avoidZero?:boolean;};
108
+ /** ----------------------------------------------------------------------------
109
+ * * ***Generates a random integer within a specified range of digit lengths.***
110
+ * -----------------------------------------------------------------------------
111
+ * **This function allows generating random integers that strictly conform to a specified minimum and
112
+ * maximum digit length, it is useful for scenarios such as generating realistic-looking IDs, codes,
113
+ * or random test data.**
114
+ * - **The function ensures:**
115
+ * - `minLength` is at least 1 and not greater than `maxLength`.
116
+ * - `maxLength` is no more than 16 (due to JavaScript's Number.MAX_SAFE_INTEGER).
117
+ * - If `avoidZero` is `true`, ensures that `0` is never returned.
118
+ * @param {OptionsRandomIntByLength} [options] - Configuration options.
119
+ * @param {OptionsRandomIntByLength["minLength"]} [options.minLength=1] - Minimum number of digits (must be ≥1 and ≤ `maxLength`).
120
+ * @param {OptionsRandomIntByLength["maxLength"]} [options.maxLength=16] - Maximum number of digits (must be ≤16).
121
+ * @param {OptionsRandomIntByLength["avoidZero"]} [options.avoidZero=false] - If true, will ensure the result is never zero.
122
+ * @returns {number} A randomly generated integer within the specified constraints.
123
+ * @throws {TypeError} If parameters are invalid, such as:
124
+ * - `minLength` < `1`
125
+ * - `maxLength` > `16`
126
+ * - `minLength` > `maxLength`
127
+ * - non-integer values for `minLength` or `maxLength`
128
+ * @example
129
+ * randomIntByLength({ minLength: 3, maxLength: 5 });
130
+ * // ➔ (`4829` << random), (`192` << random) or (`71492` << random).
131
+ * randomIntByLength({ minLength: 4, maxLength: 4 });
132
+ * // ➔ `5930` (exact 4 digits)
133
+ * randomIntByLength({ avoidZero: true });
134
+ * // ➔ never 0
135
+ */
136
+ declare const randomIntByLength:(options?:OptionsRandomIntByLength)=>number;
125
137
  /** ---------------------------------------------------------------------------------
126
- * * ***Generates a random alphanumeric string or number with a specified length range.***
127
- * ---------------------------------------------------------------------------------
128
- *
129
- * @description
130
- * This function allows you to generate random strings or numbers with fully customizable options,
131
- * such as length range, character sets, inclusion of additional characters, and whether to avoid whitespace.
132
- *
133
- * @param {Object} [options] - Configuration options for generating the string.
134
- * @param {number} [options.minLength=40] - Minimum length of the generated string (must be 1).
135
- * @param {number} [options.maxLength=40] - Maximum length of the generated string (must be 5000).
136
- * @param {"string" | "number"} [options.type="string"] - Whether to generate a general alphanumeric string or purely numeric string.
137
- * @param {boolean} [options.avoidWhiteSpace=true] - If true, removes all whitespace, tabs, and newlines from the character set before generating.
138
- * @param {string} [options.replaceGenStr] - A custom character set to use when `type` is `"string"`.
139
- * @param {string} [options.replaceGenInt] - A custom character set to use when `type` is `"number"`.
140
- * @param {string} [options.addChar] - Additional characters to always include in the character set.
141
- *
142
- * @returns {string} The randomly generated string or numeric string of the desired length.
143
- *
144
- * @throws {Error} If provided options are invalid (such as minLength > maxLength, invalid type, or empty character set).
145
- *
146
- * @example
147
- * randomStr(); // Generates a 40-character random alphanumeric string
148
- * randomStr({ minLength: 10, maxLength: 20 }); // → Generates a string between 10 and 20 characters
149
- * randomStr({ type: "number", minLength: 5, maxLength: 5 }); // → "48302"
150
- * randomStr({ replaceGenStr: "ABC ", avoidWhiteSpace: false }); // → String using A, B, C and space
151
- * randomStr({ addChar: "!@#", minLength: 15, maxLength: 15 }); // Guaranteed to include !@# in the set
152
- */
153
- declare const randomStr:(options?:RandomStringOptions)=>string;
138
+ * * ***Generates a random alphanumeric string or number with a specified length range.***
139
+ * ---------------------------------------------------------------------------------
140
+ * **This function allows you to generate random strings or numbers with fully
141
+ * customizable options, such as length range, character sets, inclusion of
142
+ * additional characters, and whether to avoid whitespace.**
143
+ * @param {OptionsRandomStr} [options] - Configuration options for generating the string.
144
+ * @param {OptionsRandomStr["minLength"]} [options.minLength=40] - Minimum length of the generated string (must be `≥` `1`).
145
+ * @param {OptionsRandomStr["maxLength"]} [options.maxLength=40] - Maximum length of the generated string (must be `≤` `5000`).
146
+ * @param {OptionsRandomStr["type"]} [options.type="string"] - Whether to generate a general alphanumeric string or purely numeric string.
147
+ * @param {OptionsRandomStr["avoidWhiteSpace"]} [options.avoidWhiteSpace=true] - If true, removes all whitespace, tabs, and newlines from the character set before generating.
148
+ * @param {OptionsRandomStr["replaceGenStr"]} [options.replaceGenStr] - A custom character set to use when `type` is `"string"`.
149
+ * @param {OptionsRandomStr["replaceGenInt"]} [options.replaceGenInt] - A custom character set to use when `type` is `"number"`.
150
+ * @param {OptionsRandomStr["addChar"]} [options.addChar] - Additional characters to always include in the character set.
151
+ * @returns {string} The randomly generated string or numeric string of the desired length.
152
+ * @throws {TypeError} If provided options are invalid (such as minLength > maxLength, invalid type, or empty character set).
153
+ * @example
154
+ * randomStr();
155
+ * // ➔ Generates a 40-character random alphanumeric string
156
+ * randomStr({ minLength: 10, maxLength: 20 });
157
+ * // ➔ Generates a string between 10 and 20 characters
158
+ * randomStr({ type: "number", minLength: 5, maxLength: 5 });
159
+ * // "48302"
160
+ * randomStr({ replaceGenStr: "ABC ", avoidWhiteSpace: false });
161
+ * // String using A, B, C and space
162
+ * randomStr({ addChar: "!@#", minLength: 15, maxLength: 15 });
163
+ * // Guaranteed to include !@# in the set
164
+ */
165
+ declare const randomStr:(options?:OptionsRandomStr)=>string;
154
166
  /** --------------------------------------------------
155
- * * ***This method returns `undefined`.***
156
- * --------------------------------------------------
157
- *
158
- * @example
159
- * console.log(noop) // => undefined
160
- * isUndefined(noop) // => true
161
- *
162
- */
167
+ * * ***A no-operation function that always returns `undefined`.***
168
+ * --------------------------------------------------
169
+ * **Useful as a default callback, placeholder, or stub function.**
170
+ * @returns {undefined} Always returns `undefined`.
171
+ * @example
172
+ * // Direct call returns undefined
173
+ * noop();
174
+ * // ➔ undefined
175
+ *
176
+ * // Can be used with type-checking helpers
177
+ * isUndefined(noop()); // ➔ true
178
+ * isFunction(noop); // ➔ true
179
+ * isFunction(noop()); // ➔ false
180
+ *
181
+ * // Often used as a default function
182
+ * const callback = noop;
183
+ * callback();
184
+ * // ➔ undefined
185
+ */
163
186
  declare const noop:()=>void;export{getRandomItem,noop,randomInt,randomIntByLength,randomStr};
@@ -1 +1 @@
1
- export{a as getRandomItem,b as randomInt,c as randomIntByLength,d as randomStr}from'../chunk-QCFXEUKL.js';export{a as noop}from'../chunk-SYJC7UAW.js';import'../chunk-ELDDNERR.js';import'../chunk-MNGGDB2G.js';import'../chunk-5SZUSNGZ.js';import'../chunk-XCFIOTCV.js';
1
+ export{getRandomItem,randomInt,randomIntByLength,randomStr}from"../chunk-APHDUCVQ.js";export{noop}from"../chunk-FIAAX3UE.js";import"../chunk-WVSPXFTY.js";import"../chunk-AJ65QFV2.js";import"../chunk-QNKGP5DY.js";import"../chunk-2UIRWYE3.js";
@@ -1,18 +1,18 @@
1
1
  /** -------------------------------------------------------
2
- * * ***If.***
3
- * -------------------------------------------------------
4
- * Conditional: returns the second argument if the first argument is `true`, otherwise returns the third argument.
5
- * - Defaults: `IfTrue = true`, `IfFalse = false`.
6
- *
7
- * @template Condition - The boolean condition to check.
8
- * @template IfTrue - The branch type if condition is `true`. (default: `true`)
9
- * @template IfFalse - The branch type if condition is `false`. (default: `false`)
10
- * @example
11
- * ```ts
12
- * type A = If<true, "valid">;
13
- * // ➔ "valid"
14
- * type B = If<false, "valid", "invalid">;
15
- * // ➔ "invalid"
16
- * ```
17
- */
2
+ * * ***If.***
3
+ * -------------------------------------------------------
4
+ * Conditional: returns the second argument if the first argument is `true`, otherwise returns the third argument.
5
+ * - Defaults: `IfTrue = true`, `IfFalse = false`.
6
+ *
7
+ * @template Condition - The boolean condition to check.
8
+ * @template IfTrue - The branch type if condition is `true`. (default: `true`)
9
+ * @template IfFalse - The branch type if condition is `false`. (default: `false`)
10
+ * @example
11
+ * ```ts
12
+ * type A = If<true, "valid">;
13
+ * // ➔ "valid"
14
+ * type B = If<false, "valid", "invalid">;
15
+ * // ➔ "invalid"
16
+ * ```
17
+ */
18
18
  type If<Condition,IfTrue=true,IfFalse=false>=Condition extends true?IfTrue:IfFalse;export type{If as I};