@rzl-zone/utils-js 3.7.1 → 3.8.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 +23 -0
- package/dist/assertions/index.cjs +1 -1
- package/dist/assertions/index.d.ts +8 -8
- package/dist/assertions/index.js +1 -1
- package/dist/chunk-2VO2CBTU.js +1 -1
- package/dist/{chunk-KTQLDIIT.cjs → chunk-3JD53UUH.cjs} +15 -5
- package/dist/chunk-3KTD3QDI.js +1 -1
- package/dist/chunk-4ACKNPL5.js +1 -1
- package/dist/chunk-4ZOXSUXB.js +1 -1
- package/dist/{chunk-6PKW4WCT.js → chunk-5IKZ3JDV.js} +20 -8
- package/dist/chunk-5NN4ZDE2.cjs +1 -1
- package/dist/{chunk-OS5OT5JA.cjs → chunk-5PF7KRCP.cjs} +25 -9
- package/dist/{chunk-66WLOZOD.cjs → chunk-6NORJBI6.cjs} +7 -5
- package/dist/chunk-6RFNZ2ZZ.cjs +1 -1
- package/dist/{chunk-TDPYR5JY.js → chunk-6VA4F6VR.js} +15 -5
- package/dist/chunk-6WMB5AJR.js +1 -1
- package/dist/chunk-7QQV66RX.cjs +1 -1
- package/dist/chunk-7WBMA2VE.cjs +1 -1
- package/dist/chunk-7ZNEUWYP.js +1 -1
- package/dist/chunk-A3YI6Y2P.js +1 -1
- package/dist/{chunk-RMJC3B5P.cjs → chunk-A4H7474O.cjs} +7 -4
- package/dist/chunk-AKKM6MOX.cjs +1 -1
- package/dist/chunk-ATLFMKAF.cjs +1 -1
- package/dist/chunk-B4SDEBN7.cjs +1 -1
- package/dist/chunk-B6UIKBHR.cjs +1 -1
- package/dist/chunk-BAV5T2E3.cjs +1 -1
- package/dist/chunk-BYUT376O.cjs +1 -1
- package/dist/chunk-CKUEZF4R.cjs +1 -1
- package/dist/chunk-DPLL67OT.js +1 -1
- package/dist/chunk-DVMHRLKP.cjs +1 -1
- package/dist/chunk-EK7FSI7F.cjs +1 -1
- package/dist/chunk-F3WBQKRI.cjs +1 -1
- package/dist/chunk-FI76UZRF.js +1 -1
- package/dist/chunk-GAJBF6DR.js +1 -1
- package/dist/{chunk-K3SONK25.cjs → chunk-HKJZ7K2K.cjs} +165 -14
- package/dist/{chunk-QUITZ3GP.js → chunk-I3IXLEEG.js} +25 -9
- package/dist/{chunk-VNADVWSJ.js → chunk-JIROTDOU.js} +4 -2
- package/dist/chunk-JY4HLZ4W.js +1 -1
- package/dist/chunk-K63WO3XA.cjs +1 -1
- package/dist/chunk-KHO2SBNA.cjs +1 -1
- package/dist/chunk-KPCDDYTZ.js +1 -1
- package/dist/{chunk-XFTUHS4Y.js → chunk-KVZ3HL2B.js} +7 -5
- package/dist/chunk-L5RDAVVH.js +1 -1
- package/dist/chunk-LEX4TQW2.js +1 -1
- package/dist/chunk-LIU4S3JA.cjs +1 -1
- package/dist/{chunk-R3PBF6F7.cjs → chunk-LVFTN6DK.cjs} +29 -17
- package/dist/chunk-NREACG6M.cjs +1 -1
- package/dist/chunk-OFBFGFVH.js +1 -1
- package/dist/chunk-ONZFBJVW.js +1 -1
- package/dist/{chunk-D53CE4BT.js → chunk-P3ST4UZA.js} +6 -3
- package/dist/{chunk-WNO3EPYT.js → chunk-PW2VMJLT.js} +4 -2
- package/dist/chunk-PZQC3FZY.js +1 -1
- package/dist/chunk-QAPYHLHC.cjs +1 -1
- package/dist/chunk-QNKGP5DY.js +1 -1
- package/dist/{chunk-2CQI36UD.cjs → chunk-RJYWBVGD.cjs} +4 -2
- package/dist/{chunk-3LEWQV3R.js → chunk-RRJIRXHS.js} +5 -5
- package/dist/{chunk-BG3AS5BU.cjs → chunk-SGCN4ED4.cjs} +4 -2
- package/dist/chunk-SLP24LUV.js +302 -0
- package/dist/chunk-SZJ7OI4S.js +1 -1
- package/dist/chunk-TDYGYHSH.js +1 -1
- package/dist/chunk-TFDXRT6D.cjs +1 -1
- package/dist/chunk-U5VR4TJN.js +1 -1
- package/dist/chunk-UDA26MCU.cjs +1 -1
- package/dist/chunk-UKAUXY2U.cjs +1 -1
- package/dist/chunk-VCVND6CH.js +1 -1
- package/dist/chunk-VJDDGRIK.cjs +1 -1
- package/dist/chunk-VJVCXEH7.cjs +1 -1
- package/dist/chunk-WVSPXFTY.js +1 -1
- package/dist/chunk-YC7AK3KX.cjs +1 -1
- package/dist/chunk-YGB2BQPB.cjs +1 -1
- package/dist/chunk-YS27V6LS.js +1 -1
- package/dist/chunk-YWHHVDT4.js +1 -1
- package/dist/chunk-ZN53RM3R.js +1 -1
- package/dist/{chunk-KIYALQQF.cjs → chunk-ZW3VYES4.cjs} +5 -5
- package/dist/conversions/index.cjs +18 -18
- package/dist/conversions/index.d.ts +10 -12
- package/dist/conversions/index.js +3 -3
- package/dist/events/index.cjs +1 -1
- package/dist/events/index.d.ts +9 -9
- package/dist/events/index.js +1 -1
- package/dist/formatters/index.cjs +12 -12
- package/dist/formatters/index.d.ts +19 -24
- package/dist/formatters/index.js +2 -2
- package/dist/generators/index.cjs +10 -6
- package/dist/generators/index.d.ts +155 -26
- package/dist/generators/index.js +2 -2
- package/dist/index.d.ts +1 -1
- package/dist/{isPlainObject-FWmcJF6k.d.ts → isPlainObject-BTPjv6zB.d.ts} +2 -2
- package/dist/next/index.cjs +11 -9
- package/dist/next/index.d.ts +11 -11
- package/dist/next/index.js +5 -3
- package/dist/next/server/index.cjs +1 -1
- package/dist/next/server/index.d.ts +4 -4
- package/dist/next/server/index.js +1 -1
- package/dist/operations/index.cjs +6 -6
- package/dist/operations/index.d.ts +8 -9
- package/dist/operations/index.js +3 -3
- package/dist/parsers/index.cjs +1 -1
- package/dist/parsers/index.d.ts +1 -1
- package/dist/parsers/index.js +1 -1
- package/dist/predicates/index.cjs +1 -1
- package/dist/predicates/index.d.ts +15 -28
- package/dist/predicates/index.js +1 -1
- package/dist/promises/index.cjs +4 -4
- package/dist/promises/index.d.ts +6 -7
- package/dist/promises/index.js +2 -2
- package/dist/rzl-utils.global.js +2 -2
- package/dist/strings/index.cjs +1 -1
- package/dist/strings/index.d.ts +1 -1
- package/dist/strings/index.js +1 -1
- package/dist/tailwind/index.cjs +10 -10
- package/dist/tailwind/index.d.ts +18 -18
- package/dist/tailwind/index.js +2 -2
- package/dist/urls/index.cjs +9 -9
- package/dist/urls/index.d.ts +9 -10
- package/dist/urls/index.js +3 -3
- package/package.json +1 -1
- package/dist/chunk-ABA2ZSBQ.js +0 -152
package/dist/strings/index.cjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* ====================================================
|
|
3
3
|
* Rzl Utils-JS.
|
|
4
4
|
* ----------------------------------------------------
|
|
5
|
-
* Version: 3.
|
|
5
|
+
* Version: 3.8.0.
|
|
6
6
|
* Author: Rizalvin Dwiky.
|
|
7
7
|
* Repository: https://github.com/rzl-zone/utils-js.
|
|
8
8
|
* ====================================================
|
package/dist/strings/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* ====================================================
|
|
3
3
|
* Rzl Utils-JS.
|
|
4
4
|
* ----------------------------------------------------
|
|
5
|
-
* Version: 3.
|
|
5
|
+
* Version: 3.8.0.
|
|
6
6
|
* Author: Rizalvin Dwiky.
|
|
7
7
|
* Repository: https://github.com/rzl-zone/utils-js.
|
|
8
8
|
* ====================================================
|
package/dist/strings/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* ====================================================
|
|
3
3
|
* Rzl Utils-JS.
|
|
4
4
|
* ----------------------------------------------------
|
|
5
|
-
* Version: 3.
|
|
5
|
+
* Version: 3.8.0.
|
|
6
6
|
* Author: Rizalvin Dwiky.
|
|
7
7
|
* Repository: https://github.com/rzl-zone/utils-js.
|
|
8
8
|
* ====================================================
|
package/dist/tailwind/index.cjs
CHANGED
|
@@ -2,47 +2,47 @@
|
|
|
2
2
|
* ====================================================
|
|
3
3
|
* Rzl Utils-JS.
|
|
4
4
|
* ----------------------------------------------------
|
|
5
|
-
* Version: 3.
|
|
5
|
+
* Version: 3.8.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 chunkZW3VYES4_cjs = require('../chunk-ZW3VYES4.cjs');
|
|
13
13
|
require('../chunk-NREACG6M.cjs');
|
|
14
14
|
require('../chunk-7WBMA2VE.cjs');
|
|
15
15
|
require('../chunk-F3WBQKRI.cjs');
|
|
16
16
|
|
|
17
17
|
Object.defineProperty(exports, "cnV3", {
|
|
18
18
|
enumerable: true,
|
|
19
|
-
get: function () { return
|
|
19
|
+
get: function () { return chunkZW3VYES4_cjs.cnV3; }
|
|
20
20
|
});
|
|
21
21
|
Object.defineProperty(exports, "cnV4", {
|
|
22
22
|
enumerable: true,
|
|
23
|
-
get: function () { return
|
|
23
|
+
get: function () { return chunkZW3VYES4_cjs.cnV4; }
|
|
24
24
|
});
|
|
25
25
|
Object.defineProperty(exports, "customCnV3", {
|
|
26
26
|
enumerable: true,
|
|
27
|
-
get: function () { return
|
|
27
|
+
get: function () { return chunkZW3VYES4_cjs.customCnV3; }
|
|
28
28
|
});
|
|
29
29
|
Object.defineProperty(exports, "customCnV4", {
|
|
30
30
|
enumerable: true,
|
|
31
|
-
get: function () { return
|
|
31
|
+
get: function () { return chunkZW3VYES4_cjs.customCnV4; }
|
|
32
32
|
});
|
|
33
33
|
Object.defineProperty(exports, "cx", {
|
|
34
34
|
enumerable: true,
|
|
35
|
-
get: function () { return
|
|
35
|
+
get: function () { return chunkZW3VYES4_cjs.cx; }
|
|
36
36
|
});
|
|
37
37
|
Object.defineProperty(exports, "shouldForwardProp", {
|
|
38
38
|
enumerable: true,
|
|
39
|
-
get: function () { return
|
|
39
|
+
get: function () { return chunkZW3VYES4_cjs.shouldForwardProp; }
|
|
40
40
|
});
|
|
41
41
|
Object.defineProperty(exports, "twMergeDefaultV3", {
|
|
42
42
|
enumerable: true,
|
|
43
|
-
get: function () { return
|
|
43
|
+
get: function () { return chunkZW3VYES4_cjs.twMergeDefaultV3; }
|
|
44
44
|
});
|
|
45
45
|
Object.defineProperty(exports, "twMergeDefaultV4", {
|
|
46
46
|
enumerable: true,
|
|
47
|
-
get: function () { return
|
|
47
|
+
get: function () { return chunkZW3VYES4_cjs.twMergeDefaultV4; }
|
|
48
48
|
});
|
package/dist/tailwind/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* ====================================================
|
|
3
3
|
* Rzl Utils-JS.
|
|
4
4
|
* ----------------------------------------------------
|
|
5
|
-
* Version: 3.
|
|
5
|
+
* Version: 3.8.0.
|
|
6
6
|
* Author: Rizalvin Dwiky.
|
|
7
7
|
* Repository: https://github.com/rzl-zone/utils-js.
|
|
8
8
|
* ====================================================
|
|
@@ -20,7 +20,7 @@ import{Config}from'tailwindcss';import{ClassNameValue as ClassNameValue$1,Config
|
|
|
20
20
|
* - `null | undefined` → ignored
|
|
21
21
|
* - `ClassObject` → objects where **keys with truthy values** are included
|
|
22
22
|
* - `ClassValues` → arrays recursively flattened
|
|
23
|
-
* - Used internally by
|
|
23
|
+
* - Used internally by ***`cx` utility function*** to process mixed input values.
|
|
24
24
|
* @example
|
|
25
25
|
* ```ts
|
|
26
26
|
* const val1: ClassValue = "button"; // ➔ string
|
|
@@ -63,7 +63,15 @@ type ClassValues=ClassValue[];
|
|
|
63
63
|
* * ***Utility: `cx`.***
|
|
64
64
|
* ----------------------------------------------------------
|
|
65
65
|
* **Merge multiple class values into a single, space-separated string suitable for CSS usage.**
|
|
66
|
-
* @
|
|
66
|
+
* @description
|
|
67
|
+
* - Supports **nested combinations** of arrays and objects, recursively.
|
|
68
|
+
* - **Falsy values** are skipped:
|
|
69
|
+
* - `false`, `null`, `undefined`, empty strings `""` are ignored anywhere.
|
|
70
|
+
* - Numbers `0` are ignored inside nested arrays/objects.
|
|
71
|
+
* - **Boxed primitives** are correctly unwrapped to their primitive value.
|
|
72
|
+
* - **Inherited object keys** are included in the final class string.
|
|
73
|
+
* - Optimized for **CSS class merging** where conditional inclusion is common.
|
|
74
|
+
* @param {ClassValues} values
|
|
67
75
|
* A list of mixed class values, which can include:
|
|
68
76
|
* - **Strings** → literal class names.
|
|
69
77
|
* - **Numbers** → numeric class names.
|
|
@@ -74,14 +82,6 @@ type ClassValues=ClassValue[];
|
|
|
74
82
|
* - **Falsy values** (`false`, `null`, `undefined`, `""`, `0`) are ignored according to original behavior.
|
|
75
83
|
* @returns {string}
|
|
76
84
|
* A single space-separated string containing all valid class names.
|
|
77
|
-
* @description
|
|
78
|
-
* - Supports **nested combinations** of arrays and objects, recursively.
|
|
79
|
-
* - **Falsy values** are skipped:
|
|
80
|
-
* - `false`, `null`, `undefined`, empty strings `""` are ignored anywhere.
|
|
81
|
-
* - Numbers `0` are ignored inside nested arrays/objects.
|
|
82
|
-
* - **Boxed primitives** are correctly unwrapped to their primitive value.
|
|
83
|
-
* - **Inherited object keys** are included in the final class string.
|
|
84
|
-
* - Optimized for **CSS class merging** where conditional inclusion is common.
|
|
85
85
|
* @example
|
|
86
86
|
* ```ts
|
|
87
87
|
* // Basic string merge
|
|
@@ -112,7 +112,7 @@ type ClassValues=ClassValue[];
|
|
|
112
112
|
* // ➔ "own inherited"
|
|
113
113
|
* ```
|
|
114
114
|
*/
|
|
115
|
-
declare function cx(...
|
|
115
|
+
declare function cx(...values:ClassValues):string;
|
|
116
116
|
/** -------------------------------------------------------------
|
|
117
117
|
* * ***Default `cnV3` utility (Tailwind v3).***
|
|
118
118
|
* -------------------------------------------------------------
|
|
@@ -497,8 +497,8 @@ declare const customCnV4:(customTwMergeV4:TwMergeDefaultFnV4,...classes:ClassVal
|
|
|
497
497
|
* - `true` ➔ the prop **will** be forwarded to the DOM.
|
|
498
498
|
* - `false` ➔ the prop **will not** be forwarded.
|
|
499
499
|
*
|
|
500
|
-
* @throws {TypeError}
|
|
501
|
-
*
|
|
500
|
+
* @throws **{@link TypeError | `TypeError`}**
|
|
501
|
+
* when:
|
|
502
502
|
* - `props` is not an array, or
|
|
503
503
|
* - any item is not a non-empty string.
|
|
504
504
|
*
|
|
@@ -523,8 +523,8 @@ declare const shouldForwardProp:<CustomProps extends Record<string,unknown>>(pro
|
|
|
523
523
|
/** -------------------------------------------------------------
|
|
524
524
|
* * ***Customized Tailwind class merger Version 3 with extended rules.***
|
|
525
525
|
* -------------------------------------------------------------
|
|
526
|
-
* **Wraps
|
|
527
|
-
* (
|
|
526
|
+
* **Wraps ***`extendTailwindMerge` from tailwind-merge-v3*** with Tailwind’s default
|
|
527
|
+
* config (_*`getDefaultConfig()` from tailwind-merge-v3*_) to create a **project-ready `twMerge`**.**
|
|
528
528
|
* - 🔑 **When to use it?**
|
|
529
529
|
* - Your project uses **Tailwind v3**.
|
|
530
530
|
* - Extend **class groups** (e.g. add `text-shadow`).
|
|
@@ -610,8 +610,8 @@ declare const twMergeDefaultV3:(options?:OptionsMergeTwClsV3)=>TwMergeDefaultFnV
|
|
|
610
610
|
/** -------------------------------------------------------------
|
|
611
611
|
* * ***Customized Tailwind class merger Version 4 with extended rules.***
|
|
612
612
|
* -------------------------------------------------------------
|
|
613
|
-
* **Wraps
|
|
614
|
-
* (
|
|
613
|
+
* **Wraps ***`extendTailwindMerge` from tailwind-merge-v4*** with Tailwind’s default
|
|
614
|
+
* config (_*`getDefaultConfig()` from tailwind-merge-v4*_) to create a **project-ready `twMerge`**.**
|
|
615
615
|
* - 🔑 **When to use it?**
|
|
616
616
|
* - Your project uses **Tailwind v4**.
|
|
617
617
|
* - Extend **class groups** (e.g. add `text-shadow`).
|
package/dist/tailwind/index.js
CHANGED
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
* ====================================================
|
|
3
3
|
* Rzl Utils-JS.
|
|
4
4
|
* ----------------------------------------------------
|
|
5
|
-
* Version: 3.
|
|
5
|
+
* Version: 3.8.0.
|
|
6
6
|
* Author: Rizalvin Dwiky.
|
|
7
7
|
* Repository: https://github.com/rzl-zone/utils-js.
|
|
8
8
|
* ====================================================
|
|
9
9
|
*/
|
|
10
|
-
export { cnV3, cnV4, customCnV3, customCnV4, cx, shouldForwardProp, twMergeDefaultV3, twMergeDefaultV4 } from '../chunk-
|
|
10
|
+
export { cnV3, cnV4, customCnV3, customCnV4, cx, shouldForwardProp, twMergeDefaultV3, twMergeDefaultV4 } from '../chunk-RRJIRXHS.js';
|
|
11
11
|
import '../chunk-JY4HLZ4W.js';
|
|
12
12
|
import '../chunk-6WMB5AJR.js';
|
|
13
13
|
import '../chunk-3KTD3QDI.js';
|
package/dist/urls/index.cjs
CHANGED
|
@@ -2,21 +2,21 @@
|
|
|
2
2
|
* ====================================================
|
|
3
3
|
* Rzl Utils-JS.
|
|
4
4
|
* ----------------------------------------------------
|
|
5
|
-
* Version: 3.
|
|
5
|
+
* Version: 3.8.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 chunkLVFTN6DK_cjs = require('../chunk-LVFTN6DK.cjs');
|
|
13
13
|
require('../chunk-KHO2SBNA.cjs');
|
|
14
14
|
require('../chunk-BYUT376O.cjs');
|
|
15
15
|
require('../chunk-AKKM6MOX.cjs');
|
|
16
16
|
require('../chunk-UKAUXY2U.cjs');
|
|
17
17
|
require('../chunk-B4SDEBN7.cjs');
|
|
18
18
|
require('../chunk-DVMHRLKP.cjs');
|
|
19
|
-
var
|
|
19
|
+
var chunkSGCN4ED4_cjs = require('../chunk-SGCN4ED4.cjs');
|
|
20
20
|
var chunkVJVCXEH7_cjs = require('../chunk-VJVCXEH7.cjs');
|
|
21
21
|
require('../chunk-LIU4S3JA.cjs');
|
|
22
22
|
require('../chunk-NREACG6M.cjs');
|
|
@@ -28,27 +28,27 @@ require('../chunk-F3WBQKRI.cjs');
|
|
|
28
28
|
|
|
29
29
|
Object.defineProperty(exports, "constructURL", {
|
|
30
30
|
enumerable: true,
|
|
31
|
-
get: function () { return
|
|
31
|
+
get: function () { return chunkLVFTN6DK_cjs.constructURL; }
|
|
32
32
|
});
|
|
33
33
|
Object.defineProperty(exports, "extractURLs", {
|
|
34
34
|
enumerable: true,
|
|
35
|
-
get: function () { return
|
|
35
|
+
get: function () { return chunkLVFTN6DK_cjs.extractURLs; }
|
|
36
36
|
});
|
|
37
37
|
Object.defineProperty(exports, "getFirstPrefixPathname", {
|
|
38
38
|
enumerable: true,
|
|
39
|
-
get: function () { return
|
|
39
|
+
get: function () { return chunkLVFTN6DK_cjs.getFirstPrefixPathname; }
|
|
40
40
|
});
|
|
41
41
|
Object.defineProperty(exports, "getPrefixPathname", {
|
|
42
42
|
enumerable: true,
|
|
43
|
-
get: function () { return
|
|
43
|
+
get: function () { return chunkLVFTN6DK_cjs.getPrefixPathname; }
|
|
44
44
|
});
|
|
45
45
|
Object.defineProperty(exports, "formatEnvPort", {
|
|
46
46
|
enumerable: true,
|
|
47
|
-
get: function () { return
|
|
47
|
+
get: function () { return chunkSGCN4ED4_cjs.formatEnvPort; }
|
|
48
48
|
});
|
|
49
49
|
Object.defineProperty(exports, "normalizePathname", {
|
|
50
50
|
enumerable: true,
|
|
51
|
-
get: function () { return
|
|
51
|
+
get: function () { return chunkSGCN4ED4_cjs.normalizePathname; }
|
|
52
52
|
});
|
|
53
53
|
Object.defineProperty(exports, "punycodeUtilsJS", {
|
|
54
54
|
enumerable: true,
|
package/dist/urls/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* ====================================================
|
|
3
3
|
* Rzl Utils-JS.
|
|
4
4
|
* ----------------------------------------------------
|
|
5
|
-
* Version: 3.
|
|
5
|
+
* Version: 3.8.0.
|
|
6
6
|
* Author: Rizalvin Dwiky.
|
|
7
7
|
* Repository: https://github.com/rzl-zone/utils-js.
|
|
8
8
|
* ====================================================
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
* ----------------------------------------------------------
|
|
13
13
|
* **Represents a non-empty array of key–value pairs.**
|
|
14
14
|
* @description
|
|
15
|
-
* Type for `queryParams` parameter, the second parameter of
|
|
15
|
+
* Type for `queryParams` parameter, the second parameter of ***`constructURL` utility function***.
|
|
16
16
|
* - **Behavior:**
|
|
17
17
|
* - Each inner tuple strictly follows the `[string, string | number]` shape.
|
|
18
18
|
* - Ensures the outer array contains **at least one pair** (non-empty).
|
|
@@ -44,7 +44,7 @@ type QueryParamPairs=[[string,string|number],...[string,string|number][]];
|
|
|
44
44
|
* @param {string[]} [removeParams]
|
|
45
45
|
* A list of query parameter keys to remove from the final URL, whether they were in the base URL or provided queryParams.
|
|
46
46
|
* @returns {URL} A new URL object representing the constructed URL with merged and cleaned query parameters.
|
|
47
|
-
* @throws {TypeError}
|
|
47
|
+
* @throws **{@link TypeError | `TypeError`}** if `baseUrl` is not a valid non-empty string or URL object, or if `queryParams` is not iterable, or if `removeParams` is not an array of strings.
|
|
48
48
|
* @example
|
|
49
49
|
* 1. #### Basic Usage:
|
|
50
50
|
* ```ts
|
|
@@ -202,8 +202,7 @@ declare const extractURLs:(url:string|null|undefined)=>string[]|null;
|
|
|
202
202
|
* - Defaults to `"/"`.
|
|
203
203
|
* @returns {string}
|
|
204
204
|
* ***The first valid normalized pathname, or the normalized default.***
|
|
205
|
-
* @throws {TypeError}
|
|
206
|
-
* ***If `result` is not a valid type, or `defaultValue` is not a string or empty-string.***
|
|
205
|
+
* @throws **{@link TypeError | `TypeError`}** ***if `result` is not a valid type, or `defaultValue` is not a string or empty-string.***
|
|
207
206
|
*/
|
|
208
207
|
declare const getFirstPrefixPathname:(result:string|string[]|null|undefined,defaultValue?:string)=>string;type GetPrefixPathnameOptions={
|
|
209
208
|
/** The number of levels to include in the prefix (default is `1`).
|
|
@@ -252,8 +251,8 @@ removeDuplicates?:boolean;};
|
|
|
252
251
|
* - A single string if only one unique prefix/base is found.
|
|
253
252
|
* - An array of strings if multiple different prefixes/bases are found.
|
|
254
253
|
* - `null` if no matching base is found when using `base`.
|
|
255
|
-
* @throws {TypeError}
|
|
256
|
-
* ***
|
|
254
|
+
* @throws **{@link TypeError | `TypeError`}**
|
|
255
|
+
* ***if:***
|
|
257
256
|
* - `url` is `not a string` or `not an array of strings`.
|
|
258
257
|
* - `base` is `not a string`, `array of strings`, or `null`.
|
|
259
258
|
* - `options` is `not an object`.
|
|
@@ -429,8 +428,8 @@ keepTrailingSlash?:boolean;};type NormalizePathnameOptionsKeepNullableTrue=MainN
|
|
|
429
428
|
* @returns {string | null | undefined} ***Normalized pathname, or original nullable value if `keepNullable` is `true`
|
|
430
429
|
* _(except if `pathname` is empty-string, will keep returning `defaultPath`)_.***
|
|
431
430
|
*
|
|
432
|
-
* @throws {TypeError}
|
|
433
|
-
* @throws {
|
|
431
|
+
* @throws **{@link TypeError | `TypeError`}** if `defaultPath` is invalid when `keepNullable` is false.
|
|
432
|
+
* @throws **`NormalizePathnameError` extends {@link Error | `Error`}** If normalization fails (e.g., invalid URL).
|
|
434
433
|
*
|
|
435
434
|
* @example
|
|
436
435
|
* // Basic normalization
|
|
@@ -550,7 +549,7 @@ prefixColon?:boolean;};
|
|
|
550
549
|
* @param {string | null | undefined} envVar The environment variable string.
|
|
551
550
|
* @param {FormatEnvPortOptions} [options] Optional object: `{ prefixColon?: boolean }`.
|
|
552
551
|
* @returns {string} A string like `":8080"` or `"8080"`, or `""` if no digits.
|
|
553
|
-
* @throws {TypeError}
|
|
552
|
+
* @throws **{@link TypeError | `TypeError`}** if `options` is not an object or `prefixColon` is not boolean.
|
|
554
553
|
* @example
|
|
555
554
|
* formatEnvPort("port:8080");
|
|
556
555
|
* // ➔ "8080"
|
package/dist/urls/index.js
CHANGED
|
@@ -2,19 +2,19 @@
|
|
|
2
2
|
* ====================================================
|
|
3
3
|
* Rzl Utils-JS.
|
|
4
4
|
* ----------------------------------------------------
|
|
5
|
-
* Version: 3.
|
|
5
|
+
* Version: 3.8.0.
|
|
6
6
|
* Author: Rizalvin Dwiky.
|
|
7
7
|
* Repository: https://github.com/rzl-zone/utils-js.
|
|
8
8
|
* ====================================================
|
|
9
9
|
*/
|
|
10
|
-
export { constructURL, extractURLs, getFirstPrefixPathname, getPrefixPathname } from '../chunk-
|
|
10
|
+
export { constructURL, extractURLs, getFirstPrefixPathname, getPrefixPathname } from '../chunk-5IKZ3JDV.js';
|
|
11
11
|
import '../chunk-ONZFBJVW.js';
|
|
12
12
|
import '../chunk-GAJBF6DR.js';
|
|
13
13
|
import '../chunk-TDYGYHSH.js';
|
|
14
14
|
import '../chunk-PZQC3FZY.js';
|
|
15
15
|
import '../chunk-7ZNEUWYP.js';
|
|
16
16
|
import '../chunk-WVSPXFTY.js';
|
|
17
|
-
export { formatEnvPort, normalizePathname } from '../chunk-
|
|
17
|
+
export { formatEnvPort, normalizePathname } from '../chunk-PW2VMJLT.js';
|
|
18
18
|
export { punycodeUtilsJS } from '../chunk-YS27V6LS.js';
|
|
19
19
|
import '../chunk-4ACKNPL5.js';
|
|
20
20
|
import '../chunk-JY4HLZ4W.js';
|
package/package.json
CHANGED
package/dist/chunk-ABA2ZSBQ.js
DELETED
|
@@ -1,152 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* ====================================================
|
|
3
|
-
* Rzl Utils-JS.
|
|
4
|
-
* ----------------------------------------------------
|
|
5
|
-
* Version: 3.7.1.
|
|
6
|
-
* Author: Rizalvin Dwiky.
|
|
7
|
-
* Repository: https://github.com/rzl-zone/utils-js.
|
|
8
|
-
* ====================================================
|
|
9
|
-
*/
|
|
10
|
-
import { isInteger } from './chunk-WVSPXFTY.js';
|
|
11
|
-
import { safeStableStringify } from './chunk-2VO2CBTU.js';
|
|
12
|
-
import { isNonEmptyArray, getPreciseType, isNumber, isPlainObject, assertIsBoolean, isNaN } from './chunk-3KTD3QDI.js';
|
|
13
|
-
|
|
14
|
-
function getRandomItem(array) {
|
|
15
|
-
if (!isNonEmptyArray(array)) return void 0;
|
|
16
|
-
const randomIndex = Math.floor(Math.random() * (array.length || 0));
|
|
17
|
-
return array[randomIndex];
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
var randomInt = (min, max) => {
|
|
21
|
-
if (!isInteger(min) || !isInteger(max)) {
|
|
22
|
-
throw new TypeError(
|
|
23
|
-
`First parameter (\`min\`) and second parameter (\`max\`) must be of type \`integer-number\`${minValueNote(
|
|
24
|
-
min,
|
|
25
|
-
max
|
|
26
|
-
)}value, but received: ['min': \`${getPreciseType(
|
|
27
|
-
min
|
|
28
|
-
)}\` - (with value: \`${safeStableStringify(min)})\`, 'max': \`${getPreciseType(
|
|
29
|
-
max
|
|
30
|
-
)}\` - (with value: \`${safeStableStringify(max)}\`)].`
|
|
31
|
-
);
|
|
32
|
-
}
|
|
33
|
-
if (min > max) {
|
|
34
|
-
throw new RangeError(
|
|
35
|
-
`First parameter (\`min\`) must be less than or equal to second parameter (\`max\`), but received: ['min': ${formatValue(
|
|
36
|
-
min
|
|
37
|
-
)}, 'max': ${formatValue(max)}].`
|
|
38
|
-
);
|
|
39
|
-
}
|
|
40
|
-
min = Math.max(1, min);
|
|
41
|
-
max = Math.min(Number.MAX_SAFE_INTEGER, max);
|
|
42
|
-
return Math.floor(Math.random() * (max - min + 1)) + min;
|
|
43
|
-
};
|
|
44
|
-
var formatValue = (value) => {
|
|
45
|
-
return isNumber(value, { includeNaN: true }) ? value === Number.MIN_VALUE ? "`Number.MIN_VALUE`" : `${value}` : `\`${getPreciseType(value)}\``;
|
|
46
|
-
};
|
|
47
|
-
var minValueNote = (...values) => {
|
|
48
|
-
return values.some((v) => isNumber(v, { includeNaN: true }) && v === Number.MIN_VALUE) ? " and can't be `Number.MIN_VALUE` " : " ";
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
var randomIntByLength = (options) => {
|
|
52
|
-
if (!isPlainObject(options)) {
|
|
53
|
-
options = {};
|
|
54
|
-
}
|
|
55
|
-
const { minLength = 1, maxLength = 16, avoidZero = false } = options;
|
|
56
|
-
assertIsBoolean(avoidZero, {
|
|
57
|
-
message({ currentType, validType }) {
|
|
58
|
-
return `Parameters \`avoidZero\` must be of type \`${validType}\`, but received: \`${currentType}\`.`;
|
|
59
|
-
}
|
|
60
|
-
});
|
|
61
|
-
if (!isInteger(minLength) || !isInteger(maxLength)) {
|
|
62
|
-
throw new TypeError(
|
|
63
|
-
`Parameters \`minLength\` and \`maxLength\` must be of type \`integer-number\`, but received: ['minLength': \`${getPreciseType(
|
|
64
|
-
minLength
|
|
65
|
-
)}\` - (with value: ${safeStableStringify(
|
|
66
|
-
minLength
|
|
67
|
-
)}), 'maxLength': \`${getPreciseType(
|
|
68
|
-
maxLength
|
|
69
|
-
)}\` - (with value: ${safeStableStringify(maxLength)})].`
|
|
70
|
-
);
|
|
71
|
-
}
|
|
72
|
-
if (minLength < 1 || maxLength > 16 || minLength > maxLength) {
|
|
73
|
-
throw new RangeError(
|
|
74
|
-
`Invalid range at parameters \`minLength\` must be \u2265 1, \`maxLength\` must be \u2264 16, and \`minLength\` \u2264 \`maxLength\`, but received: ['minLength': \`${minLength}\`, 'maxLength': \`${maxLength}\`].`
|
|
75
|
-
);
|
|
76
|
-
}
|
|
77
|
-
const randomLength = minLength === maxLength ? minLength : randomInt(minLength, maxLength);
|
|
78
|
-
const minValue = 10 ** (randomLength - 1);
|
|
79
|
-
const maxValue = 10 ** randomLength - 1;
|
|
80
|
-
let result = randomInt(minValue, maxValue);
|
|
81
|
-
if (avoidZero && result === 0) {
|
|
82
|
-
result = minValue;
|
|
83
|
-
}
|
|
84
|
-
return result;
|
|
85
|
-
};
|
|
86
|
-
|
|
87
|
-
var randomStr = (options) => {
|
|
88
|
-
if (!isPlainObject(options)) {
|
|
89
|
-
options = {};
|
|
90
|
-
}
|
|
91
|
-
const {
|
|
92
|
-
minLength = 40,
|
|
93
|
-
maxLength = 40,
|
|
94
|
-
type = "string",
|
|
95
|
-
avoidWhiteSpace = true
|
|
96
|
-
} = options;
|
|
97
|
-
assertIsBoolean(avoidWhiteSpace, {
|
|
98
|
-
message({ currentType, validType }) {
|
|
99
|
-
return `Parameters \`avoidWhiteSpace\` property of the \`options\` (first-parameter) must be of type \`${validType}\`, but received: \`${currentType}\`.`;
|
|
100
|
-
}
|
|
101
|
-
});
|
|
102
|
-
if (!isInteger(minLength) || !isInteger(maxLength)) {
|
|
103
|
-
throw new TypeError(
|
|
104
|
-
`Parameters \`minLength\` and \`maxLength\` must be of type \`integer-number\`, but received: ['minLength': \`${getPreciseType(
|
|
105
|
-
minLength
|
|
106
|
-
)}\` - (with value: ${safeStableStringify(
|
|
107
|
-
minLength
|
|
108
|
-
)}), 'maxLength': \`${getPreciseType(
|
|
109
|
-
maxLength
|
|
110
|
-
)}\` - (with value: ${safeStableStringify(maxLength)})].`
|
|
111
|
-
);
|
|
112
|
-
}
|
|
113
|
-
if (minLength < 1 || maxLength > 5e3 || minLength > maxLength) {
|
|
114
|
-
throw new RangeError(
|
|
115
|
-
`Invalid range at parameters \`minLength\` must be \u2265 1, \`maxLength\` must be \u2264 5000, and \`minLength\` \u2264 \`maxLength\`, but received: ['minLength': \`${minLength}\`, 'maxLength': \`${maxLength}\`].`
|
|
116
|
-
);
|
|
117
|
-
}
|
|
118
|
-
if (type !== "string" && type !== "number") {
|
|
119
|
-
throw new TypeError(
|
|
120
|
-
`Parameter \`type\` must be of type \`string\` with value one of "string" | "number", but received: \`${getPreciseType(
|
|
121
|
-
type
|
|
122
|
-
)}\`, with value: ${safeStableStringify(type)}.`
|
|
123
|
-
);
|
|
124
|
-
}
|
|
125
|
-
const length = randomInt(minLength, maxLength);
|
|
126
|
-
const cleanCharacters = (charSet) => {
|
|
127
|
-
return avoidWhiteSpace ? charSet.replace(/\s|\n|\t/g, "") : charSet;
|
|
128
|
-
};
|
|
129
|
-
const defaultNumberSet = "0123456789";
|
|
130
|
-
const defaultStringSet = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
|
131
|
-
const baseCharSet = type === "number" ? (!isNaN(Number(options.replaceGenInt)) ? options.replaceGenInt : void 0) ?? defaultNumberSet : (options.replaceGenStr ? options.replaceGenStr : void 0) ?? defaultStringSet;
|
|
132
|
-
const characterSet = cleanCharacters(baseCharSet) + (options.addChar || "");
|
|
133
|
-
if (!characterSet.length) {
|
|
134
|
-
const errCharSet = () => {
|
|
135
|
-
if (type === "number") {
|
|
136
|
-
if (avoidWhiteSpace) {
|
|
137
|
-
return `If \`avoidWhiteSpace\` is true, and \`replaceGenInt\` cant be empty-string value, ensure \`replaceGenInt\` has valid characters and non-nan string number.`;
|
|
138
|
-
}
|
|
139
|
-
return `Ensure \`replaceGenInt\` has valid characters and not a NaN number string while convert to number.`;
|
|
140
|
-
}
|
|
141
|
-
return `Ensure \`replaceGenStr\` has valid characters and non empty string.`;
|
|
142
|
-
};
|
|
143
|
-
throw new Error(`Character set is empty. ${errCharSet()}`);
|
|
144
|
-
}
|
|
145
|
-
let result = "";
|
|
146
|
-
for (let i = 0; i < length; i++) {
|
|
147
|
-
result += characterSet.charAt(Math.floor(Math.random() * characterSet.length));
|
|
148
|
-
}
|
|
149
|
-
return result;
|
|
150
|
-
};
|
|
151
|
-
|
|
152
|
-
export { getRandomItem, randomInt, randomIntByLength, randomStr };
|