@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,40 +2,40 @@
|
|
|
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
|
|
15
|
-
var
|
|
16
|
-
var
|
|
17
|
-
var
|
|
18
|
-
var
|
|
19
|
-
var
|
|
12
|
+
var chunkALRISPTL_cjs = require('./chunk-ALRISPTL.cjs');
|
|
13
|
+
var chunkI33PB44Q_cjs = require('./chunk-I33PB44Q.cjs');
|
|
14
|
+
var chunkFWWPEL7J_cjs = require('./chunk-FWWPEL7J.cjs');
|
|
15
|
+
var chunkWKM6UVMG_cjs = require('./chunk-WKM6UVMG.cjs');
|
|
16
|
+
var chunkTJ5OY6MC_cjs = require('./chunk-TJ5OY6MC.cjs');
|
|
17
|
+
var chunkNAOVH4OH_cjs = require('./chunk-NAOVH4OH.cjs');
|
|
18
|
+
var chunkOYFUBKEG_cjs = require('./chunk-OYFUBKEG.cjs');
|
|
19
|
+
var chunkH44QVAZL_cjs = require('./chunk-H44QVAZL.cjs');
|
|
20
20
|
var chunkUDA26MCU_cjs = require('./chunk-UDA26MCU.cjs');
|
|
21
|
-
var
|
|
21
|
+
var chunk7C7TQC5J_cjs = require('./chunk-7C7TQC5J.cjs');
|
|
22
22
|
|
|
23
23
|
function toNumberArrayUnRecursive(array, options = {}) {
|
|
24
|
-
|
|
24
|
+
chunk7C7TQC5J_cjs.assertIsPlainObject(options, {
|
|
25
25
|
message: ({ currentType, validType }) => `Second parameter (\`options\`) must be of type \`${validType}\`, but received: \`${currentType}\`.`
|
|
26
26
|
});
|
|
27
|
-
const riv =
|
|
28
|
-
|
|
27
|
+
const riv = chunk7C7TQC5J_cjs.hasOwnProp(options, "removeInvalidValueNumber") ? options.removeInvalidValueNumber : true;
|
|
28
|
+
chunk7C7TQC5J_cjs.assertIsBoolean(riv, {
|
|
29
29
|
message: ({ currentType, validType }) => `Parameter \`removeInvalidValueNumber\` property of the \`options\` (second parameter) must be of type \`${validType}\`, but received: \`${currentType}\`.`
|
|
30
30
|
});
|
|
31
|
-
if (
|
|
31
|
+
if (chunk7C7TQC5J_cjs.isArray(array)) {
|
|
32
32
|
const result = Array.from(array, (x) => {
|
|
33
33
|
if (chunkUDA26MCU_cjs.isBigInt(x)) return Number(x);
|
|
34
34
|
const str = String(x).trim();
|
|
35
35
|
const match = str.match(/-?\d+(\.\d+)?/);
|
|
36
|
-
return match ? Number(match[0]) :
|
|
36
|
+
return match ? Number(match[0]) : chunk7C7TQC5J_cjs.isNull(x) ? null : void 0;
|
|
37
37
|
});
|
|
38
|
-
return riv ?
|
|
38
|
+
return riv ? chunkI33PB44Q_cjs.filterNilArray(result) : result;
|
|
39
39
|
}
|
|
40
40
|
return void 0;
|
|
41
41
|
}
|
|
@@ -43,53 +43,55 @@ function toNumberArrayUnRecursive(array, options = {}) {
|
|
|
43
43
|
function toStringDeepForce(value, forceToString) {
|
|
44
44
|
if (!(forceToString === false || forceToString === "stringOrNumber" || forceToString === "primitives" || forceToString === "all")) {
|
|
45
45
|
throw new TypeError(
|
|
46
|
-
`Second parameter \`forceToString\` must be of type \`false\` or \`string\` with value one of "stringOrNumber" | "primitives" | "all", but received: \`${
|
|
46
|
+
`Second parameter \`forceToString\` must be of type \`false\` or \`string\` with value one of "stringOrNumber" | "primitives" | "all", but received: \`${chunk7C7TQC5J_cjs.getPreciseType(
|
|
47
47
|
forceToString
|
|
48
|
-
)}\`, with value: \`${
|
|
48
|
+
)}\`, with value: \`${chunkH44QVAZL_cjs.safeStableStringify(forceToString, {
|
|
49
|
+
keepUndefined: true
|
|
50
|
+
})}\`.`
|
|
49
51
|
);
|
|
50
52
|
}
|
|
51
|
-
if (
|
|
53
|
+
if (chunk7C7TQC5J_cjs.isNaN(value)) {
|
|
52
54
|
return forceToString === "primitives" || forceToString === "all" ? "NaN" : NaN;
|
|
53
55
|
}
|
|
54
|
-
if (
|
|
56
|
+
if (chunk7C7TQC5J_cjs.isString(value) || chunk7C7TQC5J_cjs.isNumber(value)) {
|
|
55
57
|
return forceToString === "stringOrNumber" || forceToString === "primitives" || forceToString === "all" ? String(value) : value;
|
|
56
58
|
}
|
|
57
|
-
if (
|
|
59
|
+
if (chunk7C7TQC5J_cjs.isBoolean(value) || chunkUDA26MCU_cjs.isBigInt(value) || chunk7C7TQC5J_cjs.isNil(value)) {
|
|
58
60
|
return forceToString === "primitives" || forceToString === "all" ? String(value) : value;
|
|
59
61
|
}
|
|
60
|
-
if (
|
|
62
|
+
if (chunk7C7TQC5J_cjs.isNumberObject(value) || chunk7C7TQC5J_cjs.isBooleanObject(value) || chunk7C7TQC5J_cjs.isStringObject(value)) {
|
|
61
63
|
return forceToString === "all" ? value.valueOf().toString() : value;
|
|
62
64
|
}
|
|
63
|
-
if (
|
|
65
|
+
if (chunk7C7TQC5J_cjs.isSymbol(value)) {
|
|
64
66
|
return forceToString === "all" ? value.toString() : value;
|
|
65
67
|
}
|
|
66
|
-
if (
|
|
68
|
+
if (chunk7C7TQC5J_cjs.isFunction(value)) {
|
|
67
69
|
return forceToString === "all" ? value.toString() : value;
|
|
68
70
|
}
|
|
69
|
-
if (
|
|
71
|
+
if (chunk7C7TQC5J_cjs.isArray(value)) {
|
|
70
72
|
return value.map((v) => toStringDeepForce(v, forceToString));
|
|
71
73
|
}
|
|
72
|
-
if (
|
|
73
|
-
if (
|
|
74
|
+
if (chunk7C7TQC5J_cjs.isObjectOrArray(value)) {
|
|
75
|
+
if (chunkH44QVAZL_cjs.isDate(value)) {
|
|
74
76
|
return forceToString === "all" ? value.toISOString() : value;
|
|
75
77
|
}
|
|
76
|
-
if (
|
|
78
|
+
if (chunkTJ5OY6MC_cjs.isRegExp(value)) {
|
|
77
79
|
return forceToString === "all" ? value.toString() : value;
|
|
78
80
|
}
|
|
79
|
-
if (
|
|
81
|
+
if (chunk7C7TQC5J_cjs.isError(value) || value instanceof Promise) {
|
|
80
82
|
return forceToString === "all" ? value.toString() : value;
|
|
81
83
|
}
|
|
82
|
-
if (
|
|
84
|
+
if (chunk7C7TQC5J_cjs.isSet(value)) {
|
|
83
85
|
return forceToString === "all" ? [...value].map((v) => toStringDeepForce(v, forceToString)) : value;
|
|
84
86
|
}
|
|
85
|
-
if (
|
|
87
|
+
if (chunkH44QVAZL_cjs.isMap(value)) {
|
|
86
88
|
return forceToString === "all" ? [...value.entries()].map(([k, v]) => [
|
|
87
89
|
toStringDeepForce(k, forceToString),
|
|
88
90
|
toStringDeepForce(v, forceToString)
|
|
89
91
|
]) : value;
|
|
90
92
|
}
|
|
91
93
|
const result = {};
|
|
92
|
-
if (
|
|
94
|
+
if (chunk7C7TQC5J_cjs.isObject(value)) {
|
|
93
95
|
for (const key of Object.keys(value)) {
|
|
94
96
|
result[key] = toStringDeepForce(value[key], forceToString);
|
|
95
97
|
}
|
|
@@ -100,29 +102,31 @@ function toStringDeepForce(value, forceToString) {
|
|
|
100
102
|
}
|
|
101
103
|
|
|
102
104
|
var dedupeArray = (inputArray, options = {}) => {
|
|
103
|
-
|
|
105
|
+
chunkOYFUBKEG_cjs.assertIsArray(inputArray, {
|
|
104
106
|
message: ({ currentType, validType }) => `First parameter (\`inputArray\`) must be of type \`${validType}\` (array literal or instance), but received: \`${currentType}\`.`
|
|
105
107
|
});
|
|
106
|
-
|
|
108
|
+
chunk7C7TQC5J_cjs.assertIsPlainObject(options, {
|
|
107
109
|
message: ({ currentType, validType }) => `Second parameter (\`options\`) must be of type \`${validType}\`, but received: \`${currentType}\`.`
|
|
108
110
|
});
|
|
109
|
-
const flatten =
|
|
110
|
-
const forceToString =
|
|
111
|
+
const flatten = chunk7C7TQC5J_cjs.hasOwnProp(options, "flatten") ? options.flatten : false;
|
|
112
|
+
const forceToString = chunk7C7TQC5J_cjs.hasOwnProp(options, "forceToString") ? options.forceToString : false;
|
|
111
113
|
if (!(forceToString === false || forceToString === "stringOrNumber" || forceToString === "primitives" || forceToString === "all")) {
|
|
112
114
|
throw new TypeError(
|
|
113
|
-
`Parameter \`forceToString\` property of the \`options\` (second parameter) must be of type \`false\` or \`string\` with value one of "stringOrNumber" | "primitives" | "all", but received: \`${
|
|
115
|
+
`Parameter \`forceToString\` property of the \`options\` (second parameter) must be of type \`false\` or \`string\` with value one of "stringOrNumber" | "primitives" | "all", but received: \`${chunk7C7TQC5J_cjs.getPreciseType(
|
|
114
116
|
forceToString
|
|
115
|
-
)}\`, with value: \`${
|
|
117
|
+
)}\`, with value: \`${chunkH44QVAZL_cjs.safeStableStringify(forceToString, {
|
|
118
|
+
keepUndefined: true
|
|
119
|
+
})}\`.`
|
|
116
120
|
);
|
|
117
121
|
}
|
|
118
|
-
|
|
122
|
+
chunk7C7TQC5J_cjs.assertIsBoolean(flatten, {
|
|
119
123
|
message: ({ currentType, validType }) => `Parameter \`flatten\` property of the \`options\` (second parameter) must be of type \`${validType}\`, but received: \`${currentType}\`.`
|
|
120
124
|
});
|
|
121
125
|
const process = (arr) => {
|
|
122
126
|
const seen = [];
|
|
123
127
|
return arr.reduce((acc, item) => {
|
|
124
|
-
const value =
|
|
125
|
-
if (!seen.some((s) =>
|
|
128
|
+
const value = chunk7C7TQC5J_cjs.isArray(item) ? process(item) : toStringDeepForce(item, forceToString);
|
|
129
|
+
if (!seen.some((s) => chunkTJ5OY6MC_cjs.isEqual(s, value))) {
|
|
126
130
|
seen.push(value);
|
|
127
131
|
acc.push(value);
|
|
128
132
|
}
|
|
@@ -130,13 +134,13 @@ var dedupeArray = (inputArray, options = {}) => {
|
|
|
130
134
|
}, []);
|
|
131
135
|
};
|
|
132
136
|
const deepFlatten = (value) => {
|
|
133
|
-
if (
|
|
137
|
+
if (chunk7C7TQC5J_cjs.isArray(value)) {
|
|
134
138
|
return value.flatMap(deepFlatten);
|
|
135
139
|
}
|
|
136
|
-
if (
|
|
140
|
+
if (chunk7C7TQC5J_cjs.isSet(value)) {
|
|
137
141
|
return [...value].flatMap(deepFlatten);
|
|
138
142
|
}
|
|
139
|
-
if (
|
|
143
|
+
if (chunkH44QVAZL_cjs.isMap(value)) {
|
|
140
144
|
return [...value.values()].flatMap(deepFlatten);
|
|
141
145
|
}
|
|
142
146
|
return [value];
|
|
@@ -145,40 +149,40 @@ var dedupeArray = (inputArray, options = {}) => {
|
|
|
145
149
|
};
|
|
146
150
|
|
|
147
151
|
var toBooleanContent = (value) => {
|
|
148
|
-
if (
|
|
149
|
-
if (
|
|
150
|
-
if (
|
|
151
|
-
if (
|
|
152
|
-
if (
|
|
152
|
+
if (chunk7C7TQC5J_cjs.isNil(value)) return false;
|
|
153
|
+
if (chunk7C7TQC5J_cjs.isString(value)) return chunk7C7TQC5J_cjs.isNonEmptyString(value);
|
|
154
|
+
if (chunk7C7TQC5J_cjs.isBoolean(value)) return value;
|
|
155
|
+
if (chunk7C7TQC5J_cjs.isNumber(value, { includeNaN: true })) return value !== 0;
|
|
156
|
+
if (chunk7C7TQC5J_cjs.isArray(value) || chunk7C7TQC5J_cjs.isObject(value)) return chunkALRISPTL_cjs.isNonEmptyValue(value);
|
|
153
157
|
return Boolean(value);
|
|
154
158
|
};
|
|
155
159
|
|
|
156
160
|
var toBooleanContentDeep = (value) => {
|
|
157
|
-
if (
|
|
158
|
-
if (
|
|
159
|
-
if (
|
|
160
|
-
if (
|
|
161
|
-
if (
|
|
162
|
-
if (
|
|
161
|
+
if (chunk7C7TQC5J_cjs.isNil(value)) return false;
|
|
162
|
+
if (chunk7C7TQC5J_cjs.isString(value)) return chunk7C7TQC5J_cjs.isNonEmptyString(value);
|
|
163
|
+
if (chunk7C7TQC5J_cjs.isBoolean(value)) return value;
|
|
164
|
+
if (chunk7C7TQC5J_cjs.isNumber(value, { includeNaN: true })) return value !== 0;
|
|
165
|
+
if (chunk7C7TQC5J_cjs.isArray(value)) return value.some(toBooleanContentDeep);
|
|
166
|
+
if (chunk7C7TQC5J_cjs.isObject(value)) return Object.values(value).some(toBooleanContentDeep);
|
|
163
167
|
return false;
|
|
164
168
|
};
|
|
165
169
|
|
|
166
170
|
var toBooleanExplicit = (value, options = {}) => {
|
|
167
|
-
if (
|
|
168
|
-
if (!
|
|
169
|
-
const ci =
|
|
170
|
-
const ts =
|
|
171
|
-
const incInd =
|
|
172
|
-
if (!
|
|
171
|
+
if (chunk7C7TQC5J_cjs.isNil(value)) return false;
|
|
172
|
+
if (!chunk7C7TQC5J_cjs.isPlainObject(options)) options = {};
|
|
173
|
+
const ci = chunk7C7TQC5J_cjs.hasOwnProp(options, "caseInsensitive") ? options.caseInsensitive : false;
|
|
174
|
+
const ts = chunk7C7TQC5J_cjs.hasOwnProp(options, "trimString") ? options.trimString : true;
|
|
175
|
+
const incInd = chunk7C7TQC5J_cjs.hasOwnProp(options, "includeIndeterminate") ? options.includeIndeterminate : false;
|
|
176
|
+
if (!chunk7C7TQC5J_cjs.isBoolean(ci) || !chunk7C7TQC5J_cjs.isBoolean(ts) || !chunk7C7TQC5J_cjs.isBoolean(incInd)) {
|
|
173
177
|
throw new TypeError(
|
|
174
|
-
`Parameters \`caseInsensitive\`, \`trimString\` and \`includeIndeterminate\` property of the \`options\` (second parameter) expected to be a \`boolean\` type, but received: ['caseInsensitive': \`${
|
|
178
|
+
`Parameters \`caseInsensitive\`, \`trimString\` and \`includeIndeterminate\` property of the \`options\` (second parameter) expected to be a \`boolean\` type, but received: ['caseInsensitive': \`${chunk7C7TQC5J_cjs.getPreciseType(
|
|
175
179
|
ci
|
|
176
|
-
)}\`, 'trimString': \`${
|
|
180
|
+
)}\`, 'trimString': \`${chunk7C7TQC5J_cjs.getPreciseType(
|
|
177
181
|
ts
|
|
178
|
-
)}\`, 'includeIndeterminate': \`${
|
|
182
|
+
)}\`, 'includeIndeterminate': \`${chunk7C7TQC5J_cjs.getPreciseType(incInd)}\`].`
|
|
179
183
|
);
|
|
180
184
|
}
|
|
181
|
-
if (
|
|
185
|
+
if (chunk7C7TQC5J_cjs.isString(value)) {
|
|
182
186
|
let normalized = value;
|
|
183
187
|
if (ts) normalized = normalized.trim();
|
|
184
188
|
if (ci) normalized = normalized.toLowerCase();
|
|
@@ -186,17 +190,17 @@ var toBooleanExplicit = (value, options = {}) => {
|
|
|
186
190
|
if (incInd) validTrueStrings.push("indeterminate");
|
|
187
191
|
return validTrueStrings.includes(normalized);
|
|
188
192
|
}
|
|
189
|
-
if (
|
|
190
|
-
if (
|
|
193
|
+
if (chunk7C7TQC5J_cjs.isNumber(value)) return value === 1;
|
|
194
|
+
if (chunk7C7TQC5J_cjs.isBoolean(value)) return value;
|
|
191
195
|
return false;
|
|
192
196
|
};
|
|
193
197
|
|
|
194
198
|
var toBooleanLoose = (value) => {
|
|
195
|
-
if (
|
|
196
|
-
if (
|
|
197
|
-
if (
|
|
198
|
-
if (
|
|
199
|
-
if (
|
|
199
|
+
if (chunk7C7TQC5J_cjs.isNil(value)) return false;
|
|
200
|
+
if (chunk7C7TQC5J_cjs.isString(value)) return !chunkFWWPEL7J_cjs.isEmptyString(value);
|
|
201
|
+
if (chunk7C7TQC5J_cjs.isBoolean(value)) return value;
|
|
202
|
+
if (chunk7C7TQC5J_cjs.isNumber(value, { includeNaN: true })) return value !== 0;
|
|
203
|
+
if (chunk7C7TQC5J_cjs.isArray(value)) return value.length > 0;
|
|
200
204
|
return Boolean(value);
|
|
201
205
|
};
|
|
202
206
|
|
|
@@ -210,14 +214,14 @@ var convertType = (value) => {
|
|
|
210
214
|
yes: true,
|
|
211
215
|
no: false
|
|
212
216
|
};
|
|
213
|
-
if (
|
|
217
|
+
if (chunk7C7TQC5J_cjs.isString(value)) {
|
|
214
218
|
const normalized = value.trim().toLowerCase();
|
|
215
219
|
if (Object.prototype.hasOwnProperty.call(predefinedValues, normalized)) {
|
|
216
220
|
return predefinedValues[normalized];
|
|
217
221
|
}
|
|
218
222
|
const numericString = normalized.replace(/,/g, "");
|
|
219
223
|
const numberString = Number(numericString);
|
|
220
|
-
if (!
|
|
224
|
+
if (!chunk7C7TQC5J_cjs.isNaN(numberString) && chunk7C7TQC5J_cjs.isNonEmptyString(numericString)) {
|
|
221
225
|
return numberString;
|
|
222
226
|
}
|
|
223
227
|
return value.trim();
|
|
@@ -227,7 +231,7 @@ var convertType = (value) => {
|
|
|
227
231
|
|
|
228
232
|
var deepCloneSafe = (obj) => {
|
|
229
233
|
try {
|
|
230
|
-
if (
|
|
234
|
+
if (chunk7C7TQC5J_cjs.isFunction(structuredClone)) {
|
|
231
235
|
return structuredClone(obj);
|
|
232
236
|
}
|
|
233
237
|
} catch {
|
|
@@ -236,54 +240,60 @@ var deepCloneSafe = (obj) => {
|
|
|
236
240
|
};
|
|
237
241
|
|
|
238
242
|
var deleteNestedKey = (obj, path) => {
|
|
239
|
-
if (!
|
|
243
|
+
if (!chunk7C7TQC5J_cjs.isObjectOrArray(obj)) return obj;
|
|
240
244
|
const [currentKey, ...rest] = path;
|
|
241
|
-
if (
|
|
245
|
+
if (chunk7C7TQC5J_cjs.isArray(obj)) {
|
|
242
246
|
for (const item of obj) {
|
|
243
|
-
if (
|
|
247
|
+
if (chunk7C7TQC5J_cjs.isObjectOrArray(item)) deleteNestedKey(item, path);
|
|
244
248
|
}
|
|
245
|
-
} else if (
|
|
246
|
-
if (
|
|
247
|
-
} else if (
|
|
249
|
+
} else if (chunkNAOVH4OH_cjs.isEmptyArray(rest)) {
|
|
250
|
+
if (chunk7C7TQC5J_cjs.isPlainObject(obj)) delete obj[currentKey];
|
|
251
|
+
} else if (chunk7C7TQC5J_cjs.isPlainObject(obj) && chunk7C7TQC5J_cjs.isObjectOrArray(obj[currentKey])) {
|
|
248
252
|
deleteNestedKey(obj[currentKey], rest);
|
|
249
253
|
}
|
|
250
254
|
return obj;
|
|
251
255
|
};
|
|
252
256
|
|
|
253
257
|
var deleteExactPathOnce = (obj, path) => {
|
|
254
|
-
if (!
|
|
258
|
+
if (!chunk7C7TQC5J_cjs.isPlainObject(obj)) return obj;
|
|
255
259
|
const [currentKey, ...rest] = path;
|
|
256
260
|
if (rest.length === 0) {
|
|
257
|
-
if (
|
|
258
|
-
} else if (
|
|
261
|
+
if (chunk7C7TQC5J_cjs.isPlainObject(obj)) delete obj[currentKey];
|
|
262
|
+
} else if (chunk7C7TQC5J_cjs.isPlainObject(obj[currentKey])) {
|
|
259
263
|
deleteExactPathOnce(obj[currentKey], rest);
|
|
260
264
|
}
|
|
261
265
|
return obj;
|
|
262
266
|
};
|
|
263
267
|
|
|
264
268
|
function removeObjectPaths(object, keysToDelete, deepClone = true) {
|
|
265
|
-
if (
|
|
269
|
+
if (chunkNAOVH4OH_cjs.isEmptyObject(object, { checkSymbols: true }))
|
|
266
270
|
return {};
|
|
267
|
-
|
|
268
|
-
message: ({ currentType, validType }) => `Second parameter (\`keysToDelete\`) must be of type \`${validType}\` with value of { key: string, deep?: boolean } plain-object, but received: \`${currentType}\`, with value: \`${
|
|
269
|
-
keysToDelete
|
|
271
|
+
chunkOYFUBKEG_cjs.assertIsArray(keysToDelete, {
|
|
272
|
+
message: ({ currentType, validType }) => `Second parameter (\`keysToDelete\`) must be of type \`${validType}\` with value of { key: string, deep?: boolean } plain-object, but received: \`${currentType}\`, with value: \`${chunkH44QVAZL_cjs.safeStableStringify(
|
|
273
|
+
keysToDelete,
|
|
274
|
+
{
|
|
275
|
+
keepUndefined: true
|
|
276
|
+
}
|
|
270
277
|
)}\`.`
|
|
271
278
|
});
|
|
272
|
-
if (!keysToDelete.every((k) =>
|
|
279
|
+
if (!keysToDelete.every((k) => chunk7C7TQC5J_cjs.isPlainObject(k) && "key" in k)) {
|
|
273
280
|
throw new TypeError(
|
|
274
|
-
`Each element in Second Parameter (\`keysToDelete\`) must be of type \`plain-object\` with at least a "key" property (optionally "deep"), but received: \`${
|
|
275
|
-
keysToDelete
|
|
281
|
+
`Each element in Second Parameter (\`keysToDelete\`) must be of type \`plain-object\` with at least a "key" property (optionally "deep"), but received: \`${chunkH44QVAZL_cjs.safeStableStringify(
|
|
282
|
+
keysToDelete,
|
|
283
|
+
{
|
|
284
|
+
keepUndefined: true
|
|
285
|
+
}
|
|
276
286
|
)}\`.`
|
|
277
287
|
);
|
|
278
288
|
}
|
|
279
289
|
let result = deepClone ? deepCloneSafe(object) : object;
|
|
280
290
|
for (const { key, deep } of keysToDelete) {
|
|
281
|
-
|
|
291
|
+
chunkWKM6UVMG_cjs.assertIsString(key, {
|
|
282
292
|
message: ({ currentType, validType }) => `Parameter \`key\` at Second Parameter (\`keysToDelete\`) must be of type \`${validType}\`, but received: \`${currentType}\`.`
|
|
283
293
|
});
|
|
284
|
-
if (!
|
|
294
|
+
if (!chunk7C7TQC5J_cjs.isUndefined(deep) && !chunk7C7TQC5J_cjs.isBoolean(deep)) {
|
|
285
295
|
throw new TypeError(
|
|
286
|
-
`Parameter \`deep\` at Second Parameter (\`keysToDelete\`) \u2794 (key: "${key}", deep: ${deep}) must be of type \`boolean\` or \`undefined\`, but received: \`${
|
|
296
|
+
`Parameter \`deep\` at Second Parameter (\`keysToDelete\`) \u2794 (key: "${key}", deep: ${deep}) must be of type \`boolean\` or \`undefined\`, but received: \`${chunk7C7TQC5J_cjs.getPreciseType(
|
|
287
297
|
deep
|
|
288
298
|
)}\`.`
|
|
289
299
|
);
|
|
@@ -295,48 +305,48 @@ function removeObjectPaths(object, keysToDelete, deepClone = true) {
|
|
|
295
305
|
}
|
|
296
306
|
|
|
297
307
|
function toNumberDeep(input, options = {}) {
|
|
298
|
-
|
|
308
|
+
chunk7C7TQC5J_cjs.assertIsPlainObject(options, {
|
|
299
309
|
message: ({ currentType, validType }) => `Second parameter (\`options\`) must be of type \`${validType}\`, but received: \`${currentType}\`.`
|
|
300
310
|
});
|
|
301
|
-
const removeEmptyObjects =
|
|
302
|
-
const removeEmptyArrays =
|
|
311
|
+
const removeEmptyObjects = chunk7C7TQC5J_cjs.hasOwnProp(options, "removeEmptyObjects") ? options.removeEmptyObjects : false;
|
|
312
|
+
const removeEmptyArrays = chunk7C7TQC5J_cjs.hasOwnProp(options, "removeEmptyArrays") ? options.removeEmptyArrays : false;
|
|
303
313
|
function _internal(input2, options2) {
|
|
304
|
-
if (
|
|
314
|
+
if (chunk7C7TQC5J_cjs.isNil(input2) || chunkTJ5OY6MC_cjs.isRegExp(input2)) return void 0;
|
|
305
315
|
const { removeEmptyArrays: removeEmptyArrays2, removeEmptyObjects: removeEmptyObjects2, isRoot } = options2;
|
|
306
|
-
if (!
|
|
316
|
+
if (!chunk7C7TQC5J_cjs.isBoolean(removeEmptyObjects2) || !chunk7C7TQC5J_cjs.isBoolean(removeEmptyArrays2)) {
|
|
307
317
|
throw new TypeError(
|
|
308
|
-
`Parameters \`removeEmptyObjects\` and \`removeEmptyArrays\` property of the \`options\` (second parameter) must be of type \`boolean\`, but received: ['removeEmptyObjects': \`${
|
|
318
|
+
`Parameters \`removeEmptyObjects\` and \`removeEmptyArrays\` property of the \`options\` (second parameter) must be of type \`boolean\`, but received: ['removeEmptyObjects': \`${chunk7C7TQC5J_cjs.getPreciseType(
|
|
309
319
|
removeEmptyObjects2
|
|
310
|
-
)}\`, 'removeEmptyArrays': \`${
|
|
320
|
+
)}\`, 'removeEmptyArrays': \`${chunk7C7TQC5J_cjs.getPreciseType(removeEmptyArrays2)}\`].`
|
|
311
321
|
);
|
|
312
322
|
}
|
|
313
|
-
if (
|
|
323
|
+
if (chunk7C7TQC5J_cjs.isNumber(input2) || chunk7C7TQC5J_cjs.isBoolean(input2) || chunk7C7TQC5J_cjs.isNonEmptyString(input2)) {
|
|
314
324
|
const num = Number(input2);
|
|
315
|
-
return
|
|
325
|
+
return chunk7C7TQC5J_cjs.isInfinityNumber(num) || chunk7C7TQC5J_cjs.isNaN(num) ? void 0 : num;
|
|
316
326
|
}
|
|
317
|
-
if (
|
|
327
|
+
if (chunk7C7TQC5J_cjs.isNumberObject(input2) || chunk7C7TQC5J_cjs.isStringObject(input2) || chunk7C7TQC5J_cjs.isBooleanObject(input2)) {
|
|
318
328
|
const valOf = Number(input2.valueOf());
|
|
319
|
-
return
|
|
329
|
+
return chunk7C7TQC5J_cjs.isInfinityNumber(valOf) || chunk7C7TQC5J_cjs.isNaN(valOf) ? void 0 : valOf;
|
|
320
330
|
}
|
|
321
|
-
if (
|
|
331
|
+
if (chunkH44QVAZL_cjs.isDate(input2, { skipInvalidDate: true })) {
|
|
322
332
|
try {
|
|
323
|
-
return !
|
|
333
|
+
return !chunk7C7TQC5J_cjs.isNaN(input2.getTime()) ? input2.getTime() : 0;
|
|
324
334
|
} catch {
|
|
325
335
|
return 0;
|
|
326
336
|
}
|
|
327
337
|
}
|
|
328
|
-
if (
|
|
338
|
+
if (chunk7C7TQC5J_cjs.isBuffer(input2)) {
|
|
329
339
|
const arr = Array.from(input2).map(
|
|
330
340
|
(n) => _internal(n, {
|
|
331
341
|
removeEmptyObjects: removeEmptyObjects2,
|
|
332
342
|
removeEmptyArrays: removeEmptyArrays2,
|
|
333
343
|
isRoot: false
|
|
334
344
|
})
|
|
335
|
-
).filter((item) => !
|
|
336
|
-
if (removeEmptyArrays2 &&
|
|
345
|
+
).filter((item) => !chunk7C7TQC5J_cjs.isUndefined(item));
|
|
346
|
+
if (removeEmptyArrays2 && chunkNAOVH4OH_cjs.isEmptyArray(arr)) return void 0;
|
|
337
347
|
return arr;
|
|
338
348
|
}
|
|
339
|
-
if (
|
|
349
|
+
if (chunkALRISPTL_cjs.isTypedArray(input2)) {
|
|
340
350
|
if (input2 instanceof BigInt64Array || input2 instanceof BigUint64Array) {
|
|
341
351
|
const newArray = Array.from(input2).map(
|
|
342
352
|
(item) => _internal(item, {
|
|
@@ -344,8 +354,8 @@ function toNumberDeep(input, options = {}) {
|
|
|
344
354
|
removeEmptyArrays: removeEmptyArrays2,
|
|
345
355
|
isRoot: false
|
|
346
356
|
})
|
|
347
|
-
).filter((item) => !
|
|
348
|
-
if (removeEmptyArrays2 &&
|
|
357
|
+
).filter((item) => !chunk7C7TQC5J_cjs.isUndefined(item));
|
|
358
|
+
if (removeEmptyArrays2 && chunkNAOVH4OH_cjs.isEmptyArray(newArray)) return void 0;
|
|
349
359
|
return newArray;
|
|
350
360
|
} else {
|
|
351
361
|
const newArray = Array.from(input2).map(
|
|
@@ -354,23 +364,23 @@ function toNumberDeep(input, options = {}) {
|
|
|
354
364
|
removeEmptyArrays: removeEmptyArrays2,
|
|
355
365
|
isRoot: false
|
|
356
366
|
})
|
|
357
|
-
).filter((item) => !
|
|
358
|
-
if (removeEmptyArrays2 &&
|
|
367
|
+
).filter((item) => !chunk7C7TQC5J_cjs.isUndefined(item));
|
|
368
|
+
if (removeEmptyArrays2 && chunkNAOVH4OH_cjs.isEmptyArray(newArray)) return void 0;
|
|
359
369
|
return newArray;
|
|
360
370
|
}
|
|
361
371
|
}
|
|
362
|
-
if (
|
|
372
|
+
if (chunk7C7TQC5J_cjs.isSet(input2)) {
|
|
363
373
|
const newArray = Array.from(input2).map(
|
|
364
374
|
(item) => _internal(item, {
|
|
365
375
|
removeEmptyObjects: removeEmptyObjects2,
|
|
366
376
|
removeEmptyArrays: removeEmptyArrays2,
|
|
367
377
|
isRoot: false
|
|
368
378
|
})
|
|
369
|
-
).filter((item) => !
|
|
370
|
-
if (removeEmptyArrays2 &&
|
|
379
|
+
).filter((item) => !chunk7C7TQC5J_cjs.isUndefined(item));
|
|
380
|
+
if (removeEmptyArrays2 && chunkNAOVH4OH_cjs.isEmptyArray(newArray)) return void 0;
|
|
371
381
|
return newArray;
|
|
372
382
|
}
|
|
373
|
-
if (
|
|
383
|
+
if (chunkH44QVAZL_cjs.isMap(input2)) {
|
|
374
384
|
let newArray = Array.from(input2.entries()).map(([k, v]) => {
|
|
375
385
|
const key = _internal(k, {
|
|
376
386
|
removeEmptyObjects: removeEmptyObjects2,
|
|
@@ -382,26 +392,26 @@ function toNumberDeep(input, options = {}) {
|
|
|
382
392
|
removeEmptyArrays: removeEmptyArrays2,
|
|
383
393
|
isRoot: false
|
|
384
394
|
});
|
|
385
|
-
return !
|
|
386
|
-
}).filter((item) => !
|
|
395
|
+
return !chunk7C7TQC5J_cjs.isUndefined(key) && !chunk7C7TQC5J_cjs.isUndefined(value) ? [key, value] : void 0;
|
|
396
|
+
}).filter((item) => !chunk7C7TQC5J_cjs.isUndefined(item));
|
|
387
397
|
if (removeEmptyArrays2) {
|
|
388
|
-
newArray = newArray.filter((v) => !
|
|
398
|
+
newArray = newArray.filter((v) => !chunkNAOVH4OH_cjs.isEmptyArray(v));
|
|
389
399
|
}
|
|
390
|
-
if (removeEmptyArrays2 &&
|
|
400
|
+
if (removeEmptyArrays2 && chunkNAOVH4OH_cjs.isEmptyArray(newArray)) return void 0;
|
|
391
401
|
return newArray;
|
|
392
402
|
}
|
|
393
|
-
if (
|
|
403
|
+
if (chunk7C7TQC5J_cjs.isArray(input2)) {
|
|
394
404
|
const newArray = input2.map(
|
|
395
405
|
(item) => _internal(item, {
|
|
396
406
|
removeEmptyObjects: removeEmptyObjects2,
|
|
397
407
|
removeEmptyArrays: removeEmptyArrays2,
|
|
398
408
|
isRoot: false
|
|
399
409
|
})
|
|
400
|
-
).filter((item) => !
|
|
401
|
-
if (removeEmptyArrays2 &&
|
|
410
|
+
).filter((item) => !chunk7C7TQC5J_cjs.isUndefined(item));
|
|
411
|
+
if (removeEmptyArrays2 && chunkNAOVH4OH_cjs.isEmptyArray(newArray)) return void 0;
|
|
402
412
|
return newArray;
|
|
403
413
|
}
|
|
404
|
-
if (
|
|
414
|
+
if (chunk7C7TQC5J_cjs.isObject(input2)) {
|
|
405
415
|
const newObject = {};
|
|
406
416
|
for (const [key, value] of Object.entries(input2)) {
|
|
407
417
|
const convertedValue = _internal(value, {
|
|
@@ -409,11 +419,11 @@ function toNumberDeep(input, options = {}) {
|
|
|
409
419
|
removeEmptyArrays: removeEmptyArrays2,
|
|
410
420
|
isRoot: false
|
|
411
421
|
});
|
|
412
|
-
if (!
|
|
422
|
+
if (!chunk7C7TQC5J_cjs.isUndefined(convertedValue)) {
|
|
413
423
|
newObject[key] = convertedValue;
|
|
414
424
|
}
|
|
415
425
|
}
|
|
416
|
-
if (removeEmptyObjects2 &&
|
|
426
|
+
if (removeEmptyObjects2 && chunkNAOVH4OH_cjs.isEmptyObject(newObject)) {
|
|
417
427
|
return isRoot ? {} : void 0;
|
|
418
428
|
}
|
|
419
429
|
return newObject;
|
|
@@ -428,40 +438,40 @@ function toNumberDeep(input, options = {}) {
|
|
|
428
438
|
}
|
|
429
439
|
|
|
430
440
|
function toStringDeep(input, options = {}) {
|
|
431
|
-
|
|
441
|
+
chunk7C7TQC5J_cjs.assertIsPlainObject(options, {
|
|
432
442
|
message: ({ currentType, validType }) => `Second parameter (\`options\`) must be of type \`${validType}\`, but received: \`${currentType}\`.`
|
|
433
443
|
});
|
|
434
|
-
const removeEmptyObjects =
|
|
435
|
-
const removeEmptyArrays =
|
|
444
|
+
const removeEmptyObjects = chunk7C7TQC5J_cjs.hasOwnProp(options, "removeEmptyObjects") ? options.removeEmptyObjects : false;
|
|
445
|
+
const removeEmptyArrays = chunk7C7TQC5J_cjs.hasOwnProp(options, "removeEmptyArrays") ? options.removeEmptyArrays : false;
|
|
436
446
|
function _internal(input2, options2) {
|
|
437
|
-
if (
|
|
447
|
+
if (chunk7C7TQC5J_cjs.isNil(input2) || chunk7C7TQC5J_cjs.isInfinityNumber(input2)) return void 0;
|
|
438
448
|
const { removeEmptyArrays: removeEmptyArrays2, removeEmptyObjects: removeEmptyObjects2, isRoot } = options2;
|
|
439
|
-
if (!
|
|
449
|
+
if (!chunk7C7TQC5J_cjs.isBoolean(removeEmptyObjects2) || !chunk7C7TQC5J_cjs.isBoolean(removeEmptyArrays2)) {
|
|
440
450
|
throw new TypeError(
|
|
441
|
-
`Parameters \`removeEmptyObjects\` and \`removeEmptyArrays\` property of the \`options\` (second parameter) must be of type \`boolean\`, but received: ['removeEmptyObjects': \`${
|
|
451
|
+
`Parameters \`removeEmptyObjects\` and \`removeEmptyArrays\` property of the \`options\` (second parameter) must be of type \`boolean\`, but received: ['removeEmptyObjects': \`${chunk7C7TQC5J_cjs.getPreciseType(
|
|
442
452
|
removeEmptyObjects2
|
|
443
|
-
)}\`, 'removeEmptyArrays': \`${
|
|
453
|
+
)}\`, 'removeEmptyArrays': \`${chunk7C7TQC5J_cjs.getPreciseType(removeEmptyArrays2)}\`].`
|
|
444
454
|
);
|
|
445
455
|
}
|
|
446
|
-
if (
|
|
447
|
-
if (
|
|
456
|
+
if (chunk7C7TQC5J_cjs.isNumber(input2) || chunk7C7TQC5J_cjs.isString(input2) || chunk7C7TQC5J_cjs.isBoolean(input2)) return String(input2);
|
|
457
|
+
if (chunk7C7TQC5J_cjs.isNumberObject(input2)) {
|
|
448
458
|
const valOf = input2.valueOf();
|
|
449
|
-
return
|
|
459
|
+
return chunk7C7TQC5J_cjs.isInfinityNumber(valOf) || chunk7C7TQC5J_cjs.isNaN(valOf) ? void 0 : valOf.toString();
|
|
450
460
|
}
|
|
451
|
-
if (
|
|
452
|
-
if (
|
|
453
|
-
if (
|
|
461
|
+
if (chunk7C7TQC5J_cjs.isStringObject(input2)) return input2.valueOf();
|
|
462
|
+
if (chunk7C7TQC5J_cjs.isBooleanObject(input2)) return input2.valueOf().toString();
|
|
463
|
+
if (chunkH44QVAZL_cjs.isDate(input2, { skipInvalidDate: true })) {
|
|
454
464
|
try {
|
|
455
465
|
return input2.toISOString();
|
|
456
466
|
} catch {
|
|
457
467
|
return input2.toString();
|
|
458
468
|
}
|
|
459
469
|
}
|
|
460
|
-
if (
|
|
461
|
-
if (
|
|
462
|
-
return Array.from(input2).map((v) => String(v)).filter((v) => !
|
|
470
|
+
if (chunkTJ5OY6MC_cjs.isRegExp(input2)) return input2.toString();
|
|
471
|
+
if (chunk7C7TQC5J_cjs.isBuffer(input2)) {
|
|
472
|
+
return Array.from(input2).map((v) => String(v)).filter((v) => !chunk7C7TQC5J_cjs.isUndefined(v));
|
|
463
473
|
}
|
|
464
|
-
if (
|
|
474
|
+
if (chunkALRISPTL_cjs.isTypedArray(input2)) {
|
|
465
475
|
if (input2 instanceof BigInt64Array || input2 instanceof BigUint64Array) {
|
|
466
476
|
const newArray = Array.from(input2).map(
|
|
467
477
|
(item) => _internal(item, {
|
|
@@ -469,8 +479,8 @@ function toStringDeep(input, options = {}) {
|
|
|
469
479
|
removeEmptyArrays: removeEmptyArrays2,
|
|
470
480
|
isRoot: false
|
|
471
481
|
})
|
|
472
|
-
).map((v) => String(v)).filter((item) => !
|
|
473
|
-
if (removeEmptyArrays2 &&
|
|
482
|
+
).map((v) => String(v)).filter((item) => !chunk7C7TQC5J_cjs.isUndefined(item));
|
|
483
|
+
if (removeEmptyArrays2 && chunkNAOVH4OH_cjs.isEmptyArray(newArray)) return void 0;
|
|
474
484
|
return newArray;
|
|
475
485
|
} else {
|
|
476
486
|
const newArray = Array.from(input2).map(
|
|
@@ -479,41 +489,41 @@ function toStringDeep(input, options = {}) {
|
|
|
479
489
|
removeEmptyArrays: removeEmptyArrays2,
|
|
480
490
|
isRoot: false
|
|
481
491
|
})
|
|
482
|
-
).map((v) => String(v)).filter((item) => !
|
|
483
|
-
if (removeEmptyArrays2 &&
|
|
492
|
+
).map((v) => String(v)).filter((item) => !chunk7C7TQC5J_cjs.isUndefined(item));
|
|
493
|
+
if (removeEmptyArrays2 && chunkNAOVH4OH_cjs.isEmptyArray(newArray)) return void 0;
|
|
484
494
|
return newArray;
|
|
485
495
|
}
|
|
486
496
|
}
|
|
487
|
-
if (
|
|
497
|
+
if (chunk7C7TQC5J_cjs.isSet(input2)) {
|
|
488
498
|
const arr = Array.from(input2).map(
|
|
489
499
|
(v) => _internal(v, { removeEmptyObjects: removeEmptyObjects2, removeEmptyArrays: removeEmptyArrays2, isRoot: false })
|
|
490
|
-
).filter((v) => !
|
|
491
|
-
if (removeEmptyArrays2 &&
|
|
500
|
+
).filter((v) => !chunk7C7TQC5J_cjs.isUndefined(v));
|
|
501
|
+
if (removeEmptyArrays2 && chunkNAOVH4OH_cjs.isEmptyArray(arr)) return void 0;
|
|
492
502
|
return arr;
|
|
493
503
|
}
|
|
494
|
-
if (
|
|
504
|
+
if (chunkH44QVAZL_cjs.isMap(input2)) {
|
|
495
505
|
const arr = Array.from(input2.entries()).map(([k, v]) => [
|
|
496
506
|
_internal(k, { removeEmptyObjects: removeEmptyObjects2, removeEmptyArrays: removeEmptyArrays2, isRoot: false }),
|
|
497
507
|
_internal(v, { removeEmptyObjects: removeEmptyObjects2, removeEmptyArrays: removeEmptyArrays2, isRoot: false })
|
|
498
|
-
]).filter(([k, v]) => !
|
|
499
|
-
if (removeEmptyArrays2 &&
|
|
508
|
+
]).filter(([k, v]) => !chunk7C7TQC5J_cjs.isUndefined(k) && !chunk7C7TQC5J_cjs.isUndefined(v));
|
|
509
|
+
if (removeEmptyArrays2 && chunkNAOVH4OH_cjs.isEmptyArray(arr)) return void 0;
|
|
500
510
|
return arr;
|
|
501
511
|
}
|
|
502
|
-
if (
|
|
512
|
+
if (chunk7C7TQC5J_cjs.isArray(input2)) {
|
|
503
513
|
let newArray = input2.map(
|
|
504
514
|
(item) => _internal(item, {
|
|
505
515
|
removeEmptyObjects: removeEmptyObjects2,
|
|
506
516
|
removeEmptyArrays: removeEmptyArrays2,
|
|
507
517
|
isRoot: false
|
|
508
518
|
})
|
|
509
|
-
).filter((item) => !
|
|
519
|
+
).filter((item) => !chunk7C7TQC5J_cjs.isUndefined(item));
|
|
510
520
|
if (removeEmptyArrays2) {
|
|
511
|
-
newArray = newArray.filter((v) => !(
|
|
521
|
+
newArray = newArray.filter((v) => !(chunk7C7TQC5J_cjs.isArray(v) && v.length === 0));
|
|
512
522
|
}
|
|
513
|
-
if (removeEmptyArrays2 &&
|
|
523
|
+
if (removeEmptyArrays2 && chunkNAOVH4OH_cjs.isEmptyArray(newArray)) return void 0;
|
|
514
524
|
return newArray;
|
|
515
525
|
}
|
|
516
|
-
if (
|
|
526
|
+
if (chunk7C7TQC5J_cjs.isObject(input2)) {
|
|
517
527
|
const newObject = {};
|
|
518
528
|
for (const [key, value] of Object.entries(input2)) {
|
|
519
529
|
const convertedValue = _internal(value, {
|
|
@@ -521,9 +531,9 @@ function toStringDeep(input, options = {}) {
|
|
|
521
531
|
removeEmptyArrays: removeEmptyArrays2,
|
|
522
532
|
isRoot: false
|
|
523
533
|
});
|
|
524
|
-
if (!
|
|
534
|
+
if (!chunk7C7TQC5J_cjs.isUndefined(convertedValue)) {
|
|
525
535
|
newObject[key] = convertedValue;
|
|
526
|
-
} else if (
|
|
536
|
+
} else if (chunk7C7TQC5J_cjs.isArray(value) && !removeEmptyArrays2) {
|
|
527
537
|
newObject[key] = [];
|
|
528
538
|
}
|
|
529
539
|
}
|