@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
|
@@ -2,12 +2,12 @@
|
|
|
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 { isArray, isObject, assertIsPlainObject, hasOwnProp, assertIsBoolean } from './chunk-
|
|
10
|
+
import { isArray, isObject, assertIsPlainObject, hasOwnProp, assertIsBoolean } from './chunk-MSUW5VHZ.js';
|
|
11
11
|
|
|
12
12
|
var isEmptyArray = (value) => {
|
|
13
13
|
if (!isArray(value)) return true;
|
|
@@ -2,13 +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 { isDate, isMap } from './chunk-
|
|
11
|
-
import { isObjectOrArray, isError, isSet, isArray, isUndefined } from './chunk-
|
|
10
|
+
import { isDate, isMap } from './chunk-AXDYWO67.js';
|
|
11
|
+
import { isObjectOrArray, isError, isSet, isArray, isUndefined } from './chunk-MSUW5VHZ.js';
|
|
12
12
|
|
|
13
13
|
var isRegExp = (value) => {
|
|
14
14
|
return value instanceof RegExp;
|
|
@@ -2,12 +2,12 @@
|
|
|
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 { isNonEmptyString, isPlainObject } from './chunk-
|
|
10
|
+
import { isNonEmptyString, isPlainObject } from './chunk-MSUW5VHZ.js';
|
|
11
11
|
|
|
12
12
|
var removeSpaces = (value, options = {
|
|
13
13
|
trimOnly: false
|
|
@@ -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
10
|
'use strict';
|
|
11
11
|
|
|
12
|
-
var
|
|
13
|
-
var
|
|
14
|
-
var
|
|
15
|
-
var
|
|
16
|
-
var
|
|
12
|
+
var chunkM7ELWZXM_cjs = require('./chunk-M7ELWZXM.cjs');
|
|
13
|
+
var chunkEBYFYZW4_cjs = require('./chunk-EBYFYZW4.cjs');
|
|
14
|
+
var chunkWLOQQFDS_cjs = require('./chunk-WLOQQFDS.cjs');
|
|
15
|
+
var chunkDAPAK2W3_cjs = require('./chunk-DAPAK2W3.cjs');
|
|
16
|
+
var chunkSYHPSOUU_cjs = require('./chunk-SYHPSOUU.cjs');
|
|
17
17
|
|
|
18
18
|
var NormalizePathnameError = class _NormalizePathnameError extends Error {
|
|
19
19
|
/** * ***The original error that triggered this normalization failure.***
|
|
@@ -22,10 +22,10 @@ var NormalizePathnameError = class _NormalizePathnameError extends Error {
|
|
|
22
22
|
*/
|
|
23
23
|
originalError;
|
|
24
24
|
constructor(message, originalError) {
|
|
25
|
-
super(message,
|
|
25
|
+
super(message, chunkSYHPSOUU_cjs.isFunction(Error) ? { cause: originalError } : void 0);
|
|
26
26
|
this.name = "NormalizePathnameError";
|
|
27
27
|
this.originalError = originalError;
|
|
28
|
-
if (
|
|
28
|
+
if (chunkSYHPSOUU_cjs.isFunction(Error.captureStackTrace)) {
|
|
29
29
|
Error.captureStackTrace(this, _NormalizePathnameError);
|
|
30
30
|
} else {
|
|
31
31
|
this.stack = new Error(message).stack;
|
|
@@ -50,7 +50,7 @@ function normalizePathname(pathname, options = {
|
|
|
50
50
|
defaultPath: "/",
|
|
51
51
|
keepNullable: false
|
|
52
52
|
}) {
|
|
53
|
-
|
|
53
|
+
chunkSYHPSOUU_cjs.assertIsPlainObject(options, {
|
|
54
54
|
message({ currentType, validType }) {
|
|
55
55
|
return `Second parameter (\`options\`) must be of type \`${validType}\`, but received: \`${currentType}\`.`;
|
|
56
56
|
}
|
|
@@ -62,45 +62,45 @@ function normalizePathname(pathname, options = {
|
|
|
62
62
|
localhostDomain = false,
|
|
63
63
|
ignoreDomainExtensions = void 0
|
|
64
64
|
} = options;
|
|
65
|
-
if (!
|
|
65
|
+
if (!chunkSYHPSOUU_cjs.isNonEmptyString(defaultPath)) {
|
|
66
66
|
throw new TypeError(
|
|
67
|
-
`Parameter \`defaultPath\` property of the \`options\` (second parameter) must be of type \`string\` and not empty-string, but received: \`${
|
|
67
|
+
`Parameter \`defaultPath\` property of the \`options\` (second parameter) must be of type \`string\` and not empty-string, but received: \`${chunkSYHPSOUU_cjs.getPreciseType(
|
|
68
68
|
defaultPath
|
|
69
|
-
)}\`, with value: \`${
|
|
69
|
+
)}\`, with value: \`${chunkDAPAK2W3_cjs.safeStableStringify(defaultPath, {
|
|
70
70
|
keepUndefined: true
|
|
71
71
|
})}\`.`
|
|
72
72
|
);
|
|
73
73
|
}
|
|
74
|
-
|
|
74
|
+
chunkSYHPSOUU_cjs.assertIsBoolean(keepNullable, {
|
|
75
75
|
message({ currentType, validType }) {
|
|
76
76
|
return `Parameter \`keepNullable\` property of the \`options\` (second parameter) must be of type \`${validType}\`, but received: \`${currentType}\`.`;
|
|
77
77
|
}
|
|
78
78
|
});
|
|
79
|
-
|
|
79
|
+
chunkSYHPSOUU_cjs.assertIsBoolean(keepTrailingSlash, {
|
|
80
80
|
message({ currentType, validType }) {
|
|
81
81
|
return `Parameter \`keepTrailingSlash\` property of the \`options\` (second parameter) must be of type \`${validType}\`, but received: \`${currentType}\`.`;
|
|
82
82
|
}
|
|
83
83
|
});
|
|
84
|
-
|
|
84
|
+
chunkSYHPSOUU_cjs.assertIsBoolean(localhostDomain, {
|
|
85
85
|
message({ currentType, validType }) {
|
|
86
86
|
return `Parameter \`localhostDomain\` property of the \`options\` (second parameter) must be of type \`${validType}\`, but received: \`${currentType}\`.`;
|
|
87
87
|
}
|
|
88
88
|
});
|
|
89
89
|
let ignoreDomainExtsSet;
|
|
90
|
-
if (!
|
|
91
|
-
if (!
|
|
90
|
+
if (!chunkSYHPSOUU_cjs.isUndefined(ignoreDomainExtensions)) {
|
|
91
|
+
if (!chunkSYHPSOUU_cjs.isSet(ignoreDomainExtensions) && !chunkSYHPSOUU_cjs.isArray(ignoreDomainExtensions)) {
|
|
92
92
|
throw new TypeError(
|
|
93
|
-
`Parameter \`ignoreDomainExtensions\` must be of type a \`Set<string>\` or \`string[]\`, but received: \`${
|
|
93
|
+
`Parameter \`ignoreDomainExtensions\` must be of type a \`Set<string>\` or \`string[]\`, but received: \`${chunkSYHPSOUU_cjs.getPreciseType(
|
|
94
94
|
ignoreDomainExtensions
|
|
95
95
|
)}\`.`
|
|
96
96
|
);
|
|
97
97
|
}
|
|
98
|
-
ignoreDomainExtsSet =
|
|
98
|
+
ignoreDomainExtsSet = chunkSYHPSOUU_cjs.isSet(ignoreDomainExtensions) ? ignoreDomainExtensions : new Set(ignoreDomainExtensions);
|
|
99
99
|
let idx = 0;
|
|
100
100
|
for (const ext of ignoreDomainExtsSet) {
|
|
101
|
-
if (!
|
|
101
|
+
if (!chunkSYHPSOUU_cjs.isNonEmptyString(ext)) {
|
|
102
102
|
throw new TypeError(
|
|
103
|
-
`Parameter \`ignoreDomainExtensions[${idx}]\` must be a \`string\` and \`non-empty string\`, but received: \`${
|
|
103
|
+
`Parameter \`ignoreDomainExtensions[${idx}]\` must be a \`string\` and \`non-empty string\`, but received: \`${chunkDAPAK2W3_cjs.safeStableStringify(
|
|
104
104
|
ext,
|
|
105
105
|
{ keepUndefined: true }
|
|
106
106
|
)}\`.`
|
|
@@ -108,7 +108,7 @@ function normalizePathname(pathname, options = {
|
|
|
108
108
|
}
|
|
109
109
|
if (!ext.startsWith(".")) {
|
|
110
110
|
throw new TypeError(
|
|
111
|
-
`Parameter \`ignoreDomainExtensions[${idx}]\` must start with a dot (.), but received: ${
|
|
111
|
+
`Parameter \`ignoreDomainExtensions[${idx}]\` must start with a dot (.), but received: ${chunkDAPAK2W3_cjs.safeStableStringify(
|
|
112
112
|
ext,
|
|
113
113
|
{ keepUndefined: true }
|
|
114
114
|
)}`
|
|
@@ -118,12 +118,12 @@ function normalizePathname(pathname, options = {
|
|
|
118
118
|
}
|
|
119
119
|
}
|
|
120
120
|
try {
|
|
121
|
-
if (keepNullable && (
|
|
122
|
-
if (
|
|
121
|
+
if (keepNullable && (chunkSYHPSOUU_cjs.isNil(pathname) || !chunkSYHPSOUU_cjs.isString(pathname))) {
|
|
122
|
+
if (chunkSYHPSOUU_cjs.isNull(pathname)) return null;
|
|
123
123
|
return void 0;
|
|
124
124
|
}
|
|
125
|
-
let currentPathName =
|
|
126
|
-
currentPathName =
|
|
125
|
+
let currentPathName = chunkSYHPSOUU_cjs.isNonEmptyString(pathname) ? pathname : defaultPath;
|
|
126
|
+
currentPathName = chunkEBYFYZW4_cjs.removeSpaces(currentPathName, { trimOnly: true }).replace(
|
|
127
127
|
/\s+/g,
|
|
128
128
|
""
|
|
129
129
|
);
|
|
@@ -192,7 +192,7 @@ var stripLeadingDomain = (path, options) => {
|
|
|
192
192
|
const segments = currentPath.split("/");
|
|
193
193
|
const firstPart = segments[0];
|
|
194
194
|
const domainPart = firstPart.split(":")[0];
|
|
195
|
-
const isDomain =
|
|
195
|
+
const isDomain = chunkM7ELWZXM_cjs.isValidDomain(domainPart, {
|
|
196
196
|
subdomain: true,
|
|
197
197
|
allowUnicode: true,
|
|
198
198
|
wildcard: true,
|
|
@@ -220,7 +220,7 @@ var ensureLeadingSlash = (path) => {
|
|
|
220
220
|
return path;
|
|
221
221
|
};
|
|
222
222
|
var throwError = (error) => {
|
|
223
|
-
const err =
|
|
223
|
+
const err = chunkSYHPSOUU_cjs.isError(error) ? error : new Error("Unknown error from function `normalizePathname()`.");
|
|
224
224
|
throw new NormalizePathnameError(
|
|
225
225
|
`Failed to normalize pathname in function \`normalizePathname()\`: ${err.message}`,
|
|
226
226
|
err
|
|
@@ -228,20 +228,20 @@ var throwError = (error) => {
|
|
|
228
228
|
};
|
|
229
229
|
|
|
230
230
|
var formatEnvPort = (envVar, options = {}) => {
|
|
231
|
-
if (!
|
|
232
|
-
|
|
231
|
+
if (!chunkSYHPSOUU_cjs.isNonEmptyString(envVar)) return "";
|
|
232
|
+
chunkSYHPSOUU_cjs.assertIsPlainObject(options, {
|
|
233
233
|
message: ({ currentType, validType }) => `Second parameter (\`options\`) must be of type \`${validType}\`, but received: \`${currentType}\`.`
|
|
234
234
|
});
|
|
235
|
-
const prefixColon =
|
|
236
|
-
if (!
|
|
235
|
+
const prefixColon = chunkSYHPSOUU_cjs.hasOwnProp(options, "prefixColon") ? options.prefixColon : false;
|
|
236
|
+
if (!chunkSYHPSOUU_cjs.isBoolean(prefixColon)) {
|
|
237
237
|
throw new TypeError(
|
|
238
|
-
`Parameter \`prefixColon\` property of the \`options\` (second parameter) must be of type \`boolean\`, but received: \`${
|
|
238
|
+
`Parameter \`prefixColon\` property of the \`options\` (second parameter) must be of type \`boolean\`, but received: \`${chunkSYHPSOUU_cjs.getPreciseType(
|
|
239
239
|
prefixColon
|
|
240
240
|
)}\`.`
|
|
241
241
|
);
|
|
242
242
|
}
|
|
243
243
|
const digitsOnly = envVar.replace(/\D+/g, "");
|
|
244
|
-
if (
|
|
244
|
+
if (chunkWLOQQFDS_cjs.isEmptyString(digitsOnly)) return "";
|
|
245
245
|
return prefixColon ? `:${digitsOnly}` : digitsOnly;
|
|
246
246
|
};
|
|
247
247
|
|
|
@@ -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
|
-
import { isEmptyString } from './chunk-
|
|
11
|
-
import { assertIsArray } from './chunk-
|
|
12
|
-
import { isPlainObject, isNumber, isNonEmptyString, isFunction, hasOwnProp, isNonEmptyArray, getPreciseType, isString, isObjectOrArray, isStringObject, isNumberObject, isBooleanObject, isArray } from './chunk-
|
|
10
|
+
import { isEmptyString } from './chunk-ULQPCIA2.js';
|
|
11
|
+
import { assertIsArray } from './chunk-RZOGBYIS.js';
|
|
12
|
+
import { isPlainObject, isNumber, isNonEmptyString, isFunction, hasOwnProp, isNonEmptyArray, getPreciseType, isString, isObjectOrArray, isStringObject, isNumberObject, isBooleanObject, isArray } from './chunk-MSUW5VHZ.js';
|
|
13
13
|
import { getDefaultConfig, extendTailwindMerge } from 'tailwind-merge-v3';
|
|
14
14
|
import { getDefaultConfig as getDefaultConfig$1, extendTailwindMerge as extendTailwindMerge$1 } from 'tailwind-merge-v4';
|
|
15
15
|
|
|
@@ -2,13 +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 { punycodeUtilsJS } from './chunk-
|
|
11
|
-
import { isNonEmptyString, assertIsPlainObject, assertIsBoolean } from './chunk-
|
|
10
|
+
import { punycodeUtilsJS } from './chunk-6YGBRENU.js';
|
|
11
|
+
import { isNonEmptyString, assertIsPlainObject, assertIsBoolean } from './chunk-MSUW5VHZ.js';
|
|
12
12
|
|
|
13
13
|
var EXTENSIONS_FILE = /* @__PURE__ */ new Set([
|
|
14
14
|
// 📄 Text & Document
|
|
@@ -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
|
* ====================================================
|
|
@@ -10,62 +10,62 @@
|
|
|
10
10
|
'use strict';
|
|
11
11
|
|
|
12
12
|
var chunkKHO2SBNA_cjs = require('./chunk-KHO2SBNA.cjs');
|
|
13
|
-
var
|
|
14
|
-
var
|
|
15
|
-
var
|
|
13
|
+
var chunkNVRZPF5M_cjs = require('./chunk-NVRZPF5M.cjs');
|
|
14
|
+
var chunkU23I7JPB_cjs = require('./chunk-U23I7JPB.cjs');
|
|
15
|
+
var chunkRMP7VMPB_cjs = require('./chunk-RMP7VMPB.cjs');
|
|
16
16
|
var chunkDVMHRLKP_cjs = require('./chunk-DVMHRLKP.cjs');
|
|
17
|
-
var
|
|
18
|
-
var
|
|
19
|
-
var
|
|
20
|
-
var
|
|
21
|
-
var
|
|
17
|
+
var chunkHYN6FC5A_cjs = require('./chunk-HYN6FC5A.cjs');
|
|
18
|
+
var chunkWLOQQFDS_cjs = require('./chunk-WLOQQFDS.cjs');
|
|
19
|
+
var chunkDLS3G6WQ_cjs = require('./chunk-DLS3G6WQ.cjs');
|
|
20
|
+
var chunkDAPAK2W3_cjs = require('./chunk-DAPAK2W3.cjs');
|
|
21
|
+
var chunkSYHPSOUU_cjs = require('./chunk-SYHPSOUU.cjs');
|
|
22
22
|
|
|
23
23
|
var constructURL = (baseUrl, queryParams, removeParams) => {
|
|
24
|
-
if (
|
|
25
|
-
if (
|
|
24
|
+
if (chunkSYHPSOUU_cjs.isString(baseUrl)) {
|
|
25
|
+
if (chunkWLOQQFDS_cjs.isEmptyString(baseUrl)) {
|
|
26
26
|
throw new TypeError(`First parameter (\`baseUrl\`) cannot be an empty-string.`);
|
|
27
27
|
}
|
|
28
|
-
baseUrl =
|
|
28
|
+
baseUrl = chunkNVRZPF5M_cjs.normalizeString(baseUrl);
|
|
29
29
|
} else if (!chunkKHO2SBNA_cjs.isURL(baseUrl)) {
|
|
30
30
|
throw new TypeError(
|
|
31
|
-
`First parameter (\`baseUrl\`) must be of type an URL instance or a \`string\` and a non empty-string, but received: \`${
|
|
31
|
+
`First parameter (\`baseUrl\`) must be of type an URL instance or a \`string\` and a non empty-string, but received: \`${chunkSYHPSOUU_cjs.getPreciseType(
|
|
32
32
|
baseUrl
|
|
33
|
-
)}\`, with current value: \`${
|
|
33
|
+
)}\`, with current value: \`${chunkDAPAK2W3_cjs.safeStableStringify(baseUrl, {
|
|
34
34
|
keepUndefined: true
|
|
35
35
|
})}\`.`
|
|
36
36
|
);
|
|
37
37
|
}
|
|
38
|
-
if (!
|
|
39
|
-
|
|
38
|
+
if (!chunkSYHPSOUU_cjs.isUndefined(removeParams)) {
|
|
39
|
+
chunkDLS3G6WQ_cjs.assertIsArray(removeParams, {
|
|
40
40
|
message: ({ currentType, validType }) => `Third parameter (\`removeParams\`) must be of type \`${validType} of strings\`, but received: \`${currentType}\`.`
|
|
41
41
|
});
|
|
42
|
-
if (!removeParams.every((param) =>
|
|
42
|
+
if (!removeParams.every((param) => chunkSYHPSOUU_cjs.isNonEmptyString(param))) {
|
|
43
43
|
throw new TypeError(
|
|
44
44
|
`Third parameter (\`removeParams\`) must be of type \`array\` and contains \`string\` only and non empty-string.`
|
|
45
45
|
);
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
48
|
try {
|
|
49
|
-
if (!
|
|
49
|
+
if (!chunkSYHPSOUU_cjs.isUndefined(queryParams) && !chunkSYHPSOUU_cjs.isFunction(queryParams[Symbol.iterator])) {
|
|
50
50
|
throw new TypeError(
|
|
51
|
-
`Second parameter (\`queryParams\`) must be iterable (like URLSearchParams.entries() or an array of [[string, string | number]...]), but received: \`${
|
|
51
|
+
`Second parameter (\`queryParams\`) must be iterable (like URLSearchParams.entries() or an array of [[string, string | number]...]), but received: \`${chunkSYHPSOUU_cjs.getPreciseType(
|
|
52
52
|
queryParams
|
|
53
|
-
)}\`, with value: \`${
|
|
53
|
+
)}\`, with value: \`${chunkDAPAK2W3_cjs.safeStableStringify(queryParams, {
|
|
54
54
|
keepUndefined: true
|
|
55
55
|
})}\`.`
|
|
56
56
|
);
|
|
57
57
|
}
|
|
58
58
|
const urlInstance = new URL(baseUrl);
|
|
59
|
-
if (!
|
|
59
|
+
if (!chunkSYHPSOUU_cjs.isUndefined(queryParams)) {
|
|
60
60
|
const paramObject = Object.fromEntries(queryParams);
|
|
61
|
-
if (!
|
|
61
|
+
if (!chunkRMP7VMPB_cjs.isEmptyValue(paramObject)) {
|
|
62
62
|
const mergedParams = new URLSearchParams(urlInstance.search);
|
|
63
63
|
for (const [key, value] of Object.entries(paramObject)) {
|
|
64
|
-
if (!
|
|
64
|
+
if (!chunkSYHPSOUU_cjs.isNonEmptyString(value) && !chunkSYHPSOUU_cjs.isNumber(value, { includeNaN: true })) {
|
|
65
65
|
throw new TypeError(
|
|
66
|
-
`Second parameter (\`queryParams\`) must be iterable (like URLSearchParams.entries() or an array of [[string, string | number]...]), but received: \`${
|
|
66
|
+
`Second parameter (\`queryParams\`) must be iterable (like URLSearchParams.entries() or an array of [[string, string | number]...]), but received: \`${chunkSYHPSOUU_cjs.getPreciseType(
|
|
67
67
|
queryParams
|
|
68
|
-
)}\`, with value: \`${
|
|
68
|
+
)}\`, with value: \`${chunkDAPAK2W3_cjs.safeStableStringify(queryParams, {
|
|
69
69
|
keepUndefined: true
|
|
70
70
|
})}\`.`
|
|
71
71
|
);
|
|
@@ -73,7 +73,7 @@ var constructURL = (baseUrl, queryParams, removeParams) => {
|
|
|
73
73
|
mergedParams.set(key, String(value));
|
|
74
74
|
}
|
|
75
75
|
if (removeParams?.length) {
|
|
76
|
-
|
|
76
|
+
chunkU23I7JPB_cjs.toStringArrayUnRecursive(removeParams).map((paramKey) => {
|
|
77
77
|
mergedParams.delete(paramKey);
|
|
78
78
|
});
|
|
79
79
|
}
|
|
@@ -83,7 +83,7 @@ var constructURL = (baseUrl, queryParams, removeParams) => {
|
|
|
83
83
|
removeParams?.forEach((param) => urlInstance.searchParams.delete(param));
|
|
84
84
|
return urlInstance;
|
|
85
85
|
} catch (error) {
|
|
86
|
-
if (
|
|
86
|
+
if (chunkSYHPSOUU_cjs.isError(error)) throw error;
|
|
87
87
|
throw new Error(
|
|
88
88
|
"Failed to construct a valid URL in `constructURL()`, Error:" + error
|
|
89
89
|
);
|
|
@@ -91,7 +91,7 @@ var constructURL = (baseUrl, queryParams, removeParams) => {
|
|
|
91
91
|
};
|
|
92
92
|
|
|
93
93
|
var extractURLs = (url) => {
|
|
94
|
-
if (!
|
|
94
|
+
if (!chunkSYHPSOUU_cjs.isNonEmptyString(url)) return null;
|
|
95
95
|
let decoded;
|
|
96
96
|
try {
|
|
97
97
|
decoded = decodeURIComponent(url);
|
|
@@ -113,66 +113,66 @@ var extractURLs = (url) => {
|
|
|
113
113
|
};
|
|
114
114
|
|
|
115
115
|
var getFirstPrefixPathname = (result, defaultValue = "/") => {
|
|
116
|
-
if (!
|
|
116
|
+
if (!chunkSYHPSOUU_cjs.isNonEmptyString(defaultValue)) {
|
|
117
117
|
throw new TypeError(
|
|
118
|
-
`Second parameter (\`defaultValue\`) must be of type \`string\` and not an \`empty-string\`, but received: \`${
|
|
118
|
+
`Second parameter (\`defaultValue\`) must be of type \`string\` and not an \`empty-string\`, but received: \`${chunkSYHPSOUU_cjs.getPreciseType(
|
|
119
119
|
defaultValue
|
|
120
|
-
)}\`, with value: \`${
|
|
120
|
+
)}\`, with value: \`${chunkDAPAK2W3_cjs.safeStableStringify(defaultValue, {
|
|
121
121
|
keepUndefined: true
|
|
122
122
|
})}\`.`
|
|
123
123
|
);
|
|
124
124
|
}
|
|
125
|
-
if (
|
|
126
|
-
if (!result.every((item) =>
|
|
125
|
+
if (chunkSYHPSOUU_cjs.isArray(result)) {
|
|
126
|
+
if (!result.every((item) => chunkSYHPSOUU_cjs.isString(item))) {
|
|
127
127
|
throw new TypeError(
|
|
128
|
-
`First parameter (\`result\`) must be of type \`string\` or \`array of string\`, but received: \`${
|
|
128
|
+
`First parameter (\`result\`) must be of type \`string\` or \`array of string\`, but received: \`${chunkSYHPSOUU_cjs.getPreciseType(
|
|
129
129
|
result
|
|
130
|
-
)}\`, with value: \`${
|
|
130
|
+
)}\`, with value: \`${chunkDAPAK2W3_cjs.safeStableStringify(result, {
|
|
131
131
|
keepUndefined: true
|
|
132
132
|
})}\`.`
|
|
133
133
|
);
|
|
134
134
|
}
|
|
135
135
|
for (const item of result) {
|
|
136
|
-
const normalized =
|
|
136
|
+
const normalized = chunkHYN6FC5A_cjs.normalizePathname(item);
|
|
137
137
|
if (normalized !== "/") {
|
|
138
138
|
return normalized;
|
|
139
139
|
}
|
|
140
140
|
}
|
|
141
|
-
return
|
|
141
|
+
return chunkHYN6FC5A_cjs.normalizePathname(defaultValue);
|
|
142
142
|
}
|
|
143
|
-
if (
|
|
144
|
-
const normalized =
|
|
145
|
-
return normalized !== "/" ? normalized :
|
|
143
|
+
if (chunkSYHPSOUU_cjs.isString(result)) {
|
|
144
|
+
const normalized = chunkHYN6FC5A_cjs.normalizePathname(result);
|
|
145
|
+
return normalized !== "/" ? normalized : chunkHYN6FC5A_cjs.normalizePathname(defaultValue);
|
|
146
146
|
}
|
|
147
|
-
if (!
|
|
147
|
+
if (!chunkSYHPSOUU_cjs.isNil(result)) {
|
|
148
148
|
throw new TypeError(
|
|
149
|
-
`First parameter (\`result\`) must be of type \`string\`, \`array-string\`, \`null\` or \`undefined\`, but received: \`${
|
|
149
|
+
`First parameter (\`result\`) must be of type \`string\`, \`array-string\`, \`null\` or \`undefined\`, but received: \`${chunkSYHPSOUU_cjs.getPreciseType(
|
|
150
150
|
result
|
|
151
151
|
)}\`.`
|
|
152
152
|
);
|
|
153
153
|
}
|
|
154
|
-
return
|
|
154
|
+
return chunkHYN6FC5A_cjs.normalizePathname(defaultValue);
|
|
155
155
|
};
|
|
156
156
|
|
|
157
157
|
var getPrefixPathname = (url, base = null, options = {}) => {
|
|
158
158
|
const errors = [];
|
|
159
|
-
if (!
|
|
159
|
+
if (!chunkSYHPSOUU_cjs.isString(url) && !chunkSYHPSOUU_cjs.isArray(url)) {
|
|
160
160
|
errors.push(
|
|
161
|
-
`First parameter (\`url\`) must be of type \`string\` or \`array-string\`, but received: \`${
|
|
161
|
+
`First parameter (\`url\`) must be of type \`string\` or \`array-string\`, but received: \`${chunkSYHPSOUU_cjs.getPreciseType(
|
|
162
162
|
url
|
|
163
163
|
)}\`.`
|
|
164
164
|
);
|
|
165
165
|
}
|
|
166
|
-
if (!
|
|
166
|
+
if (!chunkSYHPSOUU_cjs.isString(base) && !chunkSYHPSOUU_cjs.isArray(base) && !chunkSYHPSOUU_cjs.isNull(base)) {
|
|
167
167
|
errors.push(
|
|
168
|
-
`Second parameter (\`base\`) must be of type \`string\`, \`array-string\` or \`null\`, but received: \`${
|
|
168
|
+
`Second parameter (\`base\`) must be of type \`string\`, \`array-string\` or \`null\`, but received: \`${chunkSYHPSOUU_cjs.getPreciseType(
|
|
169
169
|
base
|
|
170
170
|
)}\`.`
|
|
171
171
|
);
|
|
172
172
|
}
|
|
173
|
-
if (!
|
|
173
|
+
if (!chunkSYHPSOUU_cjs.isPlainObject(options)) {
|
|
174
174
|
errors.push(
|
|
175
|
-
`Second parameter (\`options\`) must be of type \`plain-object\`, but received: \`${
|
|
175
|
+
`Second parameter (\`options\`) must be of type \`plain-object\`, but received: \`${chunkSYHPSOUU_cjs.getPreciseType(
|
|
176
176
|
options
|
|
177
177
|
)}\`.`
|
|
178
178
|
);
|
|
@@ -180,48 +180,48 @@ var getPrefixPathname = (url, base = null, options = {}) => {
|
|
|
180
180
|
const { levels = 1, removeDuplicates = true } = options;
|
|
181
181
|
if (!chunkDVMHRLKP_cjs.isInteger(levels) || chunkDVMHRLKP_cjs.isInteger(levels) && levels < 0) {
|
|
182
182
|
errors.push(
|
|
183
|
-
`Parameter \`levels\` property of the \`options\` (second parameter) must be of type \`integer-number\` and minimum is \`0\`, but received: \`${
|
|
183
|
+
`Parameter \`levels\` property of the \`options\` (second parameter) must be of type \`integer-number\` and minimum is \`0\`, but received: \`${chunkSYHPSOUU_cjs.getPreciseType(
|
|
184
184
|
levels
|
|
185
|
-
)}\`, with value: \`${
|
|
185
|
+
)}\`, with value: \`${chunkDAPAK2W3_cjs.safeStableStringify(levels, {
|
|
186
186
|
keepUndefined: true
|
|
187
187
|
})}\`.`
|
|
188
188
|
);
|
|
189
189
|
}
|
|
190
|
-
if (!
|
|
190
|
+
if (!chunkSYHPSOUU_cjs.isBoolean(removeDuplicates)) {
|
|
191
191
|
errors.push(
|
|
192
|
-
`Parameter \`removeDuplicates\` property of the \`options\` (second parameter) must be of type \`boolean\`, but received: \`${
|
|
192
|
+
`Parameter \`removeDuplicates\` property of the \`options\` (second parameter) must be of type \`boolean\`, but received: \`${chunkSYHPSOUU_cjs.getPreciseType(
|
|
193
193
|
removeDuplicates
|
|
194
194
|
)}\`.`
|
|
195
195
|
);
|
|
196
196
|
}
|
|
197
|
-
if (
|
|
197
|
+
if (chunkSYHPSOUU_cjs.isNonEmptyArray(errors)) {
|
|
198
198
|
throw new TypeError(
|
|
199
199
|
`Invalid parameter(s) in \`getPrefixPathname\` function:
|
|
200
200
|
- ${errors.join("\n- ")}`
|
|
201
201
|
);
|
|
202
202
|
}
|
|
203
203
|
function getLevel(singleUrl) {
|
|
204
|
-
const parts =
|
|
204
|
+
const parts = chunkHYN6FC5A_cjs.normalizePathname(singleUrl).split("/").filter(Boolean);
|
|
205
205
|
return `/${parts.slice(0, levels).join("/")}`;
|
|
206
206
|
}
|
|
207
207
|
function processUrl(singleUrl) {
|
|
208
208
|
if (base) {
|
|
209
|
-
singleUrl =
|
|
210
|
-
if (
|
|
209
|
+
singleUrl = chunkHYN6FC5A_cjs.normalizePathname(singleUrl);
|
|
210
|
+
if (chunkSYHPSOUU_cjs.isArray(base)) {
|
|
211
211
|
for (const b of base) {
|
|
212
|
-
if (singleUrl.startsWith(
|
|
212
|
+
if (singleUrl.startsWith(chunkHYN6FC5A_cjs.normalizePathname(b))) {
|
|
213
213
|
return getLevel(singleUrl);
|
|
214
214
|
}
|
|
215
215
|
}
|
|
216
|
-
} else if (
|
|
216
|
+
} else if (chunkSYHPSOUU_cjs.isNonEmptyString(base) && singleUrl.startsWith(chunkHYN6FC5A_cjs.normalizePathname(base))) {
|
|
217
217
|
return getLevel(singleUrl);
|
|
218
218
|
}
|
|
219
219
|
return null;
|
|
220
220
|
}
|
|
221
221
|
return getLevel(singleUrl);
|
|
222
222
|
}
|
|
223
|
-
if (
|
|
224
|
-
const result = url.map(processUrl).filter((r) => !
|
|
223
|
+
if (chunkSYHPSOUU_cjs.isArray(url)) {
|
|
224
|
+
const result = url.map(processUrl).filter((r) => !chunkSYHPSOUU_cjs.isNull(r));
|
|
225
225
|
const uniqueResult = removeDuplicates ? [...new Set(result)] : result;
|
|
226
226
|
if (uniqueResult.length === 1) {
|
|
227
227
|
return uniqueResult[0];
|
|
@@ -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
10
|
import { isInteger } from './chunk-WVSPXFTY.js';
|
|
11
|
-
import { safeStableStringify } from './chunk-
|
|
12
|
-
import { getPreciseType, isNull } from './chunk-
|
|
11
|
+
import { safeStableStringify } from './chunk-AXDYWO67.js';
|
|
12
|
+
import { getPreciseType, isNull } from './chunk-MSUW5VHZ.js';
|
|
13
13
|
|
|
14
14
|
var CustomPromise = class extends Promise {
|
|
15
15
|
_value;
|