@rzl-zone/utils-js 3.5.7 → 3.7.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 +1 -1
- package/dist/assertions/index.cjs +1 -1
- package/dist/assertions/index.d.ts +1 -1
- package/dist/assertions/index.js +1 -1
- package/dist/chunk-2CQI36UD.cjs +1 -1
- package/dist/chunk-2VO2CBTU.js +1 -1
- package/dist/chunk-3KTD3QDI.js +1 -1
- package/dist/{chunk-RS5RBLPB.js → chunk-3LEWQV3R.js} +46 -8
- package/dist/chunk-4ACKNPL5.js +1 -1
- package/dist/chunk-4ZOXSUXB.js +1 -1
- package/dist/chunk-5NN4ZDE2.cjs +1 -1
- package/dist/chunk-66WLOZOD.cjs +1 -1
- package/dist/{chunk-6DSPJA5U.js → chunk-6PKW4WCT.js} +2 -2
- package/dist/chunk-6RFNZ2ZZ.cjs +1 -1
- 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-ABA2ZSBQ.js +1 -1
- 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-BG3AS5BU.cjs +173 -0
- package/dist/chunk-BYUT376O.cjs +1 -1
- package/dist/{chunk-RIEYB2AW.cjs → chunk-CKUEZF4R.cjs} +1 -1
- package/dist/chunk-D53CE4BT.js +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-JY4HLZ4W.js +1 -1
- package/dist/chunk-K3SONK25.cjs +1 -1
- package/dist/chunk-K63WO3XA.cjs +1 -1
- package/dist/chunk-KHO2SBNA.cjs +1 -1
- package/dist/{chunk-TPYENEQ4.cjs → chunk-KIYALQQF.cjs} +44 -9
- package/dist/chunk-KPCDDYTZ.js +1 -1
- package/dist/chunk-KTQLDIIT.cjs +1 -1
- package/dist/chunk-L5RDAVVH.js +1 -1
- package/dist/chunk-LEX4TQW2.js +1 -1
- package/dist/chunk-LIU4S3JA.cjs +1 -1
- package/dist/chunk-NREACG6M.cjs +1 -1
- package/dist/chunk-OFBFGFVH.js +1 -1
- package/dist/chunk-ONZFBJVW.js +1 -1
- package/dist/chunk-OS5OT5JA.cjs +1 -1
- package/dist/chunk-PZQC3FZY.js +1 -1
- package/dist/chunk-QAPYHLHC.cjs +1 -1
- package/dist/chunk-QNKGP5DY.js +1 -1
- package/dist/chunk-QUITZ3GP.js +1 -1
- package/dist/{chunk-H5NWBTHW.cjs → chunk-R3PBF6F7.cjs} +11 -11
- package/dist/chunk-RMJC3B5P.cjs +1 -1
- package/dist/chunk-SZJ7OI4S.js +1 -1
- package/dist/chunk-TDPYR5JY.js +1 -1
- package/dist/chunk-TDYGYHSH.js +1 -1
- package/dist/chunk-TFDXRT6D.cjs +1 -1
- package/dist/{chunk-SN6YRDLG.js → 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 +1997 -0
- package/dist/chunk-VNADVWSJ.js +1 -1
- package/dist/chunk-WNO3EPYT.js +170 -0
- package/dist/chunk-WVSPXFTY.js +1 -1
- package/dist/chunk-XFTUHS4Y.js +1 -1
- package/dist/chunk-YC7AK3KX.cjs +1 -1
- package/dist/chunk-YGB2BQPB.cjs +1 -1
- package/dist/chunk-YS27V6LS.js +1994 -0
- package/dist/chunk-YWHHVDT4.js +1 -1
- package/dist/chunk-ZN53RM3R.js +1 -1
- package/dist/conversions/index.cjs +1 -1
- package/dist/conversions/index.d.ts +1 -1
- package/dist/conversions/index.js +1 -1
- package/dist/events/index.cjs +1 -1
- package/dist/events/index.d.ts +1 -1
- package/dist/events/index.js +1 -1
- package/dist/formatters/index.cjs +1 -1
- package/dist/formatters/index.d.ts +1 -1
- package/dist/formatters/index.js +1 -1
- package/dist/generators/index.cjs +1 -1
- package/dist/generators/index.d.ts +1 -1
- package/dist/generators/index.js +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/isPlainObject-FWmcJF6k.d.ts +1 -1
- package/dist/next/index.cjs +9 -8
- package/dist/next/index.d.ts +1 -1
- package/dist/next/index.js +3 -2
- package/dist/next/server/index.cjs +1 -1
- package/dist/next/server/index.d.ts +1 -1
- package/dist/next/server/index.js +1 -1
- package/dist/operations/index.cjs +1 -1
- package/dist/operations/index.d.ts +1 -1
- package/dist/operations/index.js +1 -1
- 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 +33 -28
- package/dist/predicates/index.d.ts +142 -2
- package/dist/predicates/index.js +3 -2
- package/dist/promises/index.cjs +1 -1
- package/dist/promises/index.d.ts +1 -1
- package/dist/promises/index.js +1 -1
- 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 +13 -9
- package/dist/tailwind/index.d.ts +124 -19
- package/dist/tailwind/index.js +2 -2
- package/dist/urls/index.cjs +14 -9
- package/dist/urls/index.d.ts +268 -19
- package/dist/urls/index.js +4 -3
- package/package.json +11 -3
- package/dist/chunk-LBNOZIZ6.js +0 -90
- package/dist/chunk-URDI3IMY.cjs +0 -93
package/README.md
CHANGED
|
@@ -134,7 +134,7 @@
|
|
|
134
134
|
|
|
135
135
|
<h2 id="detailed-features">💎 <strong>Detailed Features</strong></h2>
|
|
136
136
|
|
|
137
|
-
### **Full documentation <a href="https://docs
|
|
137
|
+
### **Full documentation <a href="https://rzlzone.pages.dev/docs/utils-js" target="_blank" rel="nofollow noreferrer noopener">Rzl UtilsJS</a> is **currently under construction** 🏗️.**
|
|
138
138
|
#### For now, explore the examples or dive into the source — all utilities are documented via **TSDoc** and typed properly.
|
|
139
139
|
|
|
140
140
|
```ts
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* ====================================================
|
|
3
3
|
* Rzl Utils-JS.
|
|
4
4
|
* ----------------------------------------------------
|
|
5
|
-
* Version: 3.
|
|
5
|
+
* Version: 3.7.0.
|
|
6
6
|
* Author: Rizalvin Dwiky.
|
|
7
7
|
* Repository: https://github.com/rzl-zone/utils-js.
|
|
8
8
|
* ====================================================
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* ====================================================
|
|
3
3
|
* Rzl Utils-JS.
|
|
4
4
|
* ----------------------------------------------------
|
|
5
|
-
* Version: 3.
|
|
5
|
+
* Version: 3.7.0.
|
|
6
6
|
* Author: Rizalvin Dwiky.
|
|
7
7
|
* Repository: https://github.com/rzl-zone/utils-js.
|
|
8
8
|
* ====================================================
|
package/dist/assertions/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* ====================================================
|
|
3
3
|
* Rzl Utils-JS.
|
|
4
4
|
* ----------------------------------------------------
|
|
5
|
-
* Version: 3.
|
|
5
|
+
* Version: 3.7.0.
|
|
6
6
|
* Author: Rizalvin Dwiky.
|
|
7
7
|
* Repository: https://github.com/rzl-zone/utils-js.
|
|
8
8
|
* ====================================================
|
package/dist/chunk-2CQI36UD.cjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* ====================================================
|
|
3
3
|
* Rzl Utils-JS.
|
|
4
4
|
* ----------------------------------------------------
|
|
5
|
-
* Version: 3.
|
|
5
|
+
* Version: 3.7.0.
|
|
6
6
|
* Author: Rizalvin Dwiky.
|
|
7
7
|
* Repository: https://github.com/rzl-zone/utils-js.
|
|
8
8
|
* ====================================================
|
package/dist/chunk-2VO2CBTU.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* ====================================================
|
|
3
3
|
* Rzl Utils-JS.
|
|
4
4
|
* ----------------------------------------------------
|
|
5
|
-
* Version: 3.
|
|
5
|
+
* Version: 3.7.0.
|
|
6
6
|
* Author: Rizalvin Dwiky.
|
|
7
7
|
* Repository: https://github.com/rzl-zone/utils-js.
|
|
8
8
|
* ====================================================
|
package/dist/chunk-3KTD3QDI.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* ====================================================
|
|
3
3
|
* Rzl Utils-JS.
|
|
4
4
|
* ----------------------------------------------------
|
|
5
|
-
* Version: 3.
|
|
5
|
+
* Version: 3.7.0.
|
|
6
6
|
* Author: Rizalvin Dwiky.
|
|
7
7
|
* Repository: https://github.com/rzl-zone/utils-js.
|
|
8
8
|
* ====================================================
|
|
@@ -2,18 +2,55 @@
|
|
|
2
2
|
* ====================================================
|
|
3
3
|
* Rzl Utils-JS.
|
|
4
4
|
* ----------------------------------------------------
|
|
5
|
-
* Version: 3.
|
|
5
|
+
* Version: 3.7.0.
|
|
6
6
|
* Author: Rizalvin Dwiky.
|
|
7
7
|
* Repository: https://github.com/rzl-zone/utils-js.
|
|
8
8
|
* ====================================================
|
|
9
9
|
*/
|
|
10
10
|
import { isEmptyString } from './chunk-JY4HLZ4W.js';
|
|
11
11
|
import { assertIsArray } from './chunk-6WMB5AJR.js';
|
|
12
|
-
import { isPlainObject, isNumber, isNonEmptyString, isFunction, hasOwnProp, isNonEmptyArray, getPreciseType, isString } from './chunk-3KTD3QDI.js';
|
|
13
|
-
import clsx from 'clsx';
|
|
12
|
+
import { isPlainObject, isNumber, isNonEmptyString, isFunction, hasOwnProp, isNonEmptyArray, getPreciseType, isString, isObjectOrArray, isStringObject, isNumberObject, isBooleanObject, isArray } from './chunk-3KTD3QDI.js';
|
|
14
13
|
import { getDefaultConfig, extendTailwindMerge } from 'tailwind-merge-v3';
|
|
15
14
|
import { getDefaultConfig as getDefaultConfig$1, extendTailwindMerge as extendTailwindMerge$1 } from 'tailwind-merge-v4';
|
|
16
15
|
|
|
16
|
+
function toStringValue(value) {
|
|
17
|
+
let str = "";
|
|
18
|
+
if (isNonEmptyString(value) || isNumber(value)) {
|
|
19
|
+
str += value;
|
|
20
|
+
} else if (isObjectOrArray(value)) {
|
|
21
|
+
if (isStringObject(value) || isNumberObject(value) || isBooleanObject(value)) {
|
|
22
|
+
const val = value.valueOf();
|
|
23
|
+
if (val) str += val;
|
|
24
|
+
} else if (isArray(value)) {
|
|
25
|
+
for (const item of value) {
|
|
26
|
+
if (!item) continue;
|
|
27
|
+
const y = toStringValue(item);
|
|
28
|
+
if (!y) continue;
|
|
29
|
+
if (str) str += " ";
|
|
30
|
+
str += y;
|
|
31
|
+
}
|
|
32
|
+
} else {
|
|
33
|
+
for (const key in value) {
|
|
34
|
+
if (!value[key]) continue;
|
|
35
|
+
if (str) str += " ";
|
|
36
|
+
str += key;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
return str;
|
|
41
|
+
}
|
|
42
|
+
function cx(...args) {
|
|
43
|
+
let str = "";
|
|
44
|
+
for (const arg of args) {
|
|
45
|
+
if (!arg) continue;
|
|
46
|
+
const x = toStringValue(arg);
|
|
47
|
+
if (!x) continue;
|
|
48
|
+
if (str) str += " ";
|
|
49
|
+
str += x;
|
|
50
|
+
}
|
|
51
|
+
return str;
|
|
52
|
+
}
|
|
53
|
+
|
|
17
54
|
var validatorPropsTwMerge = (options) => {
|
|
18
55
|
if (!isPlainObject(options)) options = {};
|
|
19
56
|
let { config, prefix, extend, override, cacheSize, experimentalParseClassName } = options;
|
|
@@ -140,11 +177,12 @@ var twMergeDefaultV4 = (options = {}) => {
|
|
|
140
177
|
var defaultTwMergeV3 = twMergeDefaultV3();
|
|
141
178
|
var defaultTwMergeV4 = twMergeDefaultV4();
|
|
142
179
|
var cnV3 = (...classes) => {
|
|
143
|
-
return defaultTwMergeV3(
|
|
180
|
+
return defaultTwMergeV3(cx(...classes));
|
|
144
181
|
};
|
|
145
182
|
var cnV4 = (...classes) => {
|
|
146
|
-
return defaultTwMergeV4(
|
|
183
|
+
return defaultTwMergeV4(cx(...classes));
|
|
147
184
|
};
|
|
185
|
+
|
|
148
186
|
var customCnV3 = (customTwMergeV3, ...classes) => {
|
|
149
187
|
if (!isFunction(customTwMergeV3)) {
|
|
150
188
|
throw new TypeError(
|
|
@@ -153,7 +191,7 @@ var customCnV3 = (customTwMergeV3, ...classes) => {
|
|
|
153
191
|
)}\`.`
|
|
154
192
|
);
|
|
155
193
|
}
|
|
156
|
-
return customTwMergeV3(
|
|
194
|
+
return customTwMergeV3(cx(...classes));
|
|
157
195
|
};
|
|
158
196
|
var customCnV4 = (customTwMergeV4, ...classes) => {
|
|
159
197
|
if (!isFunction(customTwMergeV4)) {
|
|
@@ -163,7 +201,7 @@ var customCnV4 = (customTwMergeV4, ...classes) => {
|
|
|
163
201
|
)}\`.`
|
|
164
202
|
);
|
|
165
203
|
}
|
|
166
|
-
return customTwMergeV4(
|
|
204
|
+
return customTwMergeV4(cx(...classes));
|
|
167
205
|
};
|
|
168
206
|
|
|
169
207
|
var shouldForwardProp = (props) => {
|
|
@@ -201,4 +239,4 @@ ${details}`
|
|
|
201
239
|
};
|
|
202
240
|
};
|
|
203
241
|
|
|
204
|
-
export { cnV3, cnV4, customCnV3, customCnV4, shouldForwardProp, twMergeDefaultV3, twMergeDefaultV4 };
|
|
242
|
+
export { cnV3, cnV4, customCnV3, customCnV4, cx, shouldForwardProp, twMergeDefaultV3, twMergeDefaultV4 };
|
package/dist/chunk-4ACKNPL5.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* ====================================================
|
|
3
3
|
* Rzl Utils-JS.
|
|
4
4
|
* ----------------------------------------------------
|
|
5
|
-
* Version: 3.
|
|
5
|
+
* Version: 3.7.0.
|
|
6
6
|
* Author: Rizalvin Dwiky.
|
|
7
7
|
* Repository: https://github.com/rzl-zone/utils-js.
|
|
8
8
|
* ====================================================
|
package/dist/chunk-4ZOXSUXB.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* ====================================================
|
|
3
3
|
* Rzl Utils-JS.
|
|
4
4
|
* ----------------------------------------------------
|
|
5
|
-
* Version: 3.
|
|
5
|
+
* Version: 3.7.0.
|
|
6
6
|
* Author: Rizalvin Dwiky.
|
|
7
7
|
* Repository: https://github.com/rzl-zone/utils-js.
|
|
8
8
|
* ====================================================
|
package/dist/chunk-5NN4ZDE2.cjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* ====================================================
|
|
3
3
|
* Rzl Utils-JS.
|
|
4
4
|
* ----------------------------------------------------
|
|
5
|
-
* Version: 3.
|
|
5
|
+
* Version: 3.7.0.
|
|
6
6
|
* Author: Rizalvin Dwiky.
|
|
7
7
|
* Repository: https://github.com/rzl-zone/utils-js.
|
|
8
8
|
* ====================================================
|
package/dist/chunk-66WLOZOD.cjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* ====================================================
|
|
3
3
|
* Rzl Utils-JS.
|
|
4
4
|
* ----------------------------------------------------
|
|
5
|
-
* Version: 3.
|
|
5
|
+
* Version: 3.7.0.
|
|
6
6
|
* Author: Rizalvin Dwiky.
|
|
7
7
|
* Repository: https://github.com/rzl-zone/utils-js.
|
|
8
8
|
* ====================================================
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* ====================================================
|
|
3
3
|
* Rzl Utils-JS.
|
|
4
4
|
* ----------------------------------------------------
|
|
5
|
-
* Version: 3.
|
|
5
|
+
* Version: 3.7.0.
|
|
6
6
|
* Author: Rizalvin Dwiky.
|
|
7
7
|
* Repository: https://github.com/rzl-zone/utils-js.
|
|
8
8
|
* ====================================================
|
|
@@ -12,7 +12,7 @@ import { normalizeString } from './chunk-GAJBF6DR.js';
|
|
|
12
12
|
import { toStringArrayUnRecursive } from './chunk-TDYGYHSH.js';
|
|
13
13
|
import { isEmptyValue } from './chunk-PZQC3FZY.js';
|
|
14
14
|
import { isInteger } from './chunk-WVSPXFTY.js';
|
|
15
|
-
import { normalizePathname } from './chunk-
|
|
15
|
+
import { normalizePathname } from './chunk-WNO3EPYT.js';
|
|
16
16
|
import { isEmptyString } from './chunk-JY4HLZ4W.js';
|
|
17
17
|
import { assertIsArray } from './chunk-6WMB5AJR.js';
|
|
18
18
|
import { safeStableStringify } from './chunk-2VO2CBTU.js';
|
package/dist/chunk-6RFNZ2ZZ.cjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* ====================================================
|
|
3
3
|
* Rzl Utils-JS.
|
|
4
4
|
* ----------------------------------------------------
|
|
5
|
-
* Version: 3.
|
|
5
|
+
* Version: 3.7.0.
|
|
6
6
|
* Author: Rizalvin Dwiky.
|
|
7
7
|
* Repository: https://github.com/rzl-zone/utils-js.
|
|
8
8
|
* ====================================================
|
package/dist/chunk-6WMB5AJR.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* ====================================================
|
|
3
3
|
* Rzl Utils-JS.
|
|
4
4
|
* ----------------------------------------------------
|
|
5
|
-
* Version: 3.
|
|
5
|
+
* Version: 3.7.0.
|
|
6
6
|
* Author: Rizalvin Dwiky.
|
|
7
7
|
* Repository: https://github.com/rzl-zone/utils-js.
|
|
8
8
|
* ====================================================
|
package/dist/chunk-7QQV66RX.cjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* ====================================================
|
|
3
3
|
* Rzl Utils-JS.
|
|
4
4
|
* ----------------------------------------------------
|
|
5
|
-
* Version: 3.
|
|
5
|
+
* Version: 3.7.0.
|
|
6
6
|
* Author: Rizalvin Dwiky.
|
|
7
7
|
* Repository: https://github.com/rzl-zone/utils-js.
|
|
8
8
|
* ====================================================
|
package/dist/chunk-7WBMA2VE.cjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* ====================================================
|
|
3
3
|
* Rzl Utils-JS.
|
|
4
4
|
* ----------------------------------------------------
|
|
5
|
-
* Version: 3.
|
|
5
|
+
* Version: 3.7.0.
|
|
6
6
|
* Author: Rizalvin Dwiky.
|
|
7
7
|
* Repository: https://github.com/rzl-zone/utils-js.
|
|
8
8
|
* ====================================================
|
package/dist/chunk-7ZNEUWYP.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* ====================================================
|
|
3
3
|
* Rzl Utils-JS.
|
|
4
4
|
* ----------------------------------------------------
|
|
5
|
-
* Version: 3.
|
|
5
|
+
* Version: 3.7.0.
|
|
6
6
|
* Author: Rizalvin Dwiky.
|
|
7
7
|
* Repository: https://github.com/rzl-zone/utils-js.
|
|
8
8
|
* ====================================================
|
package/dist/chunk-A3YI6Y2P.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* ====================================================
|
|
3
3
|
* Rzl Utils-JS.
|
|
4
4
|
* ----------------------------------------------------
|
|
5
|
-
* Version: 3.
|
|
5
|
+
* Version: 3.7.0.
|
|
6
6
|
* Author: Rizalvin Dwiky.
|
|
7
7
|
* Repository: https://github.com/rzl-zone/utils-js.
|
|
8
8
|
* ====================================================
|
package/dist/chunk-ABA2ZSBQ.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* ====================================================
|
|
3
3
|
* Rzl Utils-JS.
|
|
4
4
|
* ----------------------------------------------------
|
|
5
|
-
* Version: 3.
|
|
5
|
+
* Version: 3.7.0.
|
|
6
6
|
* Author: Rizalvin Dwiky.
|
|
7
7
|
* Repository: https://github.com/rzl-zone/utils-js.
|
|
8
8
|
* ====================================================
|
package/dist/chunk-AKKM6MOX.cjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* ====================================================
|
|
3
3
|
* Rzl Utils-JS.
|
|
4
4
|
* ----------------------------------------------------
|
|
5
|
-
* Version: 3.
|
|
5
|
+
* Version: 3.7.0.
|
|
6
6
|
* Author: Rizalvin Dwiky.
|
|
7
7
|
* Repository: https://github.com/rzl-zone/utils-js.
|
|
8
8
|
* ====================================================
|
package/dist/chunk-ATLFMKAF.cjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* ====================================================
|
|
3
3
|
* Rzl Utils-JS.
|
|
4
4
|
* ----------------------------------------------------
|
|
5
|
-
* Version: 3.
|
|
5
|
+
* Version: 3.7.0.
|
|
6
6
|
* Author: Rizalvin Dwiky.
|
|
7
7
|
* Repository: https://github.com/rzl-zone/utils-js.
|
|
8
8
|
* ====================================================
|
package/dist/chunk-B4SDEBN7.cjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* ====================================================
|
|
3
3
|
* Rzl Utils-JS.
|
|
4
4
|
* ----------------------------------------------------
|
|
5
|
-
* Version: 3.
|
|
5
|
+
* Version: 3.7.0.
|
|
6
6
|
* Author: Rizalvin Dwiky.
|
|
7
7
|
* Repository: https://github.com/rzl-zone/utils-js.
|
|
8
8
|
* ====================================================
|
package/dist/chunk-B6UIKBHR.cjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* ====================================================
|
|
3
3
|
* Rzl Utils-JS.
|
|
4
4
|
* ----------------------------------------------------
|
|
5
|
-
* Version: 3.
|
|
5
|
+
* Version: 3.7.0.
|
|
6
6
|
* Author: Rizalvin Dwiky.
|
|
7
7
|
* Repository: https://github.com/rzl-zone/utils-js.
|
|
8
8
|
* ====================================================
|
package/dist/chunk-BAV5T2E3.cjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* ====================================================
|
|
3
3
|
* Rzl Utils-JS.
|
|
4
4
|
* ----------------------------------------------------
|
|
5
|
-
* Version: 3.
|
|
5
|
+
* Version: 3.7.0.
|
|
6
6
|
* Author: Rizalvin Dwiky.
|
|
7
7
|
* Repository: https://github.com/rzl-zone/utils-js.
|
|
8
8
|
* ====================================================
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* ====================================================
|
|
3
|
+
* Rzl Utils-JS.
|
|
4
|
+
* ----------------------------------------------------
|
|
5
|
+
* Version: 3.7.0.
|
|
6
|
+
* Author: Rizalvin Dwiky.
|
|
7
|
+
* Repository: https://github.com/rzl-zone/utils-js.
|
|
8
|
+
* ====================================================
|
|
9
|
+
*/
|
|
10
|
+
'use strict';
|
|
11
|
+
|
|
12
|
+
var chunkVJVCXEH7_cjs = require('./chunk-VJVCXEH7.cjs');
|
|
13
|
+
var chunkLIU4S3JA_cjs = require('./chunk-LIU4S3JA.cjs');
|
|
14
|
+
var chunkNREACG6M_cjs = require('./chunk-NREACG6M.cjs');
|
|
15
|
+
var chunkYC7AK3KX_cjs = require('./chunk-YC7AK3KX.cjs');
|
|
16
|
+
var chunkF3WBQKRI_cjs = require('./chunk-F3WBQKRI.cjs');
|
|
17
|
+
|
|
18
|
+
var NormalizePathnameError = class _NormalizePathnameError extends Error {
|
|
19
|
+
/** * ***The original error that triggered this normalization failure.***
|
|
20
|
+
*
|
|
21
|
+
* **Always available for backward compatibility.**
|
|
22
|
+
*/
|
|
23
|
+
originalError;
|
|
24
|
+
constructor(message, originalError) {
|
|
25
|
+
super(message, chunkF3WBQKRI_cjs.isFunction(Error) ? { cause: originalError } : void 0);
|
|
26
|
+
this.name = "NormalizePathnameError";
|
|
27
|
+
this.originalError = originalError;
|
|
28
|
+
if (chunkF3WBQKRI_cjs.isFunction(Error.captureStackTrace)) {
|
|
29
|
+
Error.captureStackTrace(this, _NormalizePathnameError);
|
|
30
|
+
} else {
|
|
31
|
+
this.stack = new Error(message).stack;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
/** * ***Safe JSON representation for logging or IPC.*** */
|
|
35
|
+
toJSON() {
|
|
36
|
+
return {
|
|
37
|
+
name: this.name,
|
|
38
|
+
message: this.message,
|
|
39
|
+
stack: this.stack,
|
|
40
|
+
originalError: {
|
|
41
|
+
name: this.originalError.name,
|
|
42
|
+
message: this.originalError.message,
|
|
43
|
+
stack: this.originalError.stack
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
function normalizePathname(pathname, options = {
|
|
50
|
+
defaultPath: "/",
|
|
51
|
+
keepNullable: false
|
|
52
|
+
}) {
|
|
53
|
+
chunkF3WBQKRI_cjs.assertIsPlainObject(options, {
|
|
54
|
+
message({ currentType, validType }) {
|
|
55
|
+
return `Second parameter (\`options\`) must be of type \`${validType}\`, but received: \`${currentType}\`.`;
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
const { defaultPath = "/", keepNullable = false, keepTrailingSlash = false } = options;
|
|
59
|
+
if (!chunkF3WBQKRI_cjs.isNonEmptyString(defaultPath)) {
|
|
60
|
+
throw new TypeError(
|
|
61
|
+
`Parameter \`defaultPath\` property of the \`options\` (second parameter) must be of type \`string\` and not empty-string, but received: \`${chunkF3WBQKRI_cjs.getPreciseType(
|
|
62
|
+
defaultPath
|
|
63
|
+
)}\`, with value: \`${chunkYC7AK3KX_cjs.safeStableStringify(defaultPath)}\`.`
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
chunkF3WBQKRI_cjs.assertIsBoolean(keepTrailingSlash, {
|
|
67
|
+
message({ currentType, validType }) {
|
|
68
|
+
return `Parameter \`keepTrailingSlash\` property of the \`options\` (second parameter) must be of type \`${validType}\`, but received: \`${currentType}\`.`;
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
try {
|
|
72
|
+
if (keepNullable && (chunkF3WBQKRI_cjs.isNil(pathname) || !chunkF3WBQKRI_cjs.isString(pathname))) {
|
|
73
|
+
if (chunkF3WBQKRI_cjs.isNull(pathname)) return null;
|
|
74
|
+
return void 0;
|
|
75
|
+
}
|
|
76
|
+
let currentPathName = chunkF3WBQKRI_cjs.isNonEmptyString(pathname) ? pathname : defaultPath;
|
|
77
|
+
currentPathName = chunkLIU4S3JA_cjs.removeSpaces(currentPathName, { trimOnly: true }).replace(
|
|
78
|
+
/\s+/g,
|
|
79
|
+
""
|
|
80
|
+
);
|
|
81
|
+
currentPathName = stripLeadingDomain(currentPathName);
|
|
82
|
+
let _pathName = currentPathName;
|
|
83
|
+
let search = "";
|
|
84
|
+
let hash = "";
|
|
85
|
+
const searchIndex = currentPathName.indexOf("?");
|
|
86
|
+
const hashIndex = currentPathName.indexOf("#");
|
|
87
|
+
if (searchIndex !== -1) {
|
|
88
|
+
search = currentPathName.slice(
|
|
89
|
+
searchIndex,
|
|
90
|
+
hashIndex !== -1 ? hashIndex : void 0
|
|
91
|
+
);
|
|
92
|
+
}
|
|
93
|
+
if (hashIndex !== -1) {
|
|
94
|
+
hash = currentPathName.slice(hashIndex);
|
|
95
|
+
}
|
|
96
|
+
const endIndex = Math.min(
|
|
97
|
+
searchIndex !== -1 ? searchIndex : currentPathName.length,
|
|
98
|
+
hashIndex !== -1 ? hashIndex : currentPathName.length
|
|
99
|
+
);
|
|
100
|
+
_pathName = currentPathName.slice(0, endIndex);
|
|
101
|
+
_pathName = "/" + _pathName.replace(/^\/+/, "").replace(/\/{2,}/g, "/");
|
|
102
|
+
if (!keepTrailingSlash && _pathName !== "/") {
|
|
103
|
+
_pathName = _pathName.replace(/\/+$/, "");
|
|
104
|
+
}
|
|
105
|
+
_pathName = decodeUnicodeSequences(_pathName);
|
|
106
|
+
search = decodeUnicodeSequences(search);
|
|
107
|
+
hash = decodeUnicodeSequences(hash);
|
|
108
|
+
return _pathName + search + hash;
|
|
109
|
+
} catch (error) {
|
|
110
|
+
const err = chunkF3WBQKRI_cjs.isError(error) ? error : new Error("Unknown error from function `normalizePathname()`.");
|
|
111
|
+
throw new NormalizePathnameError(
|
|
112
|
+
`Failed to normalize pathname in function \`normalizePathname()\`: ${err.message}`,
|
|
113
|
+
err
|
|
114
|
+
);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
function decodeUnicodeSequences(str) {
|
|
118
|
+
return str.replace(/(?:%(?:[0-9A-F]{2})){2,}/gi, (match) => {
|
|
119
|
+
try {
|
|
120
|
+
const decoded = decodeURIComponent(match);
|
|
121
|
+
if (/^[\u0000-\u007F]+$/.test(decoded)) return match;
|
|
122
|
+
return decoded;
|
|
123
|
+
} catch {
|
|
124
|
+
return match;
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
function stripLeadingDomain(path) {
|
|
129
|
+
let currentPath = path;
|
|
130
|
+
if (/^https?:\/\//i.test(currentPath)) {
|
|
131
|
+
try {
|
|
132
|
+
const url = new URL(currentPath);
|
|
133
|
+
currentPath = "/" + url.pathname.replace(/^\/+/, "").replace(/\/{2,}/g, "/") + url.search + url.hash;
|
|
134
|
+
} catch {
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
if (currentPath.startsWith("/")) {
|
|
138
|
+
currentPath = currentPath.replace(/\/{2,}/g, "/").slice(1);
|
|
139
|
+
}
|
|
140
|
+
const firstPart = currentPath.split("/")[0];
|
|
141
|
+
const domainPart = firstPart.split(":")[0];
|
|
142
|
+
if (chunkVJVCXEH7_cjs.isValidDomain(domainPart, {
|
|
143
|
+
subdomain: true,
|
|
144
|
+
allowUnicode: true,
|
|
145
|
+
wildcard: true,
|
|
146
|
+
topLevel: false
|
|
147
|
+
}) || domainPart === "localhost") {
|
|
148
|
+
currentPath = currentPath.slice(firstPart.length);
|
|
149
|
+
}
|
|
150
|
+
if (!currentPath.startsWith("/")) currentPath = "/" + currentPath;
|
|
151
|
+
return currentPath;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
var formatEnvPort = (envVar, options = {}) => {
|
|
155
|
+
if (!chunkF3WBQKRI_cjs.isNonEmptyString(envVar)) return "";
|
|
156
|
+
chunkF3WBQKRI_cjs.assertIsPlainObject(options, {
|
|
157
|
+
message: ({ currentType, validType }) => `Second parameter (\`options\`) must be of type \`${validType}\`, but received: \`${currentType}\`.`
|
|
158
|
+
});
|
|
159
|
+
const prefixColon = chunkF3WBQKRI_cjs.hasOwnProp(options, "prefixColon") ? options.prefixColon : false;
|
|
160
|
+
if (!chunkF3WBQKRI_cjs.isBoolean(prefixColon)) {
|
|
161
|
+
throw new TypeError(
|
|
162
|
+
`Parameter \`prefixColon\` property of the \`options\` (second parameter) must be of type \`boolean\`, but received: \`${chunkF3WBQKRI_cjs.getPreciseType(
|
|
163
|
+
prefixColon
|
|
164
|
+
)}\`.`
|
|
165
|
+
);
|
|
166
|
+
}
|
|
167
|
+
const digitsOnly = envVar.replace(/\D+/g, "");
|
|
168
|
+
if (chunkNREACG6M_cjs.isEmptyString(digitsOnly)) return "";
|
|
169
|
+
return prefixColon ? `:${digitsOnly}` : digitsOnly;
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
exports.formatEnvPort = formatEnvPort;
|
|
173
|
+
exports.normalizePathname = normalizePathname;
|
package/dist/chunk-BYUT376O.cjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* ====================================================
|
|
3
3
|
* Rzl Utils-JS.
|
|
4
4
|
* ----------------------------------------------------
|
|
5
|
-
* Version: 3.
|
|
5
|
+
* Version: 3.7.0.
|
|
6
6
|
* Author: Rizalvin Dwiky.
|
|
7
7
|
* Repository: https://github.com/rzl-zone/utils-js.
|
|
8
8
|
* ====================================================
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* ====================================================
|
|
3
3
|
* Rzl Utils-JS.
|
|
4
4
|
* ----------------------------------------------------
|
|
5
|
-
* Version: 3.
|
|
5
|
+
* Version: 3.7.0.
|
|
6
6
|
* Author: Rizalvin Dwiky.
|
|
7
7
|
* Repository: https://github.com/rzl-zone/utils-js.
|
|
8
8
|
* ====================================================
|
package/dist/chunk-D53CE4BT.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* ====================================================
|
|
3
3
|
* Rzl Utils-JS.
|
|
4
4
|
* ----------------------------------------------------
|
|
5
|
-
* Version: 3.
|
|
5
|
+
* Version: 3.7.0.
|
|
6
6
|
* Author: Rizalvin Dwiky.
|
|
7
7
|
* Repository: https://github.com/rzl-zone/utils-js.
|
|
8
8
|
* ====================================================
|
package/dist/chunk-DPLL67OT.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* ====================================================
|
|
3
3
|
* Rzl Utils-JS.
|
|
4
4
|
* ----------------------------------------------------
|
|
5
|
-
* Version: 3.
|
|
5
|
+
* Version: 3.7.0.
|
|
6
6
|
* Author: Rizalvin Dwiky.
|
|
7
7
|
* Repository: https://github.com/rzl-zone/utils-js.
|
|
8
8
|
* ====================================================
|
package/dist/chunk-DVMHRLKP.cjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* ====================================================
|
|
3
3
|
* Rzl Utils-JS.
|
|
4
4
|
* ----------------------------------------------------
|
|
5
|
-
* Version: 3.
|
|
5
|
+
* Version: 3.7.0.
|
|
6
6
|
* Author: Rizalvin Dwiky.
|
|
7
7
|
* Repository: https://github.com/rzl-zone/utils-js.
|
|
8
8
|
* ====================================================
|
package/dist/chunk-EK7FSI7F.cjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* ====================================================
|
|
3
3
|
* Rzl Utils-JS.
|
|
4
4
|
* ----------------------------------------------------
|
|
5
|
-
* Version: 3.
|
|
5
|
+
* Version: 3.7.0.
|
|
6
6
|
* Author: Rizalvin Dwiky.
|
|
7
7
|
* Repository: https://github.com/rzl-zone/utils-js.
|
|
8
8
|
* ====================================================
|
package/dist/chunk-F3WBQKRI.cjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* ====================================================
|
|
3
3
|
* Rzl Utils-JS.
|
|
4
4
|
* ----------------------------------------------------
|
|
5
|
-
* Version: 3.
|
|
5
|
+
* Version: 3.7.0.
|
|
6
6
|
* Author: Rizalvin Dwiky.
|
|
7
7
|
* Repository: https://github.com/rzl-zone/utils-js.
|
|
8
8
|
* ====================================================
|
package/dist/chunk-FI76UZRF.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* ====================================================
|
|
3
3
|
* Rzl Utils-JS.
|
|
4
4
|
* ----------------------------------------------------
|
|
5
|
-
* Version: 3.
|
|
5
|
+
* Version: 3.7.0.
|
|
6
6
|
* Author: Rizalvin Dwiky.
|
|
7
7
|
* Repository: https://github.com/rzl-zone/utils-js.
|
|
8
8
|
* ====================================================
|
package/dist/chunk-GAJBF6DR.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* ====================================================
|
|
3
3
|
* Rzl Utils-JS.
|
|
4
4
|
* ----------------------------------------------------
|
|
5
|
-
* Version: 3.
|
|
5
|
+
* Version: 3.7.0.
|
|
6
6
|
* Author: Rizalvin Dwiky.
|
|
7
7
|
* Repository: https://github.com/rzl-zone/utils-js.
|
|
8
8
|
* ====================================================
|
package/dist/chunk-JY4HLZ4W.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* ====================================================
|
|
3
3
|
* Rzl Utils-JS.
|
|
4
4
|
* ----------------------------------------------------
|
|
5
|
-
* Version: 3.
|
|
5
|
+
* Version: 3.7.0.
|
|
6
6
|
* Author: Rizalvin Dwiky.
|
|
7
7
|
* Repository: https://github.com/rzl-zone/utils-js.
|
|
8
8
|
* ====================================================
|
package/dist/chunk-K3SONK25.cjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* ====================================================
|
|
3
3
|
* Rzl Utils-JS.
|
|
4
4
|
* ----------------------------------------------------
|
|
5
|
-
* Version: 3.
|
|
5
|
+
* Version: 3.7.0.
|
|
6
6
|
* Author: Rizalvin Dwiky.
|
|
7
7
|
* Repository: https://github.com/rzl-zone/utils-js.
|
|
8
8
|
* ====================================================
|
package/dist/chunk-K63WO3XA.cjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* ====================================================
|
|
3
3
|
* Rzl Utils-JS.
|
|
4
4
|
* ----------------------------------------------------
|
|
5
|
-
* Version: 3.
|
|
5
|
+
* Version: 3.7.0.
|
|
6
6
|
* Author: Rizalvin Dwiky.
|
|
7
7
|
* Repository: https://github.com/rzl-zone/utils-js.
|
|
8
8
|
* ====================================================
|
package/dist/chunk-KHO2SBNA.cjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* ====================================================
|
|
3
3
|
* Rzl Utils-JS.
|
|
4
4
|
* ----------------------------------------------------
|
|
5
|
-
* Version: 3.
|
|
5
|
+
* Version: 3.7.0.
|
|
6
6
|
* Author: Rizalvin Dwiky.
|
|
7
7
|
* Repository: https://github.com/rzl-zone/utils-js.
|
|
8
8
|
* ====================================================
|