@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,12 +2,12 @@
|
|
|
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
|
-
import { isNonEmptyString, isPlainObject } from './chunk-
|
|
10
|
+
import { isNonEmptyString, isPlainObject } from './chunk-J4TT33ZX.js';
|
|
11
11
|
|
|
12
12
|
var normalizeSpaces = (value, options = {
|
|
13
13
|
withTrim: true,
|
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.9.0.
|
|
6
6
|
* Author: Rizalvin Dwiky.
|
|
7
7
|
* Repository: https://github.com/rzl-zone/utils-js.
|
|
8
8
|
* ====================================================
|
|
@@ -2,28 +2,30 @@
|
|
|
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 chunkNAOVH4OH_cjs = require('./chunk-NAOVH4OH.cjs');
|
|
13
13
|
var chunkBAV5T2E3_cjs = require('./chunk-BAV5T2E3.cjs');
|
|
14
|
-
var
|
|
15
|
-
var
|
|
14
|
+
var chunkH44QVAZL_cjs = require('./chunk-H44QVAZL.cjs');
|
|
15
|
+
var chunk7C7TQC5J_cjs = require('./chunk-7C7TQC5J.cjs');
|
|
16
16
|
|
|
17
17
|
var parseCustomDate = (dateString, format) => {
|
|
18
|
-
if (!
|
|
18
|
+
if (!chunk7C7TQC5J_cjs.isNonEmptyString(dateString) || !chunk7C7TQC5J_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': \`${chunk7C7TQC5J_cjs.getPreciseType(
|
|
21
21
|
dateString
|
|
22
|
-
)}\` - (current value: \`${
|
|
23
|
-
|
|
24
|
-
)}\`), 'format': \`${
|
|
22
|
+
)}\` - (current value: \`${chunkH44QVAZL_cjs.safeStableStringify(dateString, {
|
|
23
|
+
keepUndefined: true
|
|
24
|
+
})}\`), 'format': \`${chunk7C7TQC5J_cjs.getPreciseType(
|
|
25
25
|
format
|
|
26
|
-
)}\` - (current value: \`${
|
|
26
|
+
)}\` - (current value: \`${chunkH44QVAZL_cjs.safeStableStringify(format, {
|
|
27
|
+
keepUndefined: true
|
|
28
|
+
})}\`)]".`
|
|
27
29
|
);
|
|
28
30
|
}
|
|
29
31
|
const dateParts = dateString.split(/[-/]/).map(Number);
|
|
@@ -45,45 +47,45 @@ var parseCustomDate = (dateString, format) => {
|
|
|
45
47
|
};
|
|
46
48
|
|
|
47
49
|
var validateJsonParsingOptions = (optionsValue = {}) => {
|
|
48
|
-
|
|
50
|
+
chunk7C7TQC5J_cjs.assertIsPlainObject(optionsValue, {
|
|
49
51
|
message: ({ currentType, validType }) => `Second parameter (\`options\`) must be of type \`${validType}\`, but received: \`${currentType}\`.`
|
|
50
52
|
});
|
|
51
|
-
const convertBooleans =
|
|
52
|
-
const convertDates =
|
|
53
|
-
const convertNumbers =
|
|
54
|
-
const loggingOnFail =
|
|
55
|
-
const removeEmptyArrays =
|
|
56
|
-
const removeEmptyObjects =
|
|
57
|
-
const removeNulls =
|
|
58
|
-
const removeUndefined =
|
|
59
|
-
const strictMode =
|
|
60
|
-
const checkSymbols =
|
|
61
|
-
const convertNaN =
|
|
62
|
-
const customDateFormats =
|
|
63
|
-
const onError =
|
|
64
|
-
if (!(
|
|
53
|
+
const convertBooleans = chunk7C7TQC5J_cjs.hasOwnProp(optionsValue, "convertBooleans") ? optionsValue.convertBooleans : false;
|
|
54
|
+
const convertDates = chunk7C7TQC5J_cjs.hasOwnProp(optionsValue, "convertDates") ? optionsValue.convertDates : false;
|
|
55
|
+
const convertNumbers = chunk7C7TQC5J_cjs.hasOwnProp(optionsValue, "convertNumbers") ? optionsValue.convertNumbers : false;
|
|
56
|
+
const loggingOnFail = chunk7C7TQC5J_cjs.hasOwnProp(optionsValue, "loggingOnFail") ? optionsValue.loggingOnFail : false;
|
|
57
|
+
const removeEmptyArrays = chunk7C7TQC5J_cjs.hasOwnProp(optionsValue, "removeEmptyArrays") ? optionsValue.removeEmptyArrays : false;
|
|
58
|
+
const removeEmptyObjects = chunk7C7TQC5J_cjs.hasOwnProp(optionsValue, "removeEmptyObjects") ? optionsValue.removeEmptyObjects : false;
|
|
59
|
+
const removeNulls = chunk7C7TQC5J_cjs.hasOwnProp(optionsValue, "removeNulls") ? optionsValue.removeNulls : false;
|
|
60
|
+
const removeUndefined = chunk7C7TQC5J_cjs.hasOwnProp(optionsValue, "removeUndefined") ? optionsValue.removeUndefined : false;
|
|
61
|
+
const strictMode = chunk7C7TQC5J_cjs.hasOwnProp(optionsValue, "strictMode") ? optionsValue.strictMode : false;
|
|
62
|
+
const checkSymbols = chunk7C7TQC5J_cjs.hasOwnProp(optionsValue, "checkSymbols") ? optionsValue.checkSymbols : false;
|
|
63
|
+
const convertNaN = chunk7C7TQC5J_cjs.hasOwnProp(optionsValue, "convertNaN") ? optionsValue.convertNaN : false;
|
|
64
|
+
const customDateFormats = chunk7C7TQC5J_cjs.hasOwnProp(optionsValue, "customDateFormats") ? optionsValue.customDateFormats : [];
|
|
65
|
+
const onError = chunk7C7TQC5J_cjs.hasOwnProp(optionsValue, "onError") ? optionsValue.onError : chunkBAV5T2E3_cjs.noop;
|
|
66
|
+
if (!(chunk7C7TQC5J_cjs.isBoolean(convertBooleans) && chunk7C7TQC5J_cjs.isBoolean(convertDates) && chunk7C7TQC5J_cjs.isBoolean(convertNumbers) && chunk7C7TQC5J_cjs.isBoolean(convertNaN) && chunk7C7TQC5J_cjs.isBoolean(checkSymbols) && chunk7C7TQC5J_cjs.isBoolean(loggingOnFail) && chunk7C7TQC5J_cjs.isBoolean(removeEmptyArrays) && chunk7C7TQC5J_cjs.isBoolean(removeEmptyObjects) && chunk7C7TQC5J_cjs.isBoolean(removeNulls) && chunk7C7TQC5J_cjs.isBoolean(removeUndefined) && chunk7C7TQC5J_cjs.isBoolean(strictMode) && chunk7C7TQC5J_cjs.isArray(customDateFormats) && chunk7C7TQC5J_cjs.isFunction(onError))) {
|
|
65
67
|
throw new TypeError(
|
|
66
|
-
`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': \`${chunk7C7TQC5J_cjs.getPreciseType(
|
|
67
69
|
convertBooleans
|
|
68
|
-
)}\`, 'convertDates': \`${
|
|
70
|
+
)}\`, 'convertDates': \`${chunk7C7TQC5J_cjs.getPreciseType(
|
|
69
71
|
convertDates
|
|
70
|
-
)}\`, 'convertNumbers': \`${
|
|
72
|
+
)}\`, 'convertNumbers': \`${chunk7C7TQC5J_cjs.getPreciseType(
|
|
71
73
|
convertNumbers
|
|
72
|
-
)}\`, 'loggingOnFail': \`${
|
|
74
|
+
)}\`, 'loggingOnFail': \`${chunk7C7TQC5J_cjs.getPreciseType(
|
|
73
75
|
loggingOnFail
|
|
74
|
-
)}\`, 'removeEmptyArrays': \`${
|
|
76
|
+
)}\`, 'removeEmptyArrays': \`${chunk7C7TQC5J_cjs.getPreciseType(
|
|
75
77
|
removeEmptyArrays
|
|
76
|
-
)}\`, 'removeEmptyObjects': \`${
|
|
78
|
+
)}\`, 'removeEmptyObjects': \`${chunk7C7TQC5J_cjs.getPreciseType(
|
|
77
79
|
removeEmptyObjects
|
|
78
|
-
)}\`, 'removeNulls': \`${
|
|
80
|
+
)}\`, 'removeNulls': \`${chunk7C7TQC5J_cjs.getPreciseType(
|
|
79
81
|
removeNulls
|
|
80
|
-
)}\`, 'removeUndefined': \`${
|
|
82
|
+
)}\`, 'removeUndefined': \`${chunk7C7TQC5J_cjs.getPreciseType(
|
|
81
83
|
removeUndefined
|
|
82
|
-
)}\`, 'strictMode': \`${
|
|
84
|
+
)}\`, 'strictMode': \`${chunk7C7TQC5J_cjs.getPreciseType(
|
|
83
85
|
strictMode
|
|
84
|
-
)}\`, 'customDateFormats': \`${
|
|
86
|
+
)}\`, 'customDateFormats': \`${chunk7C7TQC5J_cjs.getPreciseType(
|
|
85
87
|
customDateFormats
|
|
86
|
-
)}\`, 'onError': \`${
|
|
88
|
+
)}\`, 'onError': \`${chunk7C7TQC5J_cjs.getPreciseType(onError)}\`].`
|
|
87
89
|
);
|
|
88
90
|
}
|
|
89
91
|
return {
|
|
@@ -105,9 +107,9 @@ var validateJsonParsingOptions = (optionsValue = {}) => {
|
|
|
105
107
|
|
|
106
108
|
var cleanParsedData = (data, options = {}) => {
|
|
107
109
|
const validOptions = validateJsonParsingOptions(options);
|
|
108
|
-
if (
|
|
109
|
-
if (
|
|
110
|
-
if (
|
|
110
|
+
if (chunk7C7TQC5J_cjs.isNull(data)) return validOptions.removeNulls ? void 0 : null;
|
|
111
|
+
if (chunk7C7TQC5J_cjs.isUndefined(data)) return validOptions.removeUndefined ? void 0 : void 0;
|
|
112
|
+
if (chunk7C7TQC5J_cjs.isString(data)) {
|
|
111
113
|
const trimmed = data.trim();
|
|
112
114
|
if (validOptions.convertNaN && trimmed === "NaN") return NaN;
|
|
113
115
|
if (validOptions.convertNumbers && !isNaN(Number(trimmed))) {
|
|
@@ -130,27 +132,27 @@ var cleanParsedData = (data, options = {}) => {
|
|
|
130
132
|
}
|
|
131
133
|
return validOptions.strictMode ? void 0 : trimmed;
|
|
132
134
|
}
|
|
133
|
-
if (
|
|
134
|
-
const cleanedArray = data.map((item) => cleanParsedData(item, validOptions)).filter((item) => !
|
|
135
|
-
return validOptions.removeEmptyArrays &&
|
|
135
|
+
if (chunk7C7TQC5J_cjs.isArray(data)) {
|
|
136
|
+
const cleanedArray = data.map((item) => cleanParsedData(item, validOptions)).filter((item) => !chunk7C7TQC5J_cjs.isUndefined(item));
|
|
137
|
+
return validOptions.removeEmptyArrays && chunkNAOVH4OH_cjs.isEmptyArray(cleanedArray) ? void 0 : cleanedArray;
|
|
136
138
|
}
|
|
137
|
-
if (
|
|
139
|
+
if (chunk7C7TQC5J_cjs.isObject(data)) {
|
|
138
140
|
const cleanedObject = {};
|
|
139
141
|
for (const key in data) {
|
|
140
142
|
if (Object.prototype.hasOwnProperty.call(data, key)) {
|
|
141
143
|
const cleanedValue = cleanParsedData(data[key], validOptions);
|
|
142
|
-
if (!
|
|
144
|
+
if (!chunk7C7TQC5J_cjs.isUndefined(cleanedValue)) {
|
|
143
145
|
cleanedObject[key] = cleanedValue;
|
|
144
146
|
}
|
|
145
147
|
}
|
|
146
148
|
}
|
|
147
|
-
return validOptions.removeEmptyObjects &&
|
|
149
|
+
return validOptions.removeEmptyObjects && chunkNAOVH4OH_cjs.isEmptyObject(cleanedObject, { checkSymbols: validOptions.checkSymbols }) ? void 0 : cleanedObject;
|
|
148
150
|
}
|
|
149
151
|
return validOptions.strictMode ? void 0 : data;
|
|
150
152
|
};
|
|
151
153
|
|
|
152
154
|
var extractDigits = (value) => {
|
|
153
|
-
if (!
|
|
155
|
+
if (!chunk7C7TQC5J_cjs.isString(value) && !chunk7C7TQC5J_cjs.isNumber(value)) return 0;
|
|
154
156
|
const cleaned = String(value).trim().replace(/[^0-9]/g, "");
|
|
155
157
|
return Number(cleaned) || 0;
|
|
156
158
|
};
|
|
@@ -226,15 +228,15 @@ function fixSingleQuotesEscapeBackslash(input) {
|
|
|
226
228
|
}
|
|
227
229
|
|
|
228
230
|
function safeJsonParse(value, options = {}) {
|
|
229
|
-
if (
|
|
231
|
+
if (chunk7C7TQC5J_cjs.isNull(value)) return null;
|
|
230
232
|
const validOptions = validateJsonParsingOptions(options);
|
|
231
|
-
if (validOptions.convertNaN && (
|
|
233
|
+
if (validOptions.convertNaN && (chunk7C7TQC5J_cjs.isNaN(value) || chunk7C7TQC5J_cjs.isNonEmptyString(value) && value === "NaN")) {
|
|
232
234
|
return NaN;
|
|
233
235
|
}
|
|
234
|
-
if (validOptions.convertNumbers && !
|
|
236
|
+
if (validOptions.convertNumbers && !chunk7C7TQC5J_cjs.isNaN(Number(value)) && chunk7C7TQC5J_cjs.isNumber(extractDigits(value))) {
|
|
235
237
|
return Number(value);
|
|
236
238
|
}
|
|
237
|
-
if (!
|
|
239
|
+
if (!chunk7C7TQC5J_cjs.isString(value)) return void 0;
|
|
238
240
|
try {
|
|
239
241
|
let normalized = fixSingleQuotesEscapeBackslash(value);
|
|
240
242
|
if (validOptions.removeUndefined) {
|
|
@@ -255,7 +257,7 @@ function safeJsonParse(value, options = {}) {
|
|
|
255
257
|
console.error("Failed to parsing at `safeJsonParse`:", error);
|
|
256
258
|
}
|
|
257
259
|
validOptions.onError(
|
|
258
|
-
|
|
260
|
+
chunk7C7TQC5J_cjs.isError(error) ? new Error(error.message.replace(/^JSON\.parse:/, "Failed to parsing")) : new Error(String(error))
|
|
259
261
|
);
|
|
260
262
|
return void 0;
|
|
261
263
|
}
|
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.9.0.
|
|
6
6
|
* Author: Rizalvin Dwiky.
|
|
7
7
|
* Repository: https://github.com/rzl-zone/utils-js.
|
|
8
8
|
* ====================================================
|
|
@@ -2,12 +2,12 @@
|
|
|
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
|
-
import { isArray, isObject, assertIsPlainObject, hasOwnProp, assertIsBoolean } from './chunk-
|
|
10
|
+
import { isArray, isObject, assertIsPlainObject, hasOwnProp, assertIsBoolean } from './chunk-J4TT33ZX.js';
|
|
11
11
|
|
|
12
12
|
var isEmptyArray = (value) => {
|
|
13
13
|
if (!isArray(value)) return true;
|
|
@@ -2,14 +2,14 @@
|
|
|
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
|
-
import { isEmptyString } from './chunk-
|
|
11
|
-
import { assertIsArray } from './chunk-
|
|
12
|
-
import { isPlainObject, isNumber, isNonEmptyString, isFunction, hasOwnProp, isNonEmptyArray, getPreciseType, isString, isObjectOrArray, isStringObject, isNumberObject, isBooleanObject, isArray } from './chunk-
|
|
10
|
+
import { isEmptyString } from './chunk-5O66AUEC.js';
|
|
11
|
+
import { assertIsArray } from './chunk-TXOVQZPU.js';
|
|
12
|
+
import { isPlainObject, isNumber, isNonEmptyString, isFunction, hasOwnProp, isNonEmptyArray, getPreciseType, isString, isObjectOrArray, isStringObject, isNumberObject, isBooleanObject, isArray } from './chunk-J4TT33ZX.js';
|
|
13
13
|
import { getDefaultConfig, extendTailwindMerge } from 'tailwind-merge-v3';
|
|
14
14
|
import { getDefaultConfig as getDefaultConfig$1, extendTailwindMerge as extendTailwindMerge$1 } from 'tailwind-merge-v4';
|
|
15
15
|
|
|
@@ -39,11 +39,11 @@ function toStringValue(value) {
|
|
|
39
39
|
}
|
|
40
40
|
return str;
|
|
41
41
|
}
|
|
42
|
-
function cx(...
|
|
42
|
+
function cx(...values) {
|
|
43
43
|
let str = "";
|
|
44
|
-
for (const
|
|
45
|
-
if (!
|
|
46
|
-
const x = toStringValue(
|
|
44
|
+
for (const value of values) {
|
|
45
|
+
if (!value) continue;
|
|
46
|
+
const x = toStringValue(value);
|
|
47
47
|
if (!x) continue;
|
|
48
48
|
if (str) str += " ";
|
|
49
49
|
str += x;
|
|
@@ -2,30 +2,30 @@
|
|
|
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 chunkNAOVH4OH_cjs = require('./chunk-NAOVH4OH.cjs');
|
|
14
|
+
var chunk7C7TQC5J_cjs = require('./chunk-7C7TQC5J.cjs');
|
|
15
15
|
|
|
16
16
|
var isEmptyValue = (value, options = {}) => {
|
|
17
|
-
|
|
17
|
+
chunk7C7TQC5J_cjs.assertIsPlainObject(options, {
|
|
18
18
|
message: ({ currentType, validType }) => `Second parameter (\`options\`) must be of type \`${validType}\`, but received: \`${currentType}\`.`
|
|
19
19
|
});
|
|
20
|
-
const checkSymbols =
|
|
21
|
-
|
|
20
|
+
const checkSymbols = chunk7C7TQC5J_cjs.hasOwnProp(options, "checkSymbols") ? options.checkSymbols : false;
|
|
21
|
+
chunk7C7TQC5J_cjs.assertIsBoolean(checkSymbols, {
|
|
22
22
|
message: ({ currentType, validType }) => `Parameter \`checkSymbols\` property of the \`options\` (second parameter) must be of type \`${validType}\`, but received: \`${currentType}\`.`
|
|
23
23
|
});
|
|
24
|
-
if (
|
|
25
|
-
if (
|
|
26
|
-
if (
|
|
27
|
-
if (
|
|
28
|
-
return
|
|
24
|
+
if (chunk7C7TQC5J_cjs.isNil(value) || value === false || chunk7C7TQC5J_cjs.isNaN(value)) return true;
|
|
25
|
+
if (chunk7C7TQC5J_cjs.isString(value)) return chunkFWWPEL7J_cjs.isEmptyString(value);
|
|
26
|
+
if (chunk7C7TQC5J_cjs.isArray(value)) return chunkNAOVH4OH_cjs.isEmptyArray(value);
|
|
27
|
+
if (chunk7C7TQC5J_cjs.isObject(value)) {
|
|
28
|
+
return chunkNAOVH4OH_cjs.isEmptyObject(value, { checkSymbols });
|
|
29
29
|
}
|
|
30
30
|
return false;
|
|
31
31
|
};
|
|
@@ -2,20 +2,20 @@
|
|
|
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 { isTypedArray } from './chunk-
|
|
12
|
-
import { parseCurrencyString } from './chunk-
|
|
13
|
-
import { isEmptyString } from './chunk-
|
|
14
|
-
import { assertIsString } from './chunk-
|
|
15
|
-
import { isEqual, isRegExp, baseDeepEqual } from './chunk-
|
|
16
|
-
import { isEmptyArray } from './chunk-
|
|
17
|
-
import { safeStableStringify, isDate, isMap } from './chunk-
|
|
18
|
-
import { isArray, getPreciseType, assertIsBoolean, isNonEmptyString, assertIsPlainObject, isObjectOrArray, isFunction, isString, isNumber, isSymbol, isSet, isPlainObject, isNil, isBoolean, isBuffer, isNaN, isUndefined, isObject, isNull } from './chunk-
|
|
11
|
+
import { isTypedArray } from './chunk-WRGN6UBK.js';
|
|
12
|
+
import { parseCurrencyString } from './chunk-EJV5AF4L.js';
|
|
13
|
+
import { isEmptyString } from './chunk-5O66AUEC.js';
|
|
14
|
+
import { assertIsString } from './chunk-OSSFLQDD.js';
|
|
15
|
+
import { isEqual, isRegExp, baseDeepEqual } from './chunk-J6VLFVIL.js';
|
|
16
|
+
import { isEmptyArray } from './chunk-M5QB2GM5.js';
|
|
17
|
+
import { safeStableStringify, isDate, isMap } from './chunk-X6ULJZ3X.js';
|
|
18
|
+
import { isArray, getPreciseType, assertIsBoolean, isNonEmptyString, assertIsPlainObject, isObjectOrArray, isFunction, isString, isNumber, isSymbol, isSet, isPlainObject, isNil, isBoolean, isBuffer, isNaN, isUndefined, isObject, isNull } from './chunk-J4TT33ZX.js';
|
|
19
19
|
|
|
20
20
|
var areArraysEqual = (array1, array2, ignoreOrder = false) => {
|
|
21
21
|
if (!(isArray(array1) && isArray(array2))) {
|
|
@@ -2,12 +2,12 @@
|
|
|
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
|
-
import { isNumber } from './chunk-
|
|
10
|
+
import { isNumber } from './chunk-J4TT33ZX.js';
|
|
11
11
|
|
|
12
12
|
function isFinite(value) {
|
|
13
13
|
return isNumber(value) && Number.isFinite(value);
|
|
@@ -2,29 +2,29 @@
|
|
|
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 isEmptyArray = (value) => {
|
|
15
|
-
if (!
|
|
15
|
+
if (!chunk7C7TQC5J_cjs.isArray(value)) return true;
|
|
16
16
|
return value.length === 0;
|
|
17
17
|
};
|
|
18
18
|
|
|
19
19
|
function isEmptyObject(value, options = {}) {
|
|
20
|
-
if (!
|
|
20
|
+
if (!chunk7C7TQC5J_cjs.isObject(value)) {
|
|
21
21
|
return true;
|
|
22
22
|
}
|
|
23
|
-
|
|
23
|
+
chunk7C7TQC5J_cjs.assertIsPlainObject(options, {
|
|
24
24
|
message: ({ currentType, validType }) => `Second parameter (\`options\`) must be of type \`${validType}\`, but received: \`${currentType}\`.`
|
|
25
25
|
});
|
|
26
|
-
const checkSymbols =
|
|
27
|
-
|
|
26
|
+
const checkSymbols = chunk7C7TQC5J_cjs.hasOwnProp(options, "checkSymbols") ? options.checkSymbols : false;
|
|
27
|
+
chunk7C7TQC5J_cjs.assertIsBoolean(checkSymbols, {
|
|
28
28
|
message: ({ currentType, validType }) => `Parameter \`checkSymbols\` property of the \`options\` (second parameter) must be of type \`${validType}\`, but received: \`${currentType}\`.`
|
|
29
29
|
});
|
|
30
30
|
const hasNoKeys = Object.keys(value).length === 0;
|