@rzl-zone/utils-js 3.10.0 → 3.11.1
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 +131 -129
- 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 +6 -4
- package/dist/chunk-7C7TQC5J.cjs +0 -620
- package/dist/chunk-J4TT33ZX.js +0 -584
- package/dist/isPlainObject-BTPjv6zB.d.ts +0 -178
|
@@ -2,28 +2,28 @@
|
|
|
2
2
|
* ====================================================
|
|
3
3
|
* Rzl Utils-JS.
|
|
4
4
|
* ----------------------------------------------------
|
|
5
|
-
* Version: 3.
|
|
5
|
+
* Version: 3.11.1.
|
|
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 chunk7FGNVDEV_cjs = require('./chunk-7FGNVDEV.cjs');
|
|
13
13
|
var chunkBAV5T2E3_cjs = require('./chunk-BAV5T2E3.cjs');
|
|
14
|
-
var
|
|
15
|
-
var
|
|
14
|
+
var chunkDAPAK2W3_cjs = require('./chunk-DAPAK2W3.cjs');
|
|
15
|
+
var chunkSYHPSOUU_cjs = require('./chunk-SYHPSOUU.cjs');
|
|
16
16
|
|
|
17
17
|
var parseCustomDate = (dateString, format) => {
|
|
18
|
-
if (!
|
|
18
|
+
if (!chunkSYHPSOUU_cjs.isNonEmptyString(dateString) || !chunkSYHPSOUU_cjs.isNonEmptyString(format)) {
|
|
19
19
|
throw new TypeError(
|
|
20
|
-
`Parameter \`dateString\` and \`format\` must be of type \`string\` and not empty-string, but received: "['dateString': \`${
|
|
20
|
+
`Parameter \`dateString\` and \`format\` must be of type \`string\` and not empty-string, but received: "['dateString': \`${chunkSYHPSOUU_cjs.getPreciseType(
|
|
21
21
|
dateString
|
|
22
|
-
)}\` - (current value: \`${
|
|
22
|
+
)}\` - (current value: \`${chunkDAPAK2W3_cjs.safeStableStringify(dateString, {
|
|
23
23
|
keepUndefined: true
|
|
24
|
-
})}\`), 'format': \`${
|
|
24
|
+
})}\`), 'format': \`${chunkSYHPSOUU_cjs.getPreciseType(
|
|
25
25
|
format
|
|
26
|
-
)}\` - (current value: \`${
|
|
26
|
+
)}\` - (current value: \`${chunkDAPAK2W3_cjs.safeStableStringify(format, {
|
|
27
27
|
keepUndefined: true
|
|
28
28
|
})}\`)]".`
|
|
29
29
|
);
|
|
@@ -47,45 +47,45 @@ var parseCustomDate = (dateString, format) => {
|
|
|
47
47
|
};
|
|
48
48
|
|
|
49
49
|
var validateJsonParsingOptions = (optionsValue = {}) => {
|
|
50
|
-
|
|
50
|
+
chunkSYHPSOUU_cjs.assertIsPlainObject(optionsValue, {
|
|
51
51
|
message: ({ currentType, validType }) => `Second parameter (\`options\`) must be of type \`${validType}\`, but received: \`${currentType}\`.`
|
|
52
52
|
});
|
|
53
|
-
const convertBooleans =
|
|
54
|
-
const convertDates =
|
|
55
|
-
const convertNumbers =
|
|
56
|
-
const loggingOnFail =
|
|
57
|
-
const removeEmptyArrays =
|
|
58
|
-
const removeEmptyObjects =
|
|
59
|
-
const removeNulls =
|
|
60
|
-
const removeUndefined =
|
|
61
|
-
const strictMode =
|
|
62
|
-
const checkSymbols =
|
|
63
|
-
const convertNaN =
|
|
64
|
-
const customDateFormats =
|
|
65
|
-
const onError =
|
|
66
|
-
if (!(
|
|
53
|
+
const convertBooleans = chunkSYHPSOUU_cjs.hasOwnProp(optionsValue, "convertBooleans") ? optionsValue.convertBooleans : false;
|
|
54
|
+
const convertDates = chunkSYHPSOUU_cjs.hasOwnProp(optionsValue, "convertDates") ? optionsValue.convertDates : false;
|
|
55
|
+
const convertNumbers = chunkSYHPSOUU_cjs.hasOwnProp(optionsValue, "convertNumbers") ? optionsValue.convertNumbers : false;
|
|
56
|
+
const loggingOnFail = chunkSYHPSOUU_cjs.hasOwnProp(optionsValue, "loggingOnFail") ? optionsValue.loggingOnFail : false;
|
|
57
|
+
const removeEmptyArrays = chunkSYHPSOUU_cjs.hasOwnProp(optionsValue, "removeEmptyArrays") ? optionsValue.removeEmptyArrays : false;
|
|
58
|
+
const removeEmptyObjects = chunkSYHPSOUU_cjs.hasOwnProp(optionsValue, "removeEmptyObjects") ? optionsValue.removeEmptyObjects : false;
|
|
59
|
+
const removeNulls = chunkSYHPSOUU_cjs.hasOwnProp(optionsValue, "removeNulls") ? optionsValue.removeNulls : false;
|
|
60
|
+
const removeUndefined = chunkSYHPSOUU_cjs.hasOwnProp(optionsValue, "removeUndefined") ? optionsValue.removeUndefined : false;
|
|
61
|
+
const strictMode = chunkSYHPSOUU_cjs.hasOwnProp(optionsValue, "strictMode") ? optionsValue.strictMode : false;
|
|
62
|
+
const checkSymbols = chunkSYHPSOUU_cjs.hasOwnProp(optionsValue, "checkSymbols") ? optionsValue.checkSymbols : false;
|
|
63
|
+
const convertNaN = chunkSYHPSOUU_cjs.hasOwnProp(optionsValue, "convertNaN") ? optionsValue.convertNaN : false;
|
|
64
|
+
const customDateFormats = chunkSYHPSOUU_cjs.hasOwnProp(optionsValue, "customDateFormats") ? optionsValue.customDateFormats : [];
|
|
65
|
+
const onError = chunkSYHPSOUU_cjs.hasOwnProp(optionsValue, "onError") ? optionsValue.onError : chunkBAV5T2E3_cjs.noop;
|
|
66
|
+
if (!(chunkSYHPSOUU_cjs.isBoolean(convertBooleans) && chunkSYHPSOUU_cjs.isBoolean(convertDates) && chunkSYHPSOUU_cjs.isBoolean(convertNumbers) && chunkSYHPSOUU_cjs.isBoolean(convertNaN) && chunkSYHPSOUU_cjs.isBoolean(checkSymbols) && chunkSYHPSOUU_cjs.isBoolean(loggingOnFail) && chunkSYHPSOUU_cjs.isBoolean(removeEmptyArrays) && chunkSYHPSOUU_cjs.isBoolean(removeEmptyObjects) && chunkSYHPSOUU_cjs.isBoolean(removeNulls) && chunkSYHPSOUU_cjs.isBoolean(removeUndefined) && chunkSYHPSOUU_cjs.isBoolean(strictMode) && chunkSYHPSOUU_cjs.isArray(customDateFormats) && chunkSYHPSOUU_cjs.isFunction(onError))) {
|
|
67
67
|
throw new TypeError(
|
|
68
|
-
`Invalid \`options\` parameter (second argument): \`convertBooleans\`, \`convertDates\`, \`convertNumbers\`, \`loggingOnFail\`, \`removeEmptyArrays\`, \`removeEmptyObjects\`, \`removeNulls\`, \`removeUndefined\`, \`strictMode\` expected to be a \`boolean\` type, \`customDateFormats\` expected to be a \`array\` type and \`onError\` expected to be a \`void function\` type. But received: ['convertBooleans': \`${
|
|
68
|
+
`Invalid \`options\` parameter (second argument): \`convertBooleans\`, \`convertDates\`, \`convertNumbers\`, \`loggingOnFail\`, \`removeEmptyArrays\`, \`removeEmptyObjects\`, \`removeNulls\`, \`removeUndefined\`, \`strictMode\` expected to be a \`boolean\` type, \`customDateFormats\` expected to be a \`array\` type and \`onError\` expected to be a \`void function\` type. But received: ['convertBooleans': \`${chunkSYHPSOUU_cjs.getPreciseType(
|
|
69
69
|
convertBooleans
|
|
70
|
-
)}\`, 'convertDates': \`${
|
|
70
|
+
)}\`, 'convertDates': \`${chunkSYHPSOUU_cjs.getPreciseType(
|
|
71
71
|
convertDates
|
|
72
|
-
)}\`, 'convertNumbers': \`${
|
|
72
|
+
)}\`, 'convertNumbers': \`${chunkSYHPSOUU_cjs.getPreciseType(
|
|
73
73
|
convertNumbers
|
|
74
|
-
)}\`, 'loggingOnFail': \`${
|
|
74
|
+
)}\`, 'loggingOnFail': \`${chunkSYHPSOUU_cjs.getPreciseType(
|
|
75
75
|
loggingOnFail
|
|
76
|
-
)}\`, 'removeEmptyArrays': \`${
|
|
76
|
+
)}\`, 'removeEmptyArrays': \`${chunkSYHPSOUU_cjs.getPreciseType(
|
|
77
77
|
removeEmptyArrays
|
|
78
|
-
)}\`, 'removeEmptyObjects': \`${
|
|
78
|
+
)}\`, 'removeEmptyObjects': \`${chunkSYHPSOUU_cjs.getPreciseType(
|
|
79
79
|
removeEmptyObjects
|
|
80
|
-
)}\`, 'removeNulls': \`${
|
|
80
|
+
)}\`, 'removeNulls': \`${chunkSYHPSOUU_cjs.getPreciseType(
|
|
81
81
|
removeNulls
|
|
82
|
-
)}\`, 'removeUndefined': \`${
|
|
82
|
+
)}\`, 'removeUndefined': \`${chunkSYHPSOUU_cjs.getPreciseType(
|
|
83
83
|
removeUndefined
|
|
84
|
-
)}\`, 'strictMode': \`${
|
|
84
|
+
)}\`, 'strictMode': \`${chunkSYHPSOUU_cjs.getPreciseType(
|
|
85
85
|
strictMode
|
|
86
|
-
)}\`, 'customDateFormats': \`${
|
|
86
|
+
)}\`, 'customDateFormats': \`${chunkSYHPSOUU_cjs.getPreciseType(
|
|
87
87
|
customDateFormats
|
|
88
|
-
)}\`, 'onError': \`${
|
|
88
|
+
)}\`, 'onError': \`${chunkSYHPSOUU_cjs.getPreciseType(onError)}\`].`
|
|
89
89
|
);
|
|
90
90
|
}
|
|
91
91
|
return {
|
|
@@ -107,9 +107,9 @@ var validateJsonParsingOptions = (optionsValue = {}) => {
|
|
|
107
107
|
|
|
108
108
|
var cleanParsedData = (data, options = {}) => {
|
|
109
109
|
const validOptions = validateJsonParsingOptions(options);
|
|
110
|
-
if (
|
|
111
|
-
if (
|
|
112
|
-
if (
|
|
110
|
+
if (chunkSYHPSOUU_cjs.isNull(data)) return validOptions.removeNulls ? void 0 : null;
|
|
111
|
+
if (chunkSYHPSOUU_cjs.isUndefined(data)) return validOptions.removeUndefined ? void 0 : void 0;
|
|
112
|
+
if (chunkSYHPSOUU_cjs.isString(data)) {
|
|
113
113
|
const trimmed = data.trim();
|
|
114
114
|
if (validOptions.convertNaN && trimmed === "NaN") return NaN;
|
|
115
115
|
if (validOptions.convertNumbers && !isNaN(Number(trimmed))) {
|
|
@@ -132,27 +132,27 @@ var cleanParsedData = (data, options = {}) => {
|
|
|
132
132
|
}
|
|
133
133
|
return validOptions.strictMode ? void 0 : trimmed;
|
|
134
134
|
}
|
|
135
|
-
if (
|
|
136
|
-
const cleanedArray = data.map((item) => cleanParsedData(item, validOptions)).filter((item) => !
|
|
137
|
-
return validOptions.removeEmptyArrays &&
|
|
135
|
+
if (chunkSYHPSOUU_cjs.isArray(data)) {
|
|
136
|
+
const cleanedArray = data.map((item) => cleanParsedData(item, validOptions)).filter((item) => !chunkSYHPSOUU_cjs.isUndefined(item));
|
|
137
|
+
return validOptions.removeEmptyArrays && chunk7FGNVDEV_cjs.isEmptyArray(cleanedArray) ? void 0 : cleanedArray;
|
|
138
138
|
}
|
|
139
|
-
if (
|
|
139
|
+
if (chunkSYHPSOUU_cjs.isObject(data)) {
|
|
140
140
|
const cleanedObject = {};
|
|
141
141
|
for (const key in data) {
|
|
142
142
|
if (Object.prototype.hasOwnProperty.call(data, key)) {
|
|
143
143
|
const cleanedValue = cleanParsedData(data[key], validOptions);
|
|
144
|
-
if (!
|
|
144
|
+
if (!chunkSYHPSOUU_cjs.isUndefined(cleanedValue)) {
|
|
145
145
|
cleanedObject[key] = cleanedValue;
|
|
146
146
|
}
|
|
147
147
|
}
|
|
148
148
|
}
|
|
149
|
-
return validOptions.removeEmptyObjects &&
|
|
149
|
+
return validOptions.removeEmptyObjects && chunk7FGNVDEV_cjs.isEmptyObject(cleanedObject, { checkSymbols: validOptions.checkSymbols }) ? void 0 : cleanedObject;
|
|
150
150
|
}
|
|
151
151
|
return validOptions.strictMode ? void 0 : data;
|
|
152
152
|
};
|
|
153
153
|
|
|
154
154
|
var extractDigits = (value) => {
|
|
155
|
-
if (!
|
|
155
|
+
if (!chunkSYHPSOUU_cjs.isString(value) && !chunkSYHPSOUU_cjs.isNumber(value)) return 0;
|
|
156
156
|
const cleaned = String(value).trim().replace(/[^0-9]/g, "");
|
|
157
157
|
return Number(cleaned) || 0;
|
|
158
158
|
};
|
|
@@ -228,15 +228,15 @@ function fixSingleQuotesEscapeBackslash(input) {
|
|
|
228
228
|
}
|
|
229
229
|
|
|
230
230
|
function safeJsonParse(value, options = {}) {
|
|
231
|
-
if (
|
|
231
|
+
if (chunkSYHPSOUU_cjs.isNull(value)) return null;
|
|
232
232
|
const validOptions = validateJsonParsingOptions(options);
|
|
233
|
-
if (validOptions.convertNaN && (
|
|
233
|
+
if (validOptions.convertNaN && (chunkSYHPSOUU_cjs.isNaN(value) || chunkSYHPSOUU_cjs.isNonEmptyString(value) && value === "NaN")) {
|
|
234
234
|
return NaN;
|
|
235
235
|
}
|
|
236
|
-
if (validOptions.convertNumbers && !
|
|
236
|
+
if (validOptions.convertNumbers && !chunkSYHPSOUU_cjs.isNaN(Number(value)) && chunkSYHPSOUU_cjs.isNumber(extractDigits(value))) {
|
|
237
237
|
return Number(value);
|
|
238
238
|
}
|
|
239
|
-
if (!
|
|
239
|
+
if (!chunkSYHPSOUU_cjs.isString(value)) return void 0;
|
|
240
240
|
try {
|
|
241
241
|
let normalized = fixSingleQuotesEscapeBackslash(value);
|
|
242
242
|
if (validOptions.removeUndefined) {
|
|
@@ -257,7 +257,7 @@ function safeJsonParse(value, options = {}) {
|
|
|
257
257
|
console.error("Failed to parsing at `safeJsonParse`:", error);
|
|
258
258
|
}
|
|
259
259
|
validOptions.onError(
|
|
260
|
-
|
|
260
|
+
chunkSYHPSOUU_cjs.isError(error) ? new Error(error.message.replace(/^JSON\.parse:/, "Failed to parsing")) : new Error(String(error))
|
|
261
261
|
);
|
|
262
262
|
return void 0;
|
|
263
263
|
}
|
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.11.1.
|
|
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.11.1.
|
|
6
6
|
* Author: Rizalvin Dwiky.
|
|
7
7
|
* Repository: https://github.com/rzl-zone/utils-js.
|
|
8
8
|
* ====================================================
|
|
@@ -10,11 +10,11 @@
|
|
|
10
10
|
'use strict';
|
|
11
11
|
|
|
12
12
|
var chunkDVMHRLKP_cjs = require('./chunk-DVMHRLKP.cjs');
|
|
13
|
-
var
|
|
14
|
-
var
|
|
13
|
+
var chunkDAPAK2W3_cjs = require('./chunk-DAPAK2W3.cjs');
|
|
14
|
+
var chunkSYHPSOUU_cjs = require('./chunk-SYHPSOUU.cjs');
|
|
15
15
|
|
|
16
16
|
function getRandomItem(array) {
|
|
17
|
-
if (!
|
|
17
|
+
if (!chunkSYHPSOUU_cjs.isNonEmptyArray(array)) return void 0;
|
|
18
18
|
const randomIndex = Math.floor(Math.random() * (array.length || 0));
|
|
19
19
|
return array[randomIndex];
|
|
20
20
|
}
|
|
@@ -25,11 +25,11 @@ var randomInt = (min, max) => {
|
|
|
25
25
|
`First parameter (\`min\`) and second parameter (\`max\`) must be of type \`integer-number\`${minValueNote(
|
|
26
26
|
min,
|
|
27
27
|
max
|
|
28
|
-
)}value, but received: ['min': \`${
|
|
28
|
+
)}value, but received: ['min': \`${chunkSYHPSOUU_cjs.getPreciseType(
|
|
29
29
|
min
|
|
30
|
-
)}\` - (with value: \`${
|
|
30
|
+
)}\` - (with value: \`${chunkDAPAK2W3_cjs.safeStableStringify(min, {
|
|
31
31
|
keepUndefined: true
|
|
32
|
-
})})\`, 'max': \`${
|
|
32
|
+
})})\`, 'max': \`${chunkSYHPSOUU_cjs.getPreciseType(max)}\` - (with value: \`${chunkDAPAK2W3_cjs.safeStableStringify(
|
|
33
33
|
max,
|
|
34
34
|
{
|
|
35
35
|
keepUndefined: true
|
|
@@ -41,9 +41,9 @@ var randomInt = (min, max) => {
|
|
|
41
41
|
throw new RangeError(
|
|
42
42
|
`First parameter (\`min\`) must be less than or equal to second parameter (\`max\`), but received: ['min': ${formatValue(
|
|
43
43
|
min
|
|
44
|
-
)} - (with value: \`${
|
|
44
|
+
)} - (with value: \`${chunkDAPAK2W3_cjs.safeStableStringify(min, {
|
|
45
45
|
keepUndefined: true
|
|
46
|
-
})})\`, 'max': ${formatValue(max)} - (with value: \`${
|
|
46
|
+
})})\`, 'max': ${formatValue(max)} - (with value: \`${chunkDAPAK2W3_cjs.safeStableStringify(max, {
|
|
47
47
|
keepUndefined: true
|
|
48
48
|
})})\`].`
|
|
49
49
|
);
|
|
@@ -53,31 +53,31 @@ var randomInt = (min, max) => {
|
|
|
53
53
|
return Math.floor(Math.random() * (max - min + 1)) + min;
|
|
54
54
|
};
|
|
55
55
|
var formatValue = (value) => {
|
|
56
|
-
return
|
|
56
|
+
return chunkSYHPSOUU_cjs.isNumber(value, { includeNaN: true }) ? value === Number.MIN_VALUE ? "`Number.MIN_VALUE`" : `${value}` : `\`${chunkSYHPSOUU_cjs.getPreciseType(value)}\``;
|
|
57
57
|
};
|
|
58
58
|
var minValueNote = (...values) => {
|
|
59
|
-
return values.some((v) =>
|
|
59
|
+
return values.some((v) => chunkSYHPSOUU_cjs.isNumber(v, { includeNaN: true }) && v === Number.MIN_VALUE) ? " and can't be `Number.MIN_VALUE` " : " ";
|
|
60
60
|
};
|
|
61
61
|
|
|
62
62
|
var randomIntByLength = (options) => {
|
|
63
|
-
if (!
|
|
63
|
+
if (!chunkSYHPSOUU_cjs.isPlainObject(options)) {
|
|
64
64
|
options = {};
|
|
65
65
|
}
|
|
66
66
|
const { minLength = 1, maxLength = 16, avoidZero = false } = options;
|
|
67
|
-
|
|
67
|
+
chunkSYHPSOUU_cjs.assertIsBoolean(avoidZero, {
|
|
68
68
|
message({ currentType, validType }) {
|
|
69
69
|
return `Parameters \`avoidZero\` must be of type \`${validType}\`, but received: \`${currentType}\`.`;
|
|
70
70
|
}
|
|
71
71
|
});
|
|
72
72
|
if (!chunkDVMHRLKP_cjs.isInteger(minLength) || !chunkDVMHRLKP_cjs.isInteger(maxLength)) {
|
|
73
73
|
throw new TypeError(
|
|
74
|
-
`Parameters \`minLength\` and \`maxLength\` must be of type \`integer-number\`, but received: ['minLength': \`${
|
|
74
|
+
`Parameters \`minLength\` and \`maxLength\` must be of type \`integer-number\`, but received: ['minLength': \`${chunkSYHPSOUU_cjs.getPreciseType(
|
|
75
75
|
minLength
|
|
76
|
-
)}\` - (with value: ${
|
|
76
|
+
)}\` - (with value: ${chunkDAPAK2W3_cjs.safeStableStringify(minLength, {
|
|
77
77
|
keepUndefined: true
|
|
78
|
-
})}), 'maxLength': \`${
|
|
78
|
+
})}), 'maxLength': \`${chunkSYHPSOUU_cjs.getPreciseType(
|
|
79
79
|
maxLength
|
|
80
|
-
)}\` - (with value: ${
|
|
80
|
+
)}\` - (with value: ${chunkDAPAK2W3_cjs.safeStableStringify(maxLength, {
|
|
81
81
|
keepUndefined: true
|
|
82
82
|
})})].`
|
|
83
83
|
);
|
|
@@ -98,7 +98,7 @@ var randomIntByLength = (options) => {
|
|
|
98
98
|
};
|
|
99
99
|
|
|
100
100
|
var randomStr = (options) => {
|
|
101
|
-
if (!
|
|
101
|
+
if (!chunkSYHPSOUU_cjs.isPlainObject(options)) {
|
|
102
102
|
options = {};
|
|
103
103
|
}
|
|
104
104
|
const {
|
|
@@ -107,20 +107,20 @@ var randomStr = (options) => {
|
|
|
107
107
|
type = "string",
|
|
108
108
|
avoidWhiteSpace = true
|
|
109
109
|
} = options;
|
|
110
|
-
|
|
110
|
+
chunkSYHPSOUU_cjs.assertIsBoolean(avoidWhiteSpace, {
|
|
111
111
|
message({ currentType, validType }) {
|
|
112
112
|
return `Parameters \`avoidWhiteSpace\` property of the \`options\` (first-parameter) must be of type \`${validType}\`, but received: \`${currentType}\`.`;
|
|
113
113
|
}
|
|
114
114
|
});
|
|
115
115
|
if (!chunkDVMHRLKP_cjs.isInteger(minLength) || !chunkDVMHRLKP_cjs.isInteger(maxLength)) {
|
|
116
116
|
throw new TypeError(
|
|
117
|
-
`Parameters \`minLength\` and \`maxLength\` must be of type \`integer-number\`, but received: ['minLength': \`${
|
|
117
|
+
`Parameters \`minLength\` and \`maxLength\` must be of type \`integer-number\`, but received: ['minLength': \`${chunkSYHPSOUU_cjs.getPreciseType(
|
|
118
118
|
minLength
|
|
119
|
-
)}\` - (with value: ${
|
|
119
|
+
)}\` - (with value: ${chunkDAPAK2W3_cjs.safeStableStringify(minLength, {
|
|
120
120
|
keepUndefined: true
|
|
121
|
-
})}), 'maxLength': \`${
|
|
121
|
+
})}), 'maxLength': \`${chunkSYHPSOUU_cjs.getPreciseType(
|
|
122
122
|
maxLength
|
|
123
|
-
)}\` - (with value: ${
|
|
123
|
+
)}\` - (with value: ${chunkDAPAK2W3_cjs.safeStableStringify(maxLength, {
|
|
124
124
|
keepUndefined: true
|
|
125
125
|
})})].`
|
|
126
126
|
);
|
|
@@ -132,9 +132,9 @@ var randomStr = (options) => {
|
|
|
132
132
|
}
|
|
133
133
|
if (type !== "string" && type !== "number") {
|
|
134
134
|
throw new TypeError(
|
|
135
|
-
`Parameter \`type\` must be of type \`string\` with value one of "string" | "number", but received: \`${
|
|
135
|
+
`Parameter \`type\` must be of type \`string\` with value one of "string" | "number", but received: \`${chunkSYHPSOUU_cjs.getPreciseType(
|
|
136
136
|
type
|
|
137
|
-
)}\`, with value: ${
|
|
137
|
+
)}\`, with value: ${chunkDAPAK2W3_cjs.safeStableStringify(type, {
|
|
138
138
|
keepUndefined: true
|
|
139
139
|
})}.`
|
|
140
140
|
);
|
|
@@ -145,7 +145,7 @@ var randomStr = (options) => {
|
|
|
145
145
|
};
|
|
146
146
|
const defaultNumberSet = "0123456789";
|
|
147
147
|
const defaultStringSet = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
|
148
|
-
const baseCharSet = type === "number" ? (!
|
|
148
|
+
const baseCharSet = type === "number" ? (!chunkSYHPSOUU_cjs.isNaN(Number(options.replaceGenInt)) ? options.replaceGenInt : void 0) ?? defaultNumberSet : (options.replaceGenStr ? options.replaceGenStr : void 0) ?? defaultStringSet;
|
|
149
149
|
const characterSet = cleanCharacters(baseCharSet) + (options.addChar || "");
|
|
150
150
|
if (!characterSet.length) {
|
|
151
151
|
const errCharSet = () => {
|
|
@@ -167,24 +167,24 @@ var randomStr = (options) => {
|
|
|
167
167
|
};
|
|
168
168
|
|
|
169
169
|
function randomUUID(options = {}) {
|
|
170
|
-
if (!
|
|
170
|
+
if (!chunkSYHPSOUU_cjs.isPlainObject(options)) {
|
|
171
171
|
throw new TypeError(
|
|
172
|
-
`First parameter (\`options\`) must be a plain object with optional properties \`version\` and \`monotonic\`, but received: \`${
|
|
172
|
+
`First parameter (\`options\`) must be a plain object with optional properties \`version\` and \`monotonic\`, but received: \`${chunkSYHPSOUU_cjs.getPreciseType(
|
|
173
173
|
options
|
|
174
|
-
)}\` - (with value: \`${
|
|
174
|
+
)}\` - (with value: \`${chunkDAPAK2W3_cjs.safeStableStringify(options, { keepUndefined: true })}\`).`
|
|
175
175
|
);
|
|
176
176
|
}
|
|
177
177
|
const { version = "v4", monotonic = false } = options;
|
|
178
|
-
if (!
|
|
178
|
+
if (!chunkSYHPSOUU_cjs.isNonEmptyString(version)) {
|
|
179
179
|
throw new TypeError(
|
|
180
|
-
`Parameter \`version\` property of the \`options\` (first parameter) must be a \`string\` of either "v4" or "v7", but received type: \`${
|
|
180
|
+
`Parameter \`version\` property of the \`options\` (first parameter) must be a \`string\` of either "v4" or "v7", but received type: \`${chunkSYHPSOUU_cjs.getPreciseType(
|
|
181
181
|
version
|
|
182
|
-
)}\` - (with value: \`${
|
|
182
|
+
)}\` - (with value: \`${chunkDAPAK2W3_cjs.safeStableStringify(version, { keepUndefined: true })}\`).`
|
|
183
183
|
);
|
|
184
184
|
}
|
|
185
185
|
if (version !== "v4" && version !== "v7") {
|
|
186
186
|
throw new RangeError(
|
|
187
|
-
`Unsupported UUID version. Allowed values are "v4" or "v7". (received: \`${
|
|
187
|
+
`Unsupported UUID version. Allowed values are "v4" or "v7". (received: \`${chunkDAPAK2W3_cjs.safeStableStringify(
|
|
188
188
|
version,
|
|
189
189
|
{
|
|
190
190
|
keepUndefined: true
|
|
@@ -192,18 +192,18 @@ function randomUUID(options = {}) {
|
|
|
192
192
|
)}\`).`
|
|
193
193
|
);
|
|
194
194
|
}
|
|
195
|
-
if (!
|
|
195
|
+
if (!chunkSYHPSOUU_cjs.isBoolean(monotonic)) {
|
|
196
196
|
throw new TypeError(
|
|
197
|
-
`Parameter \`monotonic\` property of the \`options\` (first parameter) must be a \`boolean\` when provided, but received type: \`${
|
|
197
|
+
`Parameter \`monotonic\` property of the \`options\` (first parameter) must be a \`boolean\` when provided, but received type: \`${chunkSYHPSOUU_cjs.getPreciseType(
|
|
198
198
|
monotonic
|
|
199
|
-
)}\` - (with value: \`${
|
|
199
|
+
)}\` - (with value: \`${chunkDAPAK2W3_cjs.safeStableStringify(monotonic, {
|
|
200
200
|
keepUndefined: true
|
|
201
201
|
})}\`).`
|
|
202
202
|
);
|
|
203
203
|
}
|
|
204
204
|
if (monotonic && version !== "v7") {
|
|
205
205
|
throw new TypeError(
|
|
206
|
-
`Parameter \`monotonic\` property of the \`options\` (first parameter) is only supported for version "v7". Received: version=${
|
|
206
|
+
`Parameter \`monotonic\` property of the \`options\` (first parameter) is only supported for version "v7". Received: version=${chunkDAPAK2W3_cjs.safeStableStringify(
|
|
207
207
|
version,
|
|
208
208
|
{ keepUndefined: true }
|
|
209
209
|
)}.`
|
package/dist/chunk-L5RDAVVH.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* ====================================================
|
|
3
3
|
* Rzl Utils-JS.
|
|
4
4
|
* ----------------------------------------------------
|
|
5
|
-
* Version: 3.
|
|
5
|
+
* Version: 3.11.1.
|
|
6
6
|
* Author: Rizalvin Dwiky.
|
|
7
7
|
* Repository: https://github.com/rzl-zone/utils-js.
|
|
8
8
|
* ====================================================
|
|
@@ -2,17 +2,17 @@
|
|
|
2
2
|
* ====================================================
|
|
3
3
|
* Rzl Utils-JS.
|
|
4
4
|
* ----------------------------------------------------
|
|
5
|
-
* Version: 3.
|
|
5
|
+
* Version: 3.11.1.
|
|
6
6
|
* Author: Rizalvin Dwiky.
|
|
7
7
|
* Repository: https://github.com/rzl-zone/utils-js.
|
|
8
8
|
* ====================================================
|
|
9
9
|
*/
|
|
10
|
-
import { safeJsonParse } from './chunk-
|
|
11
|
-
import { isEqual } from './chunk-
|
|
12
|
-
import { isEmptyArray } from './chunk-
|
|
13
|
-
import { assertIsArray } from './chunk-
|
|
14
|
-
import { safeStableStringify } from './chunk-
|
|
15
|
-
import { isPlainObject, isNonEmptyArray, isObjectOrArray, isArray, isNaN, isUndefined } from './chunk-
|
|
10
|
+
import { safeJsonParse } from './chunk-BOYP3ARU.js';
|
|
11
|
+
import { isEqual } from './chunk-GXKQ3LHF.js';
|
|
12
|
+
import { isEmptyArray } from './chunk-GOFINGT6.js';
|
|
13
|
+
import { assertIsArray } from './chunk-RZOGBYIS.js';
|
|
14
|
+
import { safeStableStringify } from './chunk-AXDYWO67.js';
|
|
15
|
+
import { isPlainObject, isNonEmptyArray, isObjectOrArray, isArray, isNaN, isUndefined } from './chunk-MSUW5VHZ.js';
|
|
16
16
|
|
|
17
17
|
var findDuplicates = (values) => {
|
|
18
18
|
assertIsArray(values, {
|
|
@@ -2,16 +2,16 @@
|
|
|
2
2
|
* ====================================================
|
|
3
3
|
* Rzl Utils-JS.
|
|
4
4
|
* ----------------------------------------------------
|
|
5
|
-
* Version: 3.
|
|
5
|
+
* Version: 3.11.1.
|
|
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 chunkQYI2VJLS_cjs = require('./chunk-QYI2VJLS.cjs');
|
|
13
|
+
var chunkDAPAK2W3_cjs = require('./chunk-DAPAK2W3.cjs');
|
|
14
|
+
var chunkSYHPSOUU_cjs = require('./chunk-SYHPSOUU.cjs');
|
|
15
15
|
|
|
16
16
|
var sldMap_default = {
|
|
17
17
|
"com.ac": true,
|
|
@@ -1710,8 +1710,8 @@ var ccTldMap_default = {
|
|
|
1710
1710
|
};
|
|
1711
1711
|
|
|
1712
1712
|
function isValidDomain(value, options = {}) {
|
|
1713
|
-
if (!
|
|
1714
|
-
|
|
1713
|
+
if (!chunkSYHPSOUU_cjs.isString(value)) return false;
|
|
1714
|
+
chunkSYHPSOUU_cjs.assertIsPlainObject(options, {
|
|
1715
1715
|
message: ({ currentType, validType }) => `Second parameter (\`options\`) must be of type \`${validType}\`, but received: \`${currentType}\`.`
|
|
1716
1716
|
});
|
|
1717
1717
|
const {
|
|
@@ -1731,12 +1731,12 @@ function isValidDomain(value, options = {}) {
|
|
|
1731
1731
|
allowProtocol,
|
|
1732
1732
|
allowPort,
|
|
1733
1733
|
allowLocalhost
|
|
1734
|
-
}).filter(([, value2]) => !
|
|
1734
|
+
}).filter(([, value2]) => !chunkSYHPSOUU_cjs.isBoolean(value2));
|
|
1735
1735
|
if (invalid.length) {
|
|
1736
1736
|
const msg = invalid.map(
|
|
1737
1737
|
([key, value2], i) => ` ${i + 1}. option: "${key}"
|
|
1738
1738
|
expected: boolean
|
|
1739
|
-
received: ${
|
|
1739
|
+
received: ${chunkSYHPSOUU_cjs.getPreciseType(value2)} (${chunkDAPAK2W3_cjs.safeStableStringify(value2, {
|
|
1740
1740
|
keepUndefined: true
|
|
1741
1741
|
})})`
|
|
1742
1742
|
).join("\n");
|
|
@@ -1774,7 +1774,7 @@ ${msg}`
|
|
|
1774
1774
|
if (allowLocalhost && _value === "localhost") return true;
|
|
1775
1775
|
if (allowUnicode) {
|
|
1776
1776
|
try {
|
|
1777
|
-
_value =
|
|
1777
|
+
_value = chunkQYI2VJLS_cjs.punycodeUtilsJS.toASCII(_value);
|
|
1778
1778
|
} catch {
|
|
1779
1779
|
return false;
|
|
1780
1780
|
}
|