@rzl-zone/utils-js 3.10.0 → 3.11.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/README.md +36 -18
- package/dist/assertions/index.cjs +11 -11
- package/dist/assertions/index.d.ts +487 -215
- package/dist/assertions/index.js +5 -5
- package/dist/{chunk-SN5HAK3Y.js → chunk-22V4WP3H.js} +4 -4
- package/dist/{chunk-EJV5AF4L.js → chunk-2XSZ2ANI.js} +2 -2
- package/dist/{chunk-OSSFLQDD.js → chunk-3T6VSWYX.js} +2 -2
- package/dist/{chunk-3LE6NX57.js → chunk-5WIEDF2J.js} +4 -4
- package/dist/{chunk-WLEZ2KSG.cjs → chunk-6EDFZJZ5.cjs} +126 -126
- package/dist/{chunk-GHU356XQ.js → chunk-6LXWT2I5.js} +3 -3
- package/dist/{chunk-GKDSBOYE.js → chunk-6YGBRENU.js} +3 -3
- package/dist/{chunk-NAOVH4OH.cjs → chunk-7FGNVDEV.cjs} +7 -7
- package/dist/{chunk-X6ULJZ3X.js → chunk-AXDYWO67.js} +2 -2
- package/dist/{chunk-UV5BKAYW.cjs → chunk-B6PMNZ4M.cjs} +7 -7
- package/dist/chunk-BAV5T2E3.cjs +1 -1
- package/dist/{chunk-YHFRCVTN.js → chunk-BLF7SD66.js} +3 -3
- package/dist/{chunk-QZI5PVCI.cjs → chunk-BMZZXZJ2.cjs} +4 -4
- package/dist/{chunk-DXPM4NOU.js → chunk-BOYP3ARU.js} +4 -4
- package/dist/{chunk-UXT4XSUK.js → chunk-BPYW5YL7.js} +2 -2
- package/dist/{chunk-QGTFQ7RO.cjs → chunk-C2PV3VWC.cjs} +6 -6
- package/dist/{chunk-MZ3T6L7Z.js → chunk-CCJ2MSN7.js} +2 -2
- package/dist/{chunk-H44QVAZL.cjs → chunk-DAPAK2W3.cjs} +31 -31
- package/dist/{chunk-OYFUBKEG.cjs → chunk-DLS3G6WQ.cjs} +4 -4
- package/dist/{chunk-MS2KSKD7.js → chunk-DNMCR5JH.js} +9 -9
- package/dist/chunk-DVMHRLKP.cjs +1 -1
- package/dist/{chunk-IX6PF5ZP.cjs → chunk-EBYFYZW4.cjs} +4 -4
- package/dist/{chunk-5Y6JL47L.js → chunk-ENMRZ4BE.js} +3 -3
- package/dist/{chunk-7EIFPHV3.js → chunk-FJ4BQFVO.js} +8 -8
- package/dist/{chunk-TJ5OY6MC.cjs → chunk-GIKL4PUF.cjs} +10 -10
- package/dist/{chunk-M5QB2GM5.js → chunk-GOFINGT6.js} +2 -2
- package/dist/{chunk-J6VLFVIL.js → chunk-GXKQ3LHF.js} +3 -3
- package/dist/{chunk-5KDVIEVO.js → chunk-HNBRGN4R.js} +2 -2
- package/dist/{chunk-OCTHWEZK.cjs → chunk-HYN6FC5A.cjs} +34 -34
- package/dist/{chunk-MBFVTGYS.js → chunk-IZGVBYFN.js} +4 -4
- package/dist/{chunk-QXTJVDWE.js → chunk-JIE447J5.js} +3 -3
- package/dist/{chunk-UFYMRRJH.cjs → chunk-JXEIJM5M.cjs} +61 -61
- package/dist/{chunk-WB3FT62A.js → chunk-K47GZDBH.js} +3 -3
- package/dist/{chunk-KUVRZ2JW.cjs → chunk-K5536YHG.cjs} +50 -50
- package/dist/chunk-KHO2SBNA.cjs +1 -1
- package/dist/{chunk-NJ24M6ZH.cjs → chunk-KXJ7X325.cjs} +37 -37
- package/dist/chunk-L5RDAVVH.js +1 -1
- package/dist/{chunk-SRWL4YCP.js → chunk-LJHPTLWB.js} +7 -7
- package/dist/{chunk-6AMDHVS2.cjs → chunk-M7ELWZXM.cjs} +9 -9
- package/dist/chunk-MSUW5VHZ.js +1590 -0
- package/dist/{chunk-2XGQQZ6A.cjs → chunk-MUHRPRR7.cjs} +3 -3
- package/dist/{chunk-XYWC4EQ3.cjs → chunk-MV3TSQSH.cjs} +71 -71
- package/dist/{chunk-VCYXNIZ2.cjs → chunk-NLZLXWAU.cjs} +9 -9
- package/dist/{chunk-76ATVDCR.cjs → chunk-NVRZPF5M.cjs} +3 -3
- package/dist/chunk-ONZFBJVW.js +1 -1
- package/dist/{chunk-62FS7WMB.cjs → chunk-PGNL7JXO.cjs} +31 -31
- package/dist/{chunk-JI57K7D4.cjs → chunk-Q4GEQS7X.cjs} +161 -161
- package/dist/chunk-QNKGP5DY.js +1 -1
- package/dist/{chunk-ZTHJQJ5F.cjs → chunk-QYI2VJLS.cjs} +9 -9
- package/dist/{chunk-C7GC2PFX.js → chunk-RBWZII5I.js} +3 -3
- package/dist/{chunk-MMRHKYT6.cjs → chunk-RMP7VMPB.cjs} +12 -12
- package/dist/{chunk-TXOVQZPU.js → chunk-RZOGBYIS.js} +2 -2
- package/dist/{chunk-ALRISPTL.cjs → chunk-SU3UELUB.cjs} +3 -3
- package/dist/chunk-SYHPSOUU.cjs +1626 -0
- package/dist/{chunk-R2DR7SPJ.js → chunk-SZUNAEMR.js} +6 -6
- package/dist/{chunk-YVRUY4EW.cjs → chunk-TER22LO4.cjs} +8 -8
- package/dist/{chunk-WRGN6UBK.js → chunk-TJHGRQ4P.js} +2 -2
- package/dist/{chunk-I33PB44Q.cjs → chunk-U23I7JPB.cjs} +15 -15
- package/dist/{chunk-VBSLIIDB.js → chunk-U7HHN47R.js} +10 -10
- package/dist/chunk-UDA26MCU.cjs +1 -1
- package/dist/{chunk-44X74C26.js → chunk-UIAWUZ4H.js} +4 -4
- package/dist/{chunk-5O66AUEC.js → chunk-ULQPCIA2.js} +2 -2
- package/dist/chunk-VJDDGRIK.cjs +1 -1
- package/dist/{chunk-6WVOUVWD.js → chunk-WETQI6HM.js} +9 -9
- package/dist/{chunk-FWWPEL7J.cjs → chunk-WLOQQFDS.cjs} +3 -3
- package/dist/chunk-WVSPXFTY.js +1 -1
- package/dist/{chunk-WKM6UVMG.cjs → chunk-WXFTVXBF.cjs} +4 -4
- package/dist/{chunk-YQHJB7KR.cjs → chunk-XPVTIGU2.cjs} +26 -26
- package/dist/{chunk-PWKOFPAH.cjs → chunk-XX6RUGTM.cjs} +3 -3
- package/dist/chunk-YWHHVDT4.js +1 -1
- package/dist/{chunk-7NXFGJJE.cjs → chunk-ZPDMWDGZ.cjs} +14 -14
- package/dist/{chunk-JYOCB6OV.js → chunk-ZVWZEGQP.js} +2 -2
- package/dist/conversions/index.cjs +34 -34
- package/dist/conversions/index.d.ts +489 -333
- package/dist/conversions/index.js +15 -15
- package/dist/events/index.cjs +8 -8
- package/dist/events/index.d.ts +35 -29
- package/dist/events/index.js +4 -4
- package/dist/formatters/index.cjs +19 -19
- package/dist/formatters/index.d.ts +917 -873
- package/dist/formatters/index.js +9 -9
- package/dist/generators/index.cjs +9 -9
- package/dist/generators/index.d.ts +104 -86
- package/dist/generators/index.js +4 -4
- package/dist/index.d.ts +1 -1
- package/dist/isPlainObject-0p3VveWr.d.ts +534 -0
- package/dist/next/index.cjs +37 -37
- package/dist/next/index.d.ts +36 -21
- package/dist/next/index.js +9 -9
- package/dist/next/server/index.cjs +4 -4
- package/dist/next/server/index.d.ts +6 -3
- package/dist/next/server/index.js +2 -2
- package/dist/operations/index.cjs +11 -11
- package/dist/operations/index.d.ts +14 -5
- package/dist/operations/index.js +8 -8
- package/dist/parsers/index.cjs +6 -6
- package/dist/parsers/index.d.ts +68 -65
- package/dist/parsers/index.js +5 -5
- package/dist/predicates/index.cjs +77 -77
- package/dist/predicates/index.d.ts +442 -258
- package/dist/predicates/index.js +14 -14
- package/dist/promises/index.cjs +6 -6
- package/dist/promises/index.d.ts +28 -16
- package/dist/promises/index.js +4 -4
- package/dist/rzl-utils.global.js +2 -2
- package/dist/strings/index.cjs +23 -23
- package/dist/strings/index.d.ts +82 -54
- package/dist/strings/index.js +7 -7
- package/dist/tailwind/index.cjs +13 -13
- package/dist/tailwind/index.d.ts +186 -169
- package/dist/tailwind/index.js +5 -5
- package/dist/urls/index.cjs +23 -23
- package/dist/urls/index.d.ts +252 -229
- package/dist/urls/index.js +16 -16
- package/package.json +2 -2
- package/dist/chunk-7C7TQC5J.cjs +0 -620
- package/dist/chunk-J4TT33ZX.js +0 -584
- package/dist/isPlainObject-BTPjv6zB.d.ts +0 -178
package/dist/formatters/index.js
CHANGED
|
@@ -2,18 +2,18 @@
|
|
|
2
2
|
* ====================================================
|
|
3
3
|
* Rzl Utils-JS.
|
|
4
4
|
* ----------------------------------------------------
|
|
5
|
-
* Version: 3.
|
|
5
|
+
* Version: 3.11.0.
|
|
6
6
|
* Author: Rizalvin Dwiky.
|
|
7
7
|
* Repository: https://github.com/rzl-zone/utils-js.
|
|
8
8
|
* ====================================================
|
|
9
9
|
*/
|
|
10
|
-
export { censorEmail, chunkString, formatCurrency, formatDateFns, formatDateIntl, formatDateTime, formatNumber, formatPhoneNumber, getGMTOffset, truncateString } from '../chunk-
|
|
11
|
-
import '../chunk-
|
|
12
|
-
import '../chunk-
|
|
13
|
-
import '../chunk-
|
|
10
|
+
export { censorEmail, chunkString, formatCurrency, formatDateFns, formatDateIntl, formatDateTime, formatNumber, formatPhoneNumber, getGMTOffset, truncateString } from '../chunk-FJ4BQFVO.js';
|
|
11
|
+
import '../chunk-ZVWZEGQP.js';
|
|
12
|
+
import '../chunk-2XSZ2ANI.js';
|
|
13
|
+
import '../chunk-CCJ2MSN7.js';
|
|
14
14
|
import '../chunk-WVSPXFTY.js';
|
|
15
|
-
import '../chunk-
|
|
16
|
-
import '../chunk-
|
|
17
|
-
import '../chunk-
|
|
15
|
+
import '../chunk-ULQPCIA2.js';
|
|
16
|
+
import '../chunk-3T6VSWYX.js';
|
|
17
|
+
import '../chunk-AXDYWO67.js';
|
|
18
18
|
import '../chunk-QNKGP5DY.js';
|
|
19
|
-
import '../chunk-
|
|
19
|
+
import '../chunk-MSUW5VHZ.js';
|
|
@@ -2,39 +2,39 @@
|
|
|
2
2
|
* ====================================================
|
|
3
3
|
* Rzl Utils-JS.
|
|
4
4
|
* ----------------------------------------------------
|
|
5
|
-
* Version: 3.
|
|
5
|
+
* Version: 3.11.0.
|
|
6
6
|
* Author: Rizalvin Dwiky.
|
|
7
7
|
* Repository: https://github.com/rzl-zone/utils-js.
|
|
8
8
|
* ====================================================
|
|
9
9
|
*/
|
|
10
10
|
'use strict';
|
|
11
11
|
|
|
12
|
-
var
|
|
12
|
+
var chunkKXJ7X325_cjs = require('../chunk-KXJ7X325.cjs');
|
|
13
13
|
require('../chunk-DVMHRLKP.cjs');
|
|
14
14
|
var chunkBAV5T2E3_cjs = require('../chunk-BAV5T2E3.cjs');
|
|
15
|
-
require('../chunk-
|
|
15
|
+
require('../chunk-DAPAK2W3.cjs');
|
|
16
16
|
require('../chunk-UDA26MCU.cjs');
|
|
17
|
-
require('../chunk-
|
|
17
|
+
require('../chunk-SYHPSOUU.cjs');
|
|
18
18
|
|
|
19
19
|
Object.defineProperty(exports, "getRandomItem", {
|
|
20
20
|
enumerable: true,
|
|
21
|
-
get: function () { return
|
|
21
|
+
get: function () { return chunkKXJ7X325_cjs.getRandomItem; }
|
|
22
22
|
});
|
|
23
23
|
Object.defineProperty(exports, "randomInt", {
|
|
24
24
|
enumerable: true,
|
|
25
|
-
get: function () { return
|
|
25
|
+
get: function () { return chunkKXJ7X325_cjs.randomInt; }
|
|
26
26
|
});
|
|
27
27
|
Object.defineProperty(exports, "randomIntByLength", {
|
|
28
28
|
enumerable: true,
|
|
29
|
-
get: function () { return
|
|
29
|
+
get: function () { return chunkKXJ7X325_cjs.randomIntByLength; }
|
|
30
30
|
});
|
|
31
31
|
Object.defineProperty(exports, "randomStr", {
|
|
32
32
|
enumerable: true,
|
|
33
|
-
get: function () { return
|
|
33
|
+
get: function () { return chunkKXJ7X325_cjs.randomStr; }
|
|
34
34
|
});
|
|
35
35
|
Object.defineProperty(exports, "randomUUID", {
|
|
36
36
|
enumerable: true,
|
|
37
|
-
get: function () { return
|
|
37
|
+
get: function () { return chunkKXJ7X325_cjs.randomUUID; }
|
|
38
38
|
});
|
|
39
39
|
Object.defineProperty(exports, "noop", {
|
|
40
40
|
enumerable: true,
|
|
@@ -2,12 +2,13 @@
|
|
|
2
2
|
* ====================================================
|
|
3
3
|
* Rzl Utils-JS.
|
|
4
4
|
* ----------------------------------------------------
|
|
5
|
-
* Version: 3.
|
|
5
|
+
* Version: 3.11.0.
|
|
6
6
|
* Author: Rizalvin Dwiky.
|
|
7
7
|
* Repository: https://github.com/rzl-zone/utils-js.
|
|
8
8
|
* ====================================================
|
|
9
9
|
*/
|
|
10
|
-
import{NullToUndefined,FixNeverArrayRecursive,IfNonEmptyArray,Extends}from'@rzl-zone/ts-types-plus';
|
|
10
|
+
import { NullToUndefined, FixNeverArrayRecursive, IfNonEmptyArray, Extends } from '@rzl-zone/ts-types-plus';
|
|
11
|
+
|
|
11
12
|
/** ---------------------------------
|
|
12
13
|
* * ***Utility: `getRandomItem`.***
|
|
13
14
|
* ---------------------------------
|
|
@@ -39,7 +40,12 @@ import{NullToUndefined,FixNeverArrayRecursive,IfNonEmptyArray,Extends}from'@rzl-
|
|
|
39
40
|
* const tuple = [1, "two", true] as const;
|
|
40
41
|
* getRandomItem(tuple); // 1 | "two" | true
|
|
41
42
|
*/
|
|
42
|
-
declare function getRandomItem(array:
|
|
43
|
+
declare function getRandomItem(array: undefined): undefined;
|
|
44
|
+
declare function getRandomItem(array: []): undefined;
|
|
45
|
+
declare function getRandomItem<T extends readonly unknown[]>(array: T): T extends never[][] ? undefined : number extends T["length"] ? NullToUndefined<FixNeverArrayRecursive<T[number]>> : IfNonEmptyArray<T, NullToUndefined<FixNeverArrayRecursive<T[number]>>, undefined>;
|
|
46
|
+
declare function getRandomItem<T extends readonly unknown[] | undefined | null>(array: T): T extends readonly unknown[] ? NullToUndefined<FixNeverArrayRecursive<T[number]>> | undefined : undefined;
|
|
47
|
+
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;
|
|
48
|
+
|
|
43
49
|
/** -----------------------------------------------------------------------
|
|
44
50
|
* * ***Utility: `randomInt`.***
|
|
45
51
|
* ------------------------------------------------------------------------
|
|
@@ -63,22 +69,25 @@ declare function getRandomItem(array:undefined):undefined;declare function getRa
|
|
|
63
69
|
* randomInt(Number.MIN_VALUE, 3);
|
|
64
70
|
* // ➔ Error, min or max cant be as `Number.MIN_VALUE` value.
|
|
65
71
|
*/
|
|
66
|
-
declare const randomInt:(min:number,max:number)=>number;
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
*
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
*
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
*
|
|
80
|
-
|
|
81
|
-
|
|
72
|
+
declare const randomInt: (min: number, max: number) => number;
|
|
73
|
+
|
|
74
|
+
type OptionsRandomIntByLength = {
|
|
75
|
+
/** * Minimum length of the random number, the `allowed minimal value` `integer` is `1` `and not bigger than value of` `maxLength`, defaultValue: `1`.
|
|
76
|
+
*
|
|
77
|
+
* @default 1
|
|
78
|
+
*/
|
|
79
|
+
minLength?: number;
|
|
80
|
+
/** * Maximum length of the random number, the `allowed maximal value` `integer` is `16`, defaultValue: `16`.
|
|
81
|
+
*
|
|
82
|
+
* @default 16
|
|
83
|
+
*/
|
|
84
|
+
maxLength?: number;
|
|
85
|
+
/** * If true, prevents the result from being zero, defaultValue: `false`.
|
|
86
|
+
*
|
|
87
|
+
* @default false
|
|
88
|
+
*/
|
|
89
|
+
avoidZero?: boolean;
|
|
90
|
+
};
|
|
82
91
|
/** ----------------------------------------------------------------------------
|
|
83
92
|
* * ***Utility: `randomIntByLength`.***
|
|
84
93
|
* -----------------------------------------------------------------------------
|
|
@@ -109,35 +118,39 @@ avoidZero?:boolean;};
|
|
|
109
118
|
* randomIntByLength({ avoidZero: true });
|
|
110
119
|
* // ➔ never 0
|
|
111
120
|
*/
|
|
112
|
-
declare const randomIntByLength:(options?:OptionsRandomIntByLength)=>number;
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
121
|
+
declare const randomIntByLength: (options?: OptionsRandomIntByLength) => number;
|
|
122
|
+
|
|
123
|
+
type OptionsRandomStr = {
|
|
124
|
+
/** ***Ensures no whitespace characters in the generated string, defaultValue: `true`.***
|
|
125
|
+
* @default true
|
|
126
|
+
*/
|
|
127
|
+
avoidWhiteSpace?: boolean;
|
|
128
|
+
/** ***Custom characters to replace the default number set if `type` is `"number"`, defaultValue: `undefined`.***
|
|
129
|
+
* @default undefined
|
|
130
|
+
*/
|
|
131
|
+
replaceGenInt?: string;
|
|
132
|
+
/** ***Custom characters to replace the default string set if `type` is `"string"`, defaultValue: `undefined`.***
|
|
133
|
+
* @default undefined
|
|
134
|
+
*/
|
|
135
|
+
replaceGenStr?: string;
|
|
136
|
+
/** ***Additional characters to include in the generated string, defaultValue: `undefined`.***
|
|
137
|
+
* @default undefined
|
|
138
|
+
*/
|
|
139
|
+
addChar?: string;
|
|
140
|
+
/** ***Minimum length of the generated string (1 to 5000), defaultValue: `40`.***
|
|
141
|
+
* @default 40
|
|
142
|
+
*/
|
|
143
|
+
minLength?: number;
|
|
144
|
+
/** ***Maximum length of the generated string (1 to 5000), defaultValue: `40`.***
|
|
145
|
+
* @default 40
|
|
146
|
+
*/
|
|
147
|
+
maxLength?: number;
|
|
148
|
+
/** ***Type of output: `"string"` or `"number"`, defaultValue: `"string"`.***
|
|
149
|
+
* @default "string"
|
|
150
|
+
*/
|
|
151
|
+
type?: "string" | "number";
|
|
152
|
+
};
|
|
153
|
+
|
|
141
154
|
/** ---------------------------------------------------------------------------------
|
|
142
155
|
* * ***Utility: `randomStr`.***
|
|
143
156
|
* ---------------------------------------------------------------------------------
|
|
@@ -168,45 +181,47 @@ type?:"string"|"number";};
|
|
|
168
181
|
* randomStr({ addChar: "!@#", minLength: 15, maxLength: 15 });
|
|
169
182
|
* // ➔ Guaranteed to include !@# in the set
|
|
170
183
|
*/
|
|
171
|
-
declare const randomStr:(options?:OptionsRandomStr)=>string;
|
|
184
|
+
declare const randomStr: (options?: OptionsRandomStr) => string;
|
|
185
|
+
|
|
172
186
|
/**
|
|
173
187
|
* Configuration options for `randomUUID()`.
|
|
174
188
|
*/
|
|
175
|
-
type OptionsRandomUUID={
|
|
176
|
-
/**
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
version?:"v4"|"v7";
|
|
193
|
-
/**
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
monotonic?:boolean;
|
|
189
|
+
type OptionsRandomUUID = {
|
|
190
|
+
/**
|
|
191
|
+
* Specifies which UUID version to generate.
|
|
192
|
+
*
|
|
193
|
+
* - `"v4"` — Fully random UUID (RFC 4122). No timestamp, no ordering guarantees.
|
|
194
|
+
* - `"v7"` — Time-ordered UUID (RFC 9562). Uses Unix timestamp + randomness.
|
|
195
|
+
*
|
|
196
|
+
* @default "v4"
|
|
197
|
+
*
|
|
198
|
+
* @example
|
|
199
|
+
* // Random v4 UUID
|
|
200
|
+
* randomUUID({ version: "v4" }); // ➔ "3ec0de5a-b8a9-4ffb-a62a-fcc76851e9c2"
|
|
201
|
+
*
|
|
202
|
+
* @example
|
|
203
|
+
* // Time-ordered v7 UUID
|
|
204
|
+
* randomUUID({ version: "v7" }); // ➔ "0199f3f6-3c5e-744b-affa-46b2cfd496f8"
|
|
205
|
+
*/
|
|
206
|
+
version?: "v4" | "v7";
|
|
207
|
+
/**
|
|
208
|
+
* Enables monotonic sequencing for UUID v7.
|
|
209
|
+
*
|
|
210
|
+
* - Guarantees that multiple UUIDs generated within the same millisecond
|
|
211
|
+
* are strictly non-decreasing (lexicographically and timestamp-wise).
|
|
212
|
+
* - Only valid when `version === "v7"`. Using with `v4` will throw a `TypeError`.
|
|
213
|
+
* - Useful for database inserts, logs, or any system where order matters.
|
|
214
|
+
*
|
|
215
|
+
* @default false
|
|
216
|
+
*
|
|
217
|
+
* @example
|
|
218
|
+
* // Monotonic v7 UUIDs
|
|
219
|
+
* const a = randomUUID({ version: "v7", monotonic: true });
|
|
220
|
+
* const b = randomUUID({ version: "v7", monotonic: true });
|
|
221
|
+
* console.log(a < b); // true, guaranteed
|
|
222
|
+
*/
|
|
223
|
+
monotonic?: boolean;
|
|
224
|
+
};
|
|
210
225
|
/** -----------------------------------------------------------------------
|
|
211
226
|
* * ***Utility: `randomUUID`.***
|
|
212
227
|
* ------------------------------------------------------------------------
|
|
@@ -275,7 +290,8 @@ monotonic?:boolean;};
|
|
|
275
290
|
* // Throws RangeError
|
|
276
291
|
* randomUUID({ version: "v1" as any }); // unsupported version
|
|
277
292
|
*/
|
|
278
|
-
declare function randomUUID(options?:OptionsRandomUUID):string;
|
|
293
|
+
declare function randomUUID(options?: OptionsRandomUUID): string;
|
|
294
|
+
|
|
279
295
|
/**
|
|
280
296
|
* --------------------------------------------------
|
|
281
297
|
* * ***Utility: `noop`.***
|
|
@@ -319,4 +335,6 @@ declare function randomUUID(options?:OptionsRandomUUID):string;
|
|
|
319
335
|
* callback(); // ➔ no effect (void)
|
|
320
336
|
* ```
|
|
321
337
|
*/
|
|
322
|
-
declare const noop:()=>void;
|
|
338
|
+
declare const noop: () => void;
|
|
339
|
+
|
|
340
|
+
export { getRandomItem, noop, randomInt, randomIntByLength, randomStr, randomUUID };
|
package/dist/generators/index.js
CHANGED
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
* ====================================================
|
|
3
3
|
* Rzl Utils-JS.
|
|
4
4
|
* ----------------------------------------------------
|
|
5
|
-
* Version: 3.
|
|
5
|
+
* Version: 3.11.0.
|
|
6
6
|
* Author: Rizalvin Dwiky.
|
|
7
7
|
* Repository: https://github.com/rzl-zone/utils-js.
|
|
8
8
|
* ====================================================
|
|
9
9
|
*/
|
|
10
|
-
export { getRandomItem, randomInt, randomIntByLength, randomStr, randomUUID } from '../chunk-
|
|
10
|
+
export { getRandomItem, randomInt, randomIntByLength, randomStr, randomUUID } from '../chunk-ENMRZ4BE.js';
|
|
11
11
|
import '../chunk-WVSPXFTY.js';
|
|
12
12
|
export { noop } from '../chunk-YWHHVDT4.js';
|
|
13
|
-
import '../chunk-
|
|
13
|
+
import '../chunk-AXDYWO67.js';
|
|
14
14
|
import '../chunk-QNKGP5DY.js';
|
|
15
|
-
import '../chunk-
|
|
15
|
+
import '../chunk-MSUW5VHZ.js';
|
package/dist/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* ====================================================
|
|
3
3
|
* Rzl Utils-JS.
|
|
4
4
|
* ----------------------------------------------------
|
|
5
|
-
* Version: 3.
|
|
5
|
+
* Version: 3.11.0.
|
|
6
6
|
* Author: Rizalvin Dwiky.
|
|
7
7
|
* Repository: https://github.com/rzl-zone/utils-js.
|
|
8
8
|
* ====================================================
|