@rzl-zone/utils-js 3.7.1 → 3.9.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 +28 -1
- package/dist/assertions/index.cjs +11 -11
- package/dist/assertions/index.d.ts +169 -58
- package/dist/assertions/index.js +5 -5
- package/dist/{chunk-EK7FSI7F.cjs → chunk-2XGQQZ6A.cjs} +3 -3
- package/dist/{chunk-YS27V6LS.js → chunk-3LE6NX57.js} +5 -176
- package/dist/{chunk-PZQC3FZY.js → chunk-44X74C26.js} +4 -4
- package/dist/{chunk-4ACKNPL5.js → chunk-5KDVIEVO.js} +2 -2
- package/dist/{chunk-JY4HLZ4W.js → chunk-5O66AUEC.js} +2 -2
- package/dist/chunk-5Y6JL47L.js +302 -0
- package/dist/{chunk-KIYALQQF.cjs → chunk-62FS7WMB.cjs} +35 -35
- package/dist/{chunk-VJVCXEH7.cjs → chunk-6AMDHVS2.cjs} +9 -181
- package/dist/{chunk-6PKW4WCT.js → chunk-6WVOUVWD.js} +27 -15
- package/dist/{chunk-BYUT376O.cjs → chunk-76ATVDCR.cjs} +3 -3
- package/dist/{chunk-F3WBQKRI.cjs → chunk-7C7TQC5J.cjs} +29 -7
- package/dist/{chunk-QUITZ3GP.js → chunk-7EIFPHV3.js} +32 -16
- package/dist/{chunk-6RFNZ2ZZ.cjs → chunk-7NXFGJJE.cjs} +14 -14
- package/dist/{chunk-TFDXRT6D.cjs → chunk-ALRISPTL.cjs} +3 -3
- package/dist/chunk-BAV5T2E3.cjs +1 -1
- package/dist/{chunk-4ZOXSUXB.js → chunk-C7GC2PFX.js} +3 -3
- package/dist/chunk-DVMHRLKP.cjs +1 -1
- package/dist/{chunk-XFTUHS4Y.js → chunk-DXPM4NOU.js} +10 -8
- package/dist/{chunk-DPLL67OT.js → chunk-EJV5AF4L.js} +2 -2
- package/dist/{chunk-NREACG6M.cjs → chunk-FWWPEL7J.cjs} +3 -3
- package/dist/{chunk-LEX4TQW2.js → chunk-GHU356XQ.js} +4 -6
- package/dist/chunk-GKDSBOYE.js +209 -0
- package/dist/{chunk-YC7AK3KX.cjs → chunk-H44QVAZL.cjs} +31 -31
- package/dist/{chunk-AKKM6MOX.cjs → chunk-I33PB44Q.cjs} +15 -15
- package/dist/{chunk-LIU4S3JA.cjs → chunk-IX6PF5ZP.cjs} +4 -4
- package/dist/{chunk-3KTD3QDI.js → chunk-J4TT33ZX.js} +29 -7
- package/dist/{chunk-SZJ7OI4S.js → chunk-J6VLFVIL.js} +3 -3
- package/dist/{chunk-KTQLDIIT.cjs → chunk-JI57K7D4.cjs} +173 -163
- package/dist/{chunk-OFBFGFVH.js → chunk-JYOCB6OV.js} +2 -2
- package/dist/chunk-KHO2SBNA.cjs +1 -1
- package/dist/{chunk-66WLOZOD.cjs → chunk-KUVRZ2JW.cjs} +53 -51
- package/dist/chunk-L5RDAVVH.js +1 -1
- package/dist/{chunk-VCVND6CH.js → chunk-M5QB2GM5.js} +2 -2
- package/dist/{chunk-3LEWQV3R.js → chunk-MBFVTGYS.js} +8 -8
- package/dist/{chunk-UKAUXY2U.cjs → chunk-MMRHKYT6.cjs} +12 -12
- package/dist/{chunk-U5VR4TJN.js → chunk-MS2KSKD7.js} +9 -9
- package/dist/{chunk-7ZNEUWYP.js → chunk-MZ3T6L7Z.js} +2 -2
- package/dist/{chunk-ATLFMKAF.cjs → chunk-NAOVH4OH.cjs} +7 -7
- package/dist/chunk-NJ24M6ZH.cjs +308 -0
- package/dist/chunk-OCTHWEZK.cjs +249 -0
- package/dist/chunk-ONZFBJVW.js +1 -1
- package/dist/{chunk-FI76UZRF.js → chunk-OSSFLQDD.js} +3 -4
- package/dist/{chunk-7WBMA2VE.cjs → chunk-OYFUBKEG.cjs} +4 -5
- package/dist/{chunk-B4SDEBN7.cjs → chunk-PWKOFPAH.cjs} +3 -3
- package/dist/{chunk-2CQI36UD.cjs → chunk-QGTFQ7RO.cjs} +8 -6
- package/dist/chunk-QNKGP5DY.js +1 -1
- package/dist/chunk-QXTJVDWE.js +676 -0
- package/dist/{chunk-B6UIKBHR.cjs → chunk-QZI5PVCI.cjs} +4 -4
- package/dist/{chunk-WNO3EPYT.js → chunk-R2DR7SPJ.js} +102 -26
- package/dist/{chunk-TDYGYHSH.js → chunk-SN5HAK3Y.js} +4 -4
- package/dist/{chunk-D53CE4BT.js → chunk-SRWL4YCP.js} +11 -8
- package/dist/{chunk-7QQV66RX.cjs → chunk-TJ5OY6MC.cjs} +10 -10
- package/dist/{chunk-6WMB5AJR.js → chunk-TXOVQZPU.js} +3 -4
- package/dist/chunk-UDA26MCU.cjs +1 -1
- package/dist/{chunk-R3PBF6F7.cjs → chunk-UFYMRRJH.cjs} +73 -61
- package/dist/{chunk-5NN4ZDE2.cjs → chunk-UV5BKAYW.cjs} +6 -8
- package/dist/{chunk-GAJBF6DR.js → chunk-UXT4XSUK.js} +2 -2
- package/dist/{chunk-TDPYR5JY.js → chunk-VBSLIIDB.js} +24 -14
- package/dist/chunk-VCYXNIZ2.cjs +678 -0
- package/dist/chunk-VJDDGRIK.cjs +1 -1
- package/dist/{chunk-VNADVWSJ.js → chunk-WB3FT62A.js} +6 -4
- package/dist/{chunk-K63WO3XA.cjs → chunk-WKM6UVMG.cjs} +4 -5
- package/dist/{chunk-OS5OT5JA.cjs → chunk-WLEZ2KSG.cjs} +142 -126
- package/dist/{chunk-ZN53RM3R.js → chunk-WRGN6UBK.js} +2 -2
- package/dist/chunk-WVSPXFTY.js +1 -1
- package/dist/{chunk-2VO2CBTU.js → chunk-X6ULJZ3X.js} +2 -2
- package/dist/{chunk-CKUEZF4R.cjs → chunk-XYWC4EQ3.cjs} +71 -71
- package/dist/{chunk-A3YI6Y2P.js → chunk-YHFRCVTN.js} +3 -3
- package/dist/{chunk-RMJC3B5P.cjs → chunk-YQHJB7KR.cjs} +30 -27
- package/dist/{chunk-YGB2BQPB.cjs → chunk-YVRUY4EW.cjs} +8 -8
- package/dist/chunk-YWHHVDT4.js +1 -1
- package/dist/chunk-ZTHJQJ5F.cjs +211 -0
- package/dist/conversions/index.cjs +34 -34
- package/dist/conversions/index.d.ts +10 -12
- package/dist/conversions/index.js +15 -15
- package/dist/events/index.cjs +8 -8
- package/dist/events/index.d.ts +9 -9
- package/dist/events/index.js +4 -4
- package/dist/formatters/index.cjs +19 -19
- package/dist/formatters/index.d.ts +19 -24
- package/dist/formatters/index.js +9 -9
- package/dist/generators/index.cjs +12 -8
- package/dist/generators/index.d.ts +155 -26
- package/dist/generators/index.js +4 -4
- package/dist/index.d.ts +1 -1
- package/dist/{isPlainObject-FWmcJF6k.d.ts → isPlainObject-BTPjv6zB.d.ts} +2 -2
- package/dist/next/index.cjs +39 -36
- package/dist/next/index.d.ts +11 -11
- package/dist/next/index.js +12 -9
- package/dist/next/server/index.cjs +4 -4
- package/dist/next/server/index.d.ts +4 -4
- package/dist/next/server/index.js +2 -2
- package/dist/operations/index.cjs +11 -11
- package/dist/operations/index.d.ts +8 -9
- package/dist/operations/index.js +8 -8
- package/dist/parsers/index.cjs +6 -4
- package/dist/parsers/index.d.ts +224 -32
- package/dist/parsers/index.js +5 -3
- package/dist/predicates/index.cjs +77 -76
- package/dist/predicates/index.d.ts +15 -28
- package/dist/predicates/index.js +14 -13
- package/dist/promises/index.cjs +6 -6
- package/dist/promises/index.d.ts +5 -7
- 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 +1 -1
- package/dist/strings/index.js +7 -7
- package/dist/tailwind/index.cjs +13 -13
- package/dist/tailwind/index.d.ts +18 -18
- package/dist/tailwind/index.js +5 -5
- package/dist/urls/index.cjs +23 -21
- package/dist/urls/index.d.ts +188 -121
- package/dist/urls/index.js +16 -14
- package/package.json +1 -1
- package/dist/chunk-ABA2ZSBQ.js +0 -152
- package/dist/chunk-BG3AS5BU.cjs +0 -173
- package/dist/chunk-K3SONK25.cjs +0 -157
- package/dist/chunk-KPCDDYTZ.js +0 -417
- package/dist/chunk-QAPYHLHC.cjs +0 -419
|
@@ -2,28 +2,28 @@
|
|
|
2
2
|
* ====================================================
|
|
3
3
|
* Rzl Utils-JS.
|
|
4
4
|
* ----------------------------------------------------
|
|
5
|
-
* Version: 3.
|
|
5
|
+
* Version: 3.9.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
|
|
12
|
+
var chunkFWWPEL7J_cjs = require('./chunk-FWWPEL7J.cjs');
|
|
13
|
+
var chunkOYFUBKEG_cjs = require('./chunk-OYFUBKEG.cjs');
|
|
14
|
+
var chunk7C7TQC5J_cjs = require('./chunk-7C7TQC5J.cjs');
|
|
15
15
|
var tailwindMergeV3 = require('tailwind-merge-v3');
|
|
16
16
|
var tailwindMergeV4 = require('tailwind-merge-v4');
|
|
17
17
|
|
|
18
18
|
function toStringValue(value) {
|
|
19
19
|
let str = "";
|
|
20
|
-
if (
|
|
20
|
+
if (chunk7C7TQC5J_cjs.isNonEmptyString(value) || chunk7C7TQC5J_cjs.isNumber(value)) {
|
|
21
21
|
str += value;
|
|
22
|
-
} else if (
|
|
23
|
-
if (
|
|
22
|
+
} else if (chunk7C7TQC5J_cjs.isObjectOrArray(value)) {
|
|
23
|
+
if (chunk7C7TQC5J_cjs.isStringObject(value) || chunk7C7TQC5J_cjs.isNumberObject(value) || chunk7C7TQC5J_cjs.isBooleanObject(value)) {
|
|
24
24
|
const val = value.valueOf();
|
|
25
25
|
if (val) str += val;
|
|
26
|
-
} else if (
|
|
26
|
+
} else if (chunk7C7TQC5J_cjs.isArray(value)) {
|
|
27
27
|
for (const item of value) {
|
|
28
28
|
if (!item) continue;
|
|
29
29
|
const y = toStringValue(item);
|
|
@@ -41,11 +41,11 @@ function toStringValue(value) {
|
|
|
41
41
|
}
|
|
42
42
|
return str;
|
|
43
43
|
}
|
|
44
|
-
function cx(...
|
|
44
|
+
function cx(...values) {
|
|
45
45
|
let str = "";
|
|
46
|
-
for (const
|
|
47
|
-
if (!
|
|
48
|
-
const x = toStringValue(
|
|
46
|
+
for (const value of values) {
|
|
47
|
+
if (!value) continue;
|
|
48
|
+
const x = toStringValue(value);
|
|
49
49
|
if (!x) continue;
|
|
50
50
|
if (str) str += " ";
|
|
51
51
|
str += x;
|
|
@@ -54,22 +54,22 @@ function cx(...args) {
|
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
var validatorPropsTwMerge = (options) => {
|
|
57
|
-
if (!
|
|
57
|
+
if (!chunk7C7TQC5J_cjs.isPlainObject(options)) options = {};
|
|
58
58
|
let { config, prefix, extend, override, cacheSize, experimentalParseClassName } = options;
|
|
59
|
-
if (!
|
|
60
|
-
if (!
|
|
61
|
-
if (!
|
|
62
|
-
if (!
|
|
63
|
-
if (!
|
|
64
|
-
if (!
|
|
65
|
-
const theme =
|
|
66
|
-
const classGroups =
|
|
67
|
-
const conflictingClassGroupModifiers =
|
|
59
|
+
if (!chunk7C7TQC5J_cjs.isPlainObject(config)) config = {};
|
|
60
|
+
if (!chunk7C7TQC5J_cjs.isPlainObject(extend)) extend = {};
|
|
61
|
+
if (!chunk7C7TQC5J_cjs.isPlainObject(override)) override = {};
|
|
62
|
+
if (!chunk7C7TQC5J_cjs.isNumber(cacheSize)) cacheSize = void 0;
|
|
63
|
+
if (!chunk7C7TQC5J_cjs.isNonEmptyString(prefix)) prefix = void 0;
|
|
64
|
+
if (!chunk7C7TQC5J_cjs.isFunction(experimentalParseClassName)) experimentalParseClassName = void 0;
|
|
65
|
+
const theme = chunk7C7TQC5J_cjs.hasOwnProp(extend, "theme") ? extend.theme : {};
|
|
66
|
+
const classGroups = chunk7C7TQC5J_cjs.hasOwnProp(extend, "classGroups") ? extend.classGroups : {};
|
|
67
|
+
const conflictingClassGroupModifiers = chunk7C7TQC5J_cjs.hasOwnProp(
|
|
68
68
|
extend,
|
|
69
69
|
"conflictingClassGroupModifiers"
|
|
70
70
|
) ? extend.conflictingClassGroupModifiers : {};
|
|
71
|
-
const conflictingClassGroups =
|
|
72
|
-
const orderSensitiveModifiers =
|
|
71
|
+
const conflictingClassGroups = chunk7C7TQC5J_cjs.hasOwnProp(extend, "conflictingClassGroups") ? extend.conflictingClassGroups : {};
|
|
72
|
+
const orderSensitiveModifiers = chunk7C7TQC5J_cjs.hasOwnProp(extend, "orderSensitiveModifiers") && chunk7C7TQC5J_cjs.isNonEmptyArray(extend.orderSensitiveModifiers) ? extend.orderSensitiveModifiers : [];
|
|
73
73
|
return {
|
|
74
74
|
config,
|
|
75
75
|
override,
|
|
@@ -86,7 +86,7 @@ var validatorPropsTwMerge = (options) => {
|
|
|
86
86
|
|
|
87
87
|
var defaultConfig = tailwindMergeV3.getDefaultConfig();
|
|
88
88
|
var twMergeDefaultV3 = (options = {}) => {
|
|
89
|
-
if (!
|
|
89
|
+
if (!chunk7C7TQC5J_cjs.isPlainObject(options)) options = {};
|
|
90
90
|
const {
|
|
91
91
|
cacheSize,
|
|
92
92
|
classGroups,
|
|
@@ -129,7 +129,7 @@ var twMergeDefaultV3 = (options = {}) => {
|
|
|
129
129
|
};
|
|
130
130
|
var defaultConfig2 = tailwindMergeV4.getDefaultConfig();
|
|
131
131
|
var twMergeDefaultV4 = (options = {}) => {
|
|
132
|
-
if (!
|
|
132
|
+
if (!chunk7C7TQC5J_cjs.isPlainObject(options)) options = {};
|
|
133
133
|
const {
|
|
134
134
|
cacheSize,
|
|
135
135
|
classGroups,
|
|
@@ -186,9 +186,9 @@ var cnV4 = (...classes) => {
|
|
|
186
186
|
};
|
|
187
187
|
|
|
188
188
|
var customCnV3 = (customTwMergeV3, ...classes) => {
|
|
189
|
-
if (!
|
|
189
|
+
if (!chunk7C7TQC5J_cjs.isFunction(customTwMergeV3)) {
|
|
190
190
|
throw new TypeError(
|
|
191
|
-
`first Parameter (\`customTwMergeV3\`) must be of type \`function\`, but received: \`${
|
|
191
|
+
`first Parameter (\`customTwMergeV3\`) must be of type \`function\`, but received: \`${chunk7C7TQC5J_cjs.getPreciseType(
|
|
192
192
|
customTwMergeV3
|
|
193
193
|
)}\`.`
|
|
194
194
|
);
|
|
@@ -196,9 +196,9 @@ var customCnV3 = (customTwMergeV3, ...classes) => {
|
|
|
196
196
|
return customTwMergeV3(cx(...classes));
|
|
197
197
|
};
|
|
198
198
|
var customCnV4 = (customTwMergeV4, ...classes) => {
|
|
199
|
-
if (!
|
|
199
|
+
if (!chunk7C7TQC5J_cjs.isFunction(customTwMergeV4)) {
|
|
200
200
|
throw new TypeError(
|
|
201
|
-
`first Parameter (\`customTwMergeV4\`) must be of type \`function\`, but received: \`${
|
|
201
|
+
`first Parameter (\`customTwMergeV4\`) must be of type \`function\`, but received: \`${chunk7C7TQC5J_cjs.getPreciseType(
|
|
202
202
|
customTwMergeV4
|
|
203
203
|
)}\`.`
|
|
204
204
|
);
|
|
@@ -207,26 +207,26 @@ var customCnV4 = (customTwMergeV4, ...classes) => {
|
|
|
207
207
|
};
|
|
208
208
|
|
|
209
209
|
var shouldForwardProp = (props) => {
|
|
210
|
-
|
|
210
|
+
chunkOYFUBKEG_cjs.assertIsArray(props, {
|
|
211
211
|
message: ({ currentType, validType }) => `First parameter (\`props\`) must be of type \`${validType}\`, but received: \`${currentType}\`.`
|
|
212
212
|
});
|
|
213
213
|
const invalidItems = [];
|
|
214
214
|
props.forEach((p, idx) => {
|
|
215
|
-
if (!
|
|
215
|
+
if (!chunk7C7TQC5J_cjs.isString(p)) {
|
|
216
216
|
invalidItems.push({
|
|
217
217
|
index: idx,
|
|
218
|
-
reason: `Expected a non-empty string, but received ${
|
|
218
|
+
reason: `Expected a non-empty string, but received ${chunk7C7TQC5J_cjs.getPreciseType(p, {
|
|
219
219
|
formatCase: "toPascalCaseSpace"
|
|
220
220
|
})}.`
|
|
221
221
|
});
|
|
222
|
-
} else if (
|
|
222
|
+
} else if (chunkFWWPEL7J_cjs.isEmptyString(p)) {
|
|
223
223
|
invalidItems.push({
|
|
224
224
|
index: idx,
|
|
225
225
|
reason: `Expected a non-empty string, but received EmptyString.`
|
|
226
226
|
});
|
|
227
227
|
}
|
|
228
228
|
});
|
|
229
|
-
if (
|
|
229
|
+
if (chunk7C7TQC5J_cjs.isNonEmptyArray(invalidItems)) {
|
|
230
230
|
const maxWidth = Math.max(...invalidItems.map((item) => String(item.index).length));
|
|
231
231
|
const details = invalidItems.map(
|
|
232
232
|
(item) => `\u2022 [Index ${String(item.index).padStart(maxWidth, "0")}] ${item.reason}`
|
|
@@ -2,187 +2,16 @@
|
|
|
2
2
|
* ====================================================
|
|
3
3
|
* Rzl Utils-JS.
|
|
4
4
|
* ----------------------------------------------------
|
|
5
|
-
* Version: 3.
|
|
5
|
+
* Version: 3.9.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
|
-
|
|
15
|
-
var maxInt = 2147483647;
|
|
16
|
-
var base = 36;
|
|
17
|
-
var tMin = 1;
|
|
18
|
-
var tMax = 26;
|
|
19
|
-
var skew = 38;
|
|
20
|
-
var damp = 700;
|
|
21
|
-
var initialBias = 72;
|
|
22
|
-
var initialN = 128;
|
|
23
|
-
var delimiter = "-";
|
|
24
|
-
var regexPunycode = /^xn--/;
|
|
25
|
-
var regexNonASCII = /[^\0-\x7F]/;
|
|
26
|
-
var regexSeparators = /[\x2E\u3002\uFF0E\uFF61]/g;
|
|
27
|
-
var errors = {
|
|
28
|
-
overflow: "Overflow: input needs wider integers to process",
|
|
29
|
-
"not-basic": "Illegal input >= 0x80 (not a basic code point)",
|
|
30
|
-
"invalid-input": "Invalid input"
|
|
31
|
-
};
|
|
32
|
-
var floor = Math.floor;
|
|
33
|
-
var stringFromCharCode = String.fromCharCode;
|
|
34
|
-
function error(type) {
|
|
35
|
-
throw new RangeError(errors[type]);
|
|
36
|
-
}
|
|
37
|
-
function map(array, fn) {
|
|
38
|
-
const result = [];
|
|
39
|
-
let length = array.length;
|
|
40
|
-
while (length--) result[length] = fn(array[length]);
|
|
41
|
-
return result;
|
|
42
|
-
}
|
|
43
|
-
function mapDomain(domain, fn) {
|
|
44
|
-
const parts = domain.split("@");
|
|
45
|
-
let result = "";
|
|
46
|
-
if (parts.length > 1) {
|
|
47
|
-
result = parts[0] + "@";
|
|
48
|
-
domain = parts[1];
|
|
49
|
-
}
|
|
50
|
-
domain = domain.replace(regexSeparators, ".");
|
|
51
|
-
const labels = domain.split(".");
|
|
52
|
-
return result + map(labels, fn).join(".");
|
|
53
|
-
}
|
|
54
|
-
function ucs2decode(input) {
|
|
55
|
-
const output = [];
|
|
56
|
-
let counter = 0;
|
|
57
|
-
const length = input.length;
|
|
58
|
-
while (counter < length) {
|
|
59
|
-
const value = input.charCodeAt(counter++);
|
|
60
|
-
if (value >= 55296 && value <= 56319 && counter < length) {
|
|
61
|
-
const extra = input.charCodeAt(counter++);
|
|
62
|
-
if ((extra & 64512) === 56320)
|
|
63
|
-
output.push(((value & 1023) << 10) + (extra & 1023) + 65536);
|
|
64
|
-
else {
|
|
65
|
-
output.push(value);
|
|
66
|
-
counter--;
|
|
67
|
-
}
|
|
68
|
-
} else output.push(value);
|
|
69
|
-
}
|
|
70
|
-
return output;
|
|
71
|
-
}
|
|
72
|
-
var ucs2encode = (points) => String.fromCodePoint(...points);
|
|
73
|
-
function basicToDigit(codePoint) {
|
|
74
|
-
if (codePoint >= 48 && codePoint < 58) return 26 + (codePoint - 48);
|
|
75
|
-
if (codePoint >= 65 && codePoint < 91) return codePoint - 65;
|
|
76
|
-
if (codePoint >= 97 && codePoint < 123) return codePoint - 97;
|
|
77
|
-
return base;
|
|
78
|
-
}
|
|
79
|
-
function digitToBasic(digit, flag) {
|
|
80
|
-
return digit + 22 + 75 * (digit < 26 ? 1 : 0) - Number(flag !== 0) * 32;
|
|
81
|
-
}
|
|
82
|
-
function adapt(delta, numPoints, firstTime) {
|
|
83
|
-
let k = 0;
|
|
84
|
-
delta = firstTime ? floor(delta / damp) : delta >> 1;
|
|
85
|
-
delta += floor(delta / numPoints);
|
|
86
|
-
while (delta > (base - tMin) * tMax >> 1) {
|
|
87
|
-
delta = floor(delta / (base - tMin));
|
|
88
|
-
k += base;
|
|
89
|
-
}
|
|
90
|
-
return floor(k + (base - tMin + 1) * delta / (delta + skew));
|
|
91
|
-
}
|
|
92
|
-
function decode(input) {
|
|
93
|
-
const output = [];
|
|
94
|
-
const inputLength = input.length;
|
|
95
|
-
let i = 0, n = initialN, bias = initialBias;
|
|
96
|
-
let basic = input.lastIndexOf(delimiter);
|
|
97
|
-
if (basic < 0) basic = 0;
|
|
98
|
-
for (let j = 0; j < basic; j++) {
|
|
99
|
-
if (input.charCodeAt(j) >= 128) error("not-basic");
|
|
100
|
-
output.push(input.charCodeAt(j));
|
|
101
|
-
}
|
|
102
|
-
for (let index = basic > 0 ? basic + 1 : 0; index < inputLength; ) {
|
|
103
|
-
const oldi = i;
|
|
104
|
-
let w = 1;
|
|
105
|
-
for (let k = base; ; k += base) {
|
|
106
|
-
if (index >= inputLength) error("invalid-input");
|
|
107
|
-
const digit = basicToDigit(input.charCodeAt(index++));
|
|
108
|
-
if (digit >= base) error("invalid-input");
|
|
109
|
-
if (digit > floor((maxInt - i) / w)) error("overflow");
|
|
110
|
-
i += digit * w;
|
|
111
|
-
const t = k <= bias ? tMin : k >= bias + tMax ? tMax : k - bias;
|
|
112
|
-
if (digit < t) break;
|
|
113
|
-
const baseMinusT = base - t;
|
|
114
|
-
if (w > floor(maxInt / baseMinusT)) error("overflow");
|
|
115
|
-
w *= baseMinusT;
|
|
116
|
-
}
|
|
117
|
-
const out = output.length + 1;
|
|
118
|
-
bias = adapt(i - oldi, out, oldi === 0);
|
|
119
|
-
if (floor(i / out) > maxInt - n) error("overflow");
|
|
120
|
-
n += floor(i / out);
|
|
121
|
-
i %= out;
|
|
122
|
-
output.splice(i++, 0, n);
|
|
123
|
-
}
|
|
124
|
-
return String.fromCodePoint(...output);
|
|
125
|
-
}
|
|
126
|
-
function encode(input) {
|
|
127
|
-
const output = [];
|
|
128
|
-
const points = ucs2decode(input);
|
|
129
|
-
const inputLength = points.length;
|
|
130
|
-
let n = initialN, delta = 0, bias = initialBias;
|
|
131
|
-
for (const cp of points) if (cp < 128) output.push(stringFromCharCode(cp));
|
|
132
|
-
const basicLength = output.length;
|
|
133
|
-
let handledCPCount = basicLength;
|
|
134
|
-
if (basicLength) output.push(delimiter);
|
|
135
|
-
while (handledCPCount < inputLength) {
|
|
136
|
-
let m = maxInt;
|
|
137
|
-
for (const cp of points) if (cp >= n && cp < m) m = cp;
|
|
138
|
-
const handledCPCountPlusOne = handledCPCount + 1;
|
|
139
|
-
if (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) error("overflow");
|
|
140
|
-
delta += (m - n) * handledCPCountPlusOne;
|
|
141
|
-
n = m;
|
|
142
|
-
for (const cp of points) {
|
|
143
|
-
if (cp < n) delta++;
|
|
144
|
-
if (cp === n) {
|
|
145
|
-
let q = delta;
|
|
146
|
-
for (let k = base; ; k += base) {
|
|
147
|
-
const t = k <= bias ? tMin : k >= bias + tMax ? tMax : k - bias;
|
|
148
|
-
if (q < t) break;
|
|
149
|
-
output.push(stringFromCharCode(digitToBasic(t + (q - t) % (base - t), 0)));
|
|
150
|
-
q = floor((q - t) / (base - t));
|
|
151
|
-
}
|
|
152
|
-
output.push(stringFromCharCode(digitToBasic(q, 0)));
|
|
153
|
-
bias = adapt(delta, handledCPCountPlusOne, handledCPCount === basicLength);
|
|
154
|
-
delta = 0;
|
|
155
|
-
handledCPCount++;
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
delta++;
|
|
159
|
-
n++;
|
|
160
|
-
}
|
|
161
|
-
return output.join("");
|
|
162
|
-
}
|
|
163
|
-
function toUnicode(input) {
|
|
164
|
-
return mapDomain(
|
|
165
|
-
input,
|
|
166
|
-
(str) => regexPunycode.test(str) ? decode(str.slice(4).toLowerCase()) : str
|
|
167
|
-
);
|
|
168
|
-
}
|
|
169
|
-
function toASCII(input) {
|
|
170
|
-
return mapDomain(
|
|
171
|
-
input,
|
|
172
|
-
(str) => regexNonASCII.test(str) ? "xn--" + encode(str) : str
|
|
173
|
-
);
|
|
174
|
-
}
|
|
175
|
-
var punycodeUtilsJS = {
|
|
176
|
-
version: "1.0.0",
|
|
177
|
-
ucs2: {
|
|
178
|
-
decode: ucs2decode,
|
|
179
|
-
encode: ucs2encode
|
|
180
|
-
},
|
|
181
|
-
decode,
|
|
182
|
-
encode,
|
|
183
|
-
toASCII,
|
|
184
|
-
toUnicode
|
|
185
|
-
};
|
|
12
|
+
var chunkZTHJQJ5F_cjs = require('./chunk-ZTHJQJ5F.cjs');
|
|
13
|
+
var chunkH44QVAZL_cjs = require('./chunk-H44QVAZL.cjs');
|
|
14
|
+
var chunk7C7TQC5J_cjs = require('./chunk-7C7TQC5J.cjs');
|
|
186
15
|
|
|
187
16
|
var sldMap_default = {
|
|
188
17
|
"com.ac": true,
|
|
@@ -1881,8 +1710,8 @@ var ccTldMap_default = {
|
|
|
1881
1710
|
};
|
|
1882
1711
|
|
|
1883
1712
|
function isValidDomain(value, options = {}) {
|
|
1884
|
-
if (!
|
|
1885
|
-
|
|
1713
|
+
if (!chunk7C7TQC5J_cjs.isString(value)) return false;
|
|
1714
|
+
chunk7C7TQC5J_cjs.assertIsPlainObject(options, {
|
|
1886
1715
|
message: ({ currentType, validType }) => `Second parameter (\`options\`) must be of type \`${validType}\`, but received: \`${currentType}\`.`
|
|
1887
1716
|
});
|
|
1888
1717
|
const {
|
|
@@ -1902,12 +1731,12 @@ function isValidDomain(value, options = {}) {
|
|
|
1902
1731
|
allowProtocol,
|
|
1903
1732
|
allowPort,
|
|
1904
1733
|
allowLocalhost
|
|
1905
|
-
}).filter(([, value2]) => !
|
|
1734
|
+
}).filter(([, value2]) => !chunk7C7TQC5J_cjs.isBoolean(value2));
|
|
1906
1735
|
if (invalid.length) {
|
|
1907
1736
|
const msg = invalid.map(
|
|
1908
1737
|
([key, value2], i) => ` ${i + 1}. option: "${key}"
|
|
1909
1738
|
expected: boolean
|
|
1910
|
-
received: ${
|
|
1739
|
+
received: ${chunk7C7TQC5J_cjs.getPreciseType(value2)} (${chunkH44QVAZL_cjs.safeStableStringify(value2, {
|
|
1911
1740
|
keepUndefined: true
|
|
1912
1741
|
})})`
|
|
1913
1742
|
).join("\n");
|
|
@@ -1945,7 +1774,7 @@ ${msg}`
|
|
|
1945
1774
|
if (allowLocalhost && _value === "localhost") return true;
|
|
1946
1775
|
if (allowUnicode) {
|
|
1947
1776
|
try {
|
|
1948
|
-
_value = punycodeUtilsJS.toASCII(_value);
|
|
1777
|
+
_value = chunkZTHJQJ5F_cjs.punycodeUtilsJS.toASCII(_value);
|
|
1949
1778
|
} catch {
|
|
1950
1779
|
return false;
|
|
1951
1780
|
}
|
|
@@ -1994,4 +1823,3 @@ ${msg}`
|
|
|
1994
1823
|
}
|
|
1995
1824
|
|
|
1996
1825
|
exports.isValidDomain = isValidDomain;
|
|
1997
|
-
exports.punycodeUtilsJS = punycodeUtilsJS;
|
|
@@ -2,21 +2,21 @@
|
|
|
2
2
|
* ====================================================
|
|
3
3
|
* Rzl Utils-JS.
|
|
4
4
|
* ----------------------------------------------------
|
|
5
|
-
* Version: 3.
|
|
5
|
+
* Version: 3.9.0.
|
|
6
6
|
* Author: Rizalvin Dwiky.
|
|
7
7
|
* Repository: https://github.com/rzl-zone/utils-js.
|
|
8
8
|
* ====================================================
|
|
9
9
|
*/
|
|
10
10
|
import { isURL } from './chunk-ONZFBJVW.js';
|
|
11
|
-
import { normalizeString } from './chunk-
|
|
12
|
-
import { toStringArrayUnRecursive } from './chunk-
|
|
13
|
-
import { isEmptyValue } from './chunk-
|
|
11
|
+
import { normalizeString } from './chunk-UXT4XSUK.js';
|
|
12
|
+
import { toStringArrayUnRecursive } from './chunk-SN5HAK3Y.js';
|
|
13
|
+
import { isEmptyValue } from './chunk-44X74C26.js';
|
|
14
14
|
import { isInteger } from './chunk-WVSPXFTY.js';
|
|
15
|
-
import { normalizePathname } from './chunk-
|
|
16
|
-
import { isEmptyString } from './chunk-
|
|
17
|
-
import { assertIsArray } from './chunk-
|
|
18
|
-
import { safeStableStringify } from './chunk-
|
|
19
|
-
import { isString, getPreciseType, isUndefined, isNonEmptyString, isFunction, isNumber, isError, isArray, isNil, isNull, isPlainObject, isBoolean, isNonEmptyArray } from './chunk-
|
|
15
|
+
import { normalizePathname } from './chunk-R2DR7SPJ.js';
|
|
16
|
+
import { isEmptyString } from './chunk-5O66AUEC.js';
|
|
17
|
+
import { assertIsArray } from './chunk-TXOVQZPU.js';
|
|
18
|
+
import { safeStableStringify } from './chunk-X6ULJZ3X.js';
|
|
19
|
+
import { isString, getPreciseType, isUndefined, isNonEmptyString, isFunction, isNumber, isError, isArray, isNil, isNull, isPlainObject, isBoolean, isNonEmptyArray } from './chunk-J4TT33ZX.js';
|
|
20
20
|
|
|
21
21
|
var constructURL = (baseUrl, queryParams, removeParams) => {
|
|
22
22
|
if (isString(baseUrl)) {
|
|
@@ -28,7 +28,9 @@ var constructURL = (baseUrl, queryParams, removeParams) => {
|
|
|
28
28
|
throw new TypeError(
|
|
29
29
|
`First parameter (\`baseUrl\`) must be of type an URL instance or a \`string\` and a non empty-string, but received: \`${getPreciseType(
|
|
30
30
|
baseUrl
|
|
31
|
-
)}\`, with current value: \`${safeStableStringify(baseUrl
|
|
31
|
+
)}\`, with current value: \`${safeStableStringify(baseUrl, {
|
|
32
|
+
keepUndefined: true
|
|
33
|
+
})}\`.`
|
|
32
34
|
);
|
|
33
35
|
}
|
|
34
36
|
if (!isUndefined(removeParams)) {
|
|
@@ -46,7 +48,9 @@ var constructURL = (baseUrl, queryParams, removeParams) => {
|
|
|
46
48
|
throw new TypeError(
|
|
47
49
|
`Second parameter (\`queryParams\`) must be iterable (like URLSearchParams.entries() or an array of [[string, string | number]...]), but received: \`${getPreciseType(
|
|
48
50
|
queryParams
|
|
49
|
-
)}\`, with value: \`${safeStableStringify(queryParams
|
|
51
|
+
)}\`, with value: \`${safeStableStringify(queryParams, {
|
|
52
|
+
keepUndefined: true
|
|
53
|
+
})}\`.`
|
|
50
54
|
);
|
|
51
55
|
}
|
|
52
56
|
const urlInstance = new URL(baseUrl);
|
|
@@ -59,7 +63,9 @@ var constructURL = (baseUrl, queryParams, removeParams) => {
|
|
|
59
63
|
throw new TypeError(
|
|
60
64
|
`Second parameter (\`queryParams\`) must be iterable (like URLSearchParams.entries() or an array of [[string, string | number]...]), but received: \`${getPreciseType(
|
|
61
65
|
queryParams
|
|
62
|
-
)}\`, with value: \`${safeStableStringify(queryParams
|
|
66
|
+
)}\`, with value: \`${safeStableStringify(queryParams, {
|
|
67
|
+
keepUndefined: true
|
|
68
|
+
})}\`.`
|
|
63
69
|
);
|
|
64
70
|
}
|
|
65
71
|
mergedParams.set(key, String(value));
|
|
@@ -109,7 +115,9 @@ var getFirstPrefixPathname = (result, defaultValue = "/") => {
|
|
|
109
115
|
throw new TypeError(
|
|
110
116
|
`Second parameter (\`defaultValue\`) must be of type \`string\` and not an \`empty-string\`, but received: \`${getPreciseType(
|
|
111
117
|
defaultValue
|
|
112
|
-
)}\`, with value: \`${safeStableStringify(defaultValue
|
|
118
|
+
)}\`, with value: \`${safeStableStringify(defaultValue, {
|
|
119
|
+
keepUndefined: true
|
|
120
|
+
})}\`.`
|
|
113
121
|
);
|
|
114
122
|
}
|
|
115
123
|
if (isArray(result)) {
|
|
@@ -117,7 +125,9 @@ var getFirstPrefixPathname = (result, defaultValue = "/") => {
|
|
|
117
125
|
throw new TypeError(
|
|
118
126
|
`First parameter (\`result\`) must be of type \`string\` or \`array of string\`, but received: \`${getPreciseType(
|
|
119
127
|
result
|
|
120
|
-
)}\`, with value: \`${safeStableStringify(result
|
|
128
|
+
)}\`, with value: \`${safeStableStringify(result, {
|
|
129
|
+
keepUndefined: true
|
|
130
|
+
})}\`.`
|
|
121
131
|
);
|
|
122
132
|
}
|
|
123
133
|
for (const item of result) {
|
|
@@ -170,7 +180,9 @@ var getPrefixPathname = (url, base = null, options = {}) => {
|
|
|
170
180
|
errors.push(
|
|
171
181
|
`Parameter \`levels\` property of the \`options\` (second parameter) must be of type \`integer-number\` and minimum is \`0\`, but received: \`${getPreciseType(
|
|
172
182
|
levels
|
|
173
|
-
)}\`, with value: \`${safeStableStringify(levels
|
|
183
|
+
)}\`, with value: \`${safeStableStringify(levels, {
|
|
184
|
+
keepUndefined: true
|
|
185
|
+
})}\`.`
|
|
174
186
|
);
|
|
175
187
|
}
|
|
176
188
|
if (!isBoolean(removeDuplicates)) {
|
|
@@ -2,17 +2,17 @@
|
|
|
2
2
|
* ====================================================
|
|
3
3
|
* Rzl Utils-JS.
|
|
4
4
|
* ----------------------------------------------------
|
|
5
|
-
* Version: 3.
|
|
5
|
+
* Version: 3.9.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 chunk7C7TQC5J_cjs = require('./chunk-7C7TQC5J.cjs');
|
|
13
13
|
|
|
14
14
|
var normalizeString = (input) => {
|
|
15
|
-
return
|
|
15
|
+
return chunk7C7TQC5J_cjs.isNonEmptyString(input) ? input.trim() : "";
|
|
16
16
|
};
|
|
17
17
|
|
|
18
18
|
exports.normalizeString = normalizeString;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* ====================================================
|
|
3
3
|
* Rzl Utils-JS.
|
|
4
4
|
* ----------------------------------------------------
|
|
5
|
-
* Version: 3.
|
|
5
|
+
* Version: 3.9.0.
|
|
6
6
|
* Author: Rizalvin Dwiky.
|
|
7
7
|
* Repository: https://github.com/rzl-zone/utils-js.
|
|
8
8
|
* ====================================================
|
|
@@ -51,12 +51,11 @@ var isNull = (val) => val === null;
|
|
|
51
51
|
|
|
52
52
|
var assertIsBoolean = (value, options = {}) => {
|
|
53
53
|
if (isBoolean(value)) return;
|
|
54
|
-
|
|
54
|
+
resolveErrorMessageAssertions({
|
|
55
55
|
value,
|
|
56
56
|
options,
|
|
57
57
|
requiredValidType: "boolean"
|
|
58
58
|
});
|
|
59
|
-
throw new TypeError(errorMessage);
|
|
60
59
|
};
|
|
61
60
|
|
|
62
61
|
var isNumber = (value, options = {}) => {
|
|
@@ -540,25 +539,48 @@ var getPreciseType = (value, options = { formatCase: "toLowerCase" }) => {
|
|
|
540
539
|
}
|
|
541
540
|
return converterHelper(tag, formatCase);
|
|
542
541
|
};
|
|
542
|
+
var determineErrorTypeAssertion = (type, message) => {
|
|
543
|
+
switch (type) {
|
|
544
|
+
case "Error":
|
|
545
|
+
throw new Error(message);
|
|
546
|
+
case "EvalError":
|
|
547
|
+
throw new EvalError(message);
|
|
548
|
+
case "RangeError":
|
|
549
|
+
throw new RangeError(message);
|
|
550
|
+
case "ReferenceError":
|
|
551
|
+
throw new ReferenceError(message);
|
|
552
|
+
case "SyntaxError":
|
|
553
|
+
throw new SyntaxError(message);
|
|
554
|
+
case "URIError":
|
|
555
|
+
throw new URIError(message);
|
|
556
|
+
case "TypeError":
|
|
557
|
+
throw new TypeError(message);
|
|
558
|
+
default:
|
|
559
|
+
throw new TypeError(message);
|
|
560
|
+
}
|
|
561
|
+
};
|
|
543
562
|
function resolveErrorMessageAssertions(params) {
|
|
544
563
|
const { requiredValidType, value, options } = params || {};
|
|
545
|
-
const {
|
|
564
|
+
const {
|
|
565
|
+
message,
|
|
566
|
+
formatCase,
|
|
567
|
+
errorType = "TypeError"
|
|
568
|
+
} = isPlainObject(options) ? options : {};
|
|
546
569
|
const validType2 = toKebabCase(requiredValidType);
|
|
547
570
|
const currentType = getPreciseType(value, { formatCase });
|
|
548
571
|
const messageFnOptions = { currentType, validType: validType2 };
|
|
549
572
|
const defaultMessage = `Parameter input (\`value\`) must be of type \`${validType2}\`, but received: \`${currentType}\`.`;
|
|
550
573
|
const errorMessage = isFunction(message) ? isNonEmptyString(message(messageFnOptions)) ? message(messageFnOptions).trim() : defaultMessage : isNonEmptyString(message) ? message.trim() : defaultMessage;
|
|
551
|
-
return errorMessage;
|
|
574
|
+
return determineErrorTypeAssertion(errorType, errorMessage);
|
|
552
575
|
}
|
|
553
576
|
|
|
554
577
|
function assertIsPlainObject(value, options = {}) {
|
|
555
578
|
if (isPlainObject(value)) return;
|
|
556
|
-
|
|
579
|
+
resolveErrorMessageAssertions({
|
|
557
580
|
value,
|
|
558
581
|
options,
|
|
559
582
|
requiredValidType: "plain object"
|
|
560
583
|
});
|
|
561
|
-
throw new TypeError(errorMessage);
|
|
562
584
|
}
|
|
563
585
|
|
|
564
586
|
exports.assertIsBoolean = assertIsBoolean;
|