@rzl-zone/utils-js 3.8.0 → 3.9.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 +5 -1
- package/dist/assertions/index.cjs +11 -11
- package/dist/assertions/index.d.ts +168 -57
- 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-SLP24LUV.js → chunk-5Y6JL47L.js} +3 -3
- package/dist/{chunk-ZW3VYES4.cjs → chunk-62FS7WMB.cjs} +31 -31
- package/dist/{chunk-VJVCXEH7.cjs → chunk-6AMDHVS2.cjs} +9 -181
- package/dist/{chunk-5IKZ3JDV.js → chunk-6WVOUVWD.js} +9 -9
- package/dist/{chunk-BYUT376O.cjs → chunk-76ATVDCR.cjs} +3 -3
- package/dist/{chunk-F3WBQKRI.cjs → chunk-7C7TQC5J.cjs} +29 -7
- package/dist/{chunk-I3IXLEEG.js → chunk-7EIFPHV3.js} +8 -8
- 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-KVZ3HL2B.js → chunk-DXPM4NOU.js} +4 -4
- 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-3JD53UUH.cjs → chunk-JI57K7D4.cjs} +161 -161
- package/dist/{chunk-OFBFGFVH.js → chunk-JYOCB6OV.js} +2 -2
- package/dist/chunk-KHO2SBNA.cjs +1 -1
- package/dist/{chunk-6NORJBI6.cjs → chunk-KUVRZ2JW.cjs} +50 -50
- package/dist/chunk-L5RDAVVH.js +1 -1
- package/dist/{chunk-VCVND6CH.js → chunk-M5QB2GM5.js} +2 -2
- package/dist/{chunk-RRJIRXHS.js → chunk-MBFVTGYS.js} +4 -4
- 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-HKJZ7K2K.cjs → chunk-NJ24M6ZH.cjs} +37 -37
- 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-RJYWBVGD.cjs → chunk-QGTFQ7RO.cjs} +6 -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-PW2VMJLT.js → chunk-R2DR7SPJ.js} +99 -25
- package/dist/{chunk-TDYGYHSH.js → chunk-SN5HAK3Y.js} +4 -4
- package/dist/{chunk-P3ST4UZA.js → chunk-SRWL4YCP.js} +7 -7
- 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-LVFTN6DK.cjs → chunk-UFYMRRJH.cjs} +61 -61
- package/dist/{chunk-5NN4ZDE2.cjs → chunk-UV5BKAYW.cjs} +6 -8
- package/dist/{chunk-GAJBF6DR.js → chunk-UXT4XSUK.js} +2 -2
- package/dist/{chunk-6VA4F6VR.js → chunk-VBSLIIDB.js} +10 -10
- package/dist/chunk-VCYXNIZ2.cjs +678 -0
- package/dist/chunk-VJDDGRIK.cjs +1 -1
- package/dist/{chunk-JIROTDOU.js → chunk-WB3FT62A.js} +3 -3
- package/dist/{chunk-K63WO3XA.cjs → chunk-WKM6UVMG.cjs} +4 -5
- package/dist/{chunk-5PF7KRCP.cjs → chunk-WLEZ2KSG.cjs} +126 -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-A4H7474O.cjs → chunk-YQHJB7KR.cjs} +26 -26
- 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 +1 -1
- package/dist/conversions/index.js +15 -15
- package/dist/events/index.cjs +8 -8
- package/dist/events/index.d.ts +1 -1
- package/dist/events/index.js +4 -4
- package/dist/formatters/index.cjs +19 -19
- package/dist/formatters/index.d.ts +1 -1
- package/dist/formatters/index.js +9 -9
- package/dist/generators/index.cjs +9 -9
- package/dist/generators/index.d.ts +1 -1
- package/dist/generators/index.js +4 -4
- package/dist/index.d.ts +1 -1
- package/dist/isPlainObject-BTPjv6zB.d.ts +1 -1
- package/dist/next/index.cjs +37 -36
- package/dist/next/index.d.ts +1 -1
- package/dist/next/index.js +9 -8
- package/dist/next/server/index.cjs +4 -4
- package/dist/next/server/index.d.ts +1 -1
- package/dist/next/server/index.js +2 -2
- package/dist/operations/index.cjs +11 -11
- package/dist/operations/index.d.ts +1 -1
- 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 +1 -1
- package/dist/predicates/index.js +14 -13
- package/dist/promises/index.cjs +6 -6
- package/dist/promises/index.d.ts +2 -3
- 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 +1 -1
- package/dist/tailwind/index.js +5 -5
- package/dist/urls/index.cjs +23 -21
- package/dist/urls/index.d.ts +182 -114
- package/dist/urls/index.js +16 -14
- package/package.json +1 -1
- package/dist/chunk-KPCDDYTZ.js +0 -417
- package/dist/chunk-QAPYHLHC.cjs +0 -419
- package/dist/chunk-SGCN4ED4.cjs +0 -175
|
@@ -2,16 +2,16 @@
|
|
|
2
2
|
* ====================================================
|
|
3
3
|
* Rzl Utils-JS.
|
|
4
4
|
* ----------------------------------------------------
|
|
5
|
-
* Version: 3.
|
|
5
|
+
* Version: 3.9.1.
|
|
6
6
|
* Author: Rizalvin Dwiky.
|
|
7
7
|
* Repository: https://github.com/rzl-zone/utils-js.
|
|
8
8
|
* ====================================================
|
|
9
9
|
*/
|
|
10
|
-
import { isValidDomain } from './chunk-
|
|
11
|
-
import { removeSpaces } from './chunk-
|
|
12
|
-
import { isEmptyString } from './chunk-
|
|
13
|
-
import { safeStableStringify } from './chunk-
|
|
14
|
-
import { assertIsPlainObject, isNonEmptyString, getPreciseType, assertIsBoolean, isNil, isString, isNull, isError, hasOwnProp, isBoolean, isFunction } from './chunk-
|
|
10
|
+
import { isValidDomain } from './chunk-3LE6NX57.js';
|
|
11
|
+
import { removeSpaces } from './chunk-5KDVIEVO.js';
|
|
12
|
+
import { isEmptyString } from './chunk-5O66AUEC.js';
|
|
13
|
+
import { safeStableStringify } from './chunk-X6ULJZ3X.js';
|
|
14
|
+
import { assertIsPlainObject, isNonEmptyString, getPreciseType, assertIsBoolean, isUndefined, isSet, isArray, isNil, isString, isNull, isError, hasOwnProp, isBoolean, isFunction } from './chunk-J4TT33ZX.js';
|
|
15
15
|
|
|
16
16
|
var NormalizePathnameError = class _NormalizePathnameError extends Error {
|
|
17
17
|
/** * ***The original error that triggered this normalization failure.***
|
|
@@ -53,7 +53,13 @@ function normalizePathname(pathname, options = {
|
|
|
53
53
|
return `Second parameter (\`options\`) must be of type \`${validType}\`, but received: \`${currentType}\`.`;
|
|
54
54
|
}
|
|
55
55
|
});
|
|
56
|
-
const {
|
|
56
|
+
const {
|
|
57
|
+
defaultPath = "/",
|
|
58
|
+
keepNullable = false,
|
|
59
|
+
keepTrailingSlash = false,
|
|
60
|
+
localhostDomain = false,
|
|
61
|
+
ignoreDomainExtensions = void 0
|
|
62
|
+
} = options;
|
|
57
63
|
if (!isNonEmptyString(defaultPath)) {
|
|
58
64
|
throw new TypeError(
|
|
59
65
|
`Parameter \`defaultPath\` property of the \`options\` (second parameter) must be of type \`string\` and not empty-string, but received: \`${getPreciseType(
|
|
@@ -63,11 +69,52 @@ function normalizePathname(pathname, options = {
|
|
|
63
69
|
})}\`.`
|
|
64
70
|
);
|
|
65
71
|
}
|
|
72
|
+
assertIsBoolean(keepNullable, {
|
|
73
|
+
message({ currentType, validType }) {
|
|
74
|
+
return `Parameter \`keepNullable\` property of the \`options\` (second parameter) must be of type \`${validType}\`, but received: \`${currentType}\`.`;
|
|
75
|
+
}
|
|
76
|
+
});
|
|
66
77
|
assertIsBoolean(keepTrailingSlash, {
|
|
67
78
|
message({ currentType, validType }) {
|
|
68
79
|
return `Parameter \`keepTrailingSlash\` property of the \`options\` (second parameter) must be of type \`${validType}\`, but received: \`${currentType}\`.`;
|
|
69
80
|
}
|
|
70
81
|
});
|
|
82
|
+
assertIsBoolean(localhostDomain, {
|
|
83
|
+
message({ currentType, validType }) {
|
|
84
|
+
return `Parameter \`localhostDomain\` property of the \`options\` (second parameter) must be of type \`${validType}\`, but received: \`${currentType}\`.`;
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
let ignoreDomainExtsSet;
|
|
88
|
+
if (!isUndefined(ignoreDomainExtensions)) {
|
|
89
|
+
if (!isSet(ignoreDomainExtensions) && !isArray(ignoreDomainExtensions)) {
|
|
90
|
+
throw new TypeError(
|
|
91
|
+
`Parameter \`ignoreDomainExtensions\` must be of type a \`Set<string>\` or \`string[]\`, but received: \`${getPreciseType(
|
|
92
|
+
ignoreDomainExtensions
|
|
93
|
+
)}\`.`
|
|
94
|
+
);
|
|
95
|
+
}
|
|
96
|
+
ignoreDomainExtsSet = isSet(ignoreDomainExtensions) ? ignoreDomainExtensions : new Set(ignoreDomainExtensions);
|
|
97
|
+
let idx = 0;
|
|
98
|
+
for (const ext of ignoreDomainExtsSet) {
|
|
99
|
+
if (!isNonEmptyString(ext)) {
|
|
100
|
+
throw new TypeError(
|
|
101
|
+
`Parameter \`ignoreDomainExtensions[${idx}]\` must be a \`string\` and \`non-empty string\`, but received: \`${safeStableStringify(
|
|
102
|
+
ext,
|
|
103
|
+
{ keepUndefined: true }
|
|
104
|
+
)}\`.`
|
|
105
|
+
);
|
|
106
|
+
}
|
|
107
|
+
if (!ext.startsWith(".")) {
|
|
108
|
+
throw new TypeError(
|
|
109
|
+
`Parameter \`ignoreDomainExtensions[${idx}]\` must start with a dot (.), but received: ${safeStableStringify(
|
|
110
|
+
ext,
|
|
111
|
+
{ keepUndefined: true }
|
|
112
|
+
)}`
|
|
113
|
+
);
|
|
114
|
+
}
|
|
115
|
+
idx++;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
71
118
|
try {
|
|
72
119
|
if (keepNullable && (isNil(pathname) || !isString(pathname))) {
|
|
73
120
|
if (isNull(pathname)) return null;
|
|
@@ -78,7 +125,11 @@ function normalizePathname(pathname, options = {
|
|
|
78
125
|
/\s+/g,
|
|
79
126
|
""
|
|
80
127
|
);
|
|
81
|
-
currentPathName = stripLeadingDomain(currentPathName
|
|
128
|
+
currentPathName = stripLeadingDomain(currentPathName, {
|
|
129
|
+
keepTrailingSlash,
|
|
130
|
+
localhostDomain,
|
|
131
|
+
ignoreDomainExtensions: ignoreDomainExtsSet
|
|
132
|
+
});
|
|
82
133
|
let _pathName = currentPathName;
|
|
83
134
|
let search = "";
|
|
84
135
|
let hash = "";
|
|
@@ -107,14 +158,10 @@ function normalizePathname(pathname, options = {
|
|
|
107
158
|
hash = decodeUnicodeSequences(hash);
|
|
108
159
|
return _pathName + search + hash;
|
|
109
160
|
} catch (error) {
|
|
110
|
-
|
|
111
|
-
throw new NormalizePathnameError(
|
|
112
|
-
`Failed to normalize pathname in function \`normalizePathname()\`: ${err.message}`,
|
|
113
|
-
err
|
|
114
|
-
);
|
|
161
|
+
throwError(error);
|
|
115
162
|
}
|
|
116
163
|
}
|
|
117
|
-
|
|
164
|
+
var decodeUnicodeSequences = (str) => {
|
|
118
165
|
return str.replace(/(?:%(?:[0-9A-F]{2})){2,}/gi, (match) => {
|
|
119
166
|
try {
|
|
120
167
|
const decoded = decodeURIComponent(match);
|
|
@@ -124,32 +171,59 @@ function decodeUnicodeSequences(str) {
|
|
|
124
171
|
return match;
|
|
125
172
|
}
|
|
126
173
|
});
|
|
127
|
-
}
|
|
128
|
-
|
|
174
|
+
};
|
|
175
|
+
var stripLeadingDomain = (path, options) => {
|
|
129
176
|
let currentPath = path;
|
|
177
|
+
const { ignoreDomainExtensions, localhostDomain } = options;
|
|
130
178
|
if (/^https?:\/\//i.test(currentPath)) {
|
|
131
179
|
try {
|
|
132
180
|
const url = new URL(currentPath);
|
|
133
|
-
currentPath =
|
|
134
|
-
|
|
181
|
+
currentPath = url.pathname.replace(/^\/+/, "").replace(/\/{2,}/g, "/") + url.search + url.hash;
|
|
182
|
+
return ensureLeadingSlash(currentPath);
|
|
183
|
+
} catch (error) {
|
|
184
|
+
throwError(error);
|
|
135
185
|
}
|
|
136
186
|
}
|
|
137
187
|
if (currentPath.startsWith("/")) {
|
|
138
188
|
currentPath = currentPath.replace(/\/{2,}/g, "/").slice(1);
|
|
139
189
|
}
|
|
140
|
-
const
|
|
190
|
+
const segments = currentPath.split("/");
|
|
191
|
+
const firstPart = segments[0];
|
|
141
192
|
const domainPart = firstPart.split(":")[0];
|
|
142
|
-
|
|
193
|
+
const isDomain = isValidDomain(domainPart, {
|
|
143
194
|
subdomain: true,
|
|
144
195
|
allowUnicode: true,
|
|
145
196
|
wildcard: true,
|
|
197
|
+
allowLocalhost: localhostDomain,
|
|
198
|
+
allowPort: true,
|
|
199
|
+
allowProtocol: true,
|
|
146
200
|
topLevel: false
|
|
147
|
-
})
|
|
148
|
-
|
|
201
|
+
});
|
|
202
|
+
let hasIgnoredExtension = false;
|
|
203
|
+
if (ignoreDomainExtensions) {
|
|
204
|
+
for (const ext of ignoreDomainExtensions) {
|
|
205
|
+
if (firstPart.endsWith(ext)) {
|
|
206
|
+
hasIgnoredExtension = true;
|
|
207
|
+
break;
|
|
208
|
+
}
|
|
209
|
+
}
|
|
149
210
|
}
|
|
150
|
-
if (!
|
|
151
|
-
|
|
152
|
-
}
|
|
211
|
+
if (isDomain && !hasIgnoredExtension) {
|
|
212
|
+
segments.shift();
|
|
213
|
+
}
|
|
214
|
+
return ensureLeadingSlash(segments.join("/"));
|
|
215
|
+
};
|
|
216
|
+
var ensureLeadingSlash = (path) => {
|
|
217
|
+
if (!path.startsWith("/")) path = "/" + path;
|
|
218
|
+
return path;
|
|
219
|
+
};
|
|
220
|
+
var throwError = (error) => {
|
|
221
|
+
const err = isError(error) ? error : new Error("Unknown error from function `normalizePathname()`.");
|
|
222
|
+
throw new NormalizePathnameError(
|
|
223
|
+
`Failed to normalize pathname in function \`normalizePathname()\`: ${err.message}`,
|
|
224
|
+
err
|
|
225
|
+
);
|
|
226
|
+
};
|
|
153
227
|
|
|
154
228
|
var formatEnvPort = (envVar, options = {}) => {
|
|
155
229
|
if (!isNonEmptyString(envVar)) return "";
|
|
@@ -2,15 +2,15 @@
|
|
|
2
2
|
* ====================================================
|
|
3
3
|
* Rzl Utils-JS.
|
|
4
4
|
* ----------------------------------------------------
|
|
5
|
-
* Version: 3.
|
|
5
|
+
* Version: 3.9.1.
|
|
6
6
|
* Author: Rizalvin Dwiky.
|
|
7
7
|
* Repository: https://github.com/rzl-zone/utils-js.
|
|
8
8
|
* ====================================================
|
|
9
9
|
*/
|
|
10
|
-
import { isFinite } from './chunk-
|
|
11
|
-
import { isEmptyArray } from './chunk-
|
|
10
|
+
import { isFinite } from './chunk-MZ3T6L7Z.js';
|
|
11
|
+
import { isEmptyArray } from './chunk-M5QB2GM5.js';
|
|
12
12
|
import { isBigInt } from './chunk-QNKGP5DY.js';
|
|
13
|
-
import { isNil, isArray, assertIsPlainObject, hasOwnProp, assertIsBoolean, isString, isBoolean, isNull } from './chunk-
|
|
13
|
+
import { isNil, isArray, assertIsPlainObject, hasOwnProp, assertIsBoolean, isString, isBoolean, isNull } from './chunk-J4TT33ZX.js';
|
|
14
14
|
|
|
15
15
|
function filterNilArray(input) {
|
|
16
16
|
if (isNil(input)) return void 0;
|
|
@@ -2,17 +2,17 @@
|
|
|
2
2
|
* ====================================================
|
|
3
3
|
* Rzl Utils-JS.
|
|
4
4
|
* ----------------------------------------------------
|
|
5
|
-
* Version: 3.
|
|
5
|
+
* Version: 3.9.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-DXPM4NOU.js';
|
|
11
|
+
import { isEqual } from './chunk-J6VLFVIL.js';
|
|
12
|
+
import { isEmptyArray } from './chunk-M5QB2GM5.js';
|
|
13
|
+
import { assertIsArray } from './chunk-TXOVQZPU.js';
|
|
14
|
+
import { safeStableStringify } from './chunk-X6ULJZ3X.js';
|
|
15
|
+
import { isPlainObject, isNonEmptyArray, isObjectOrArray, isArray, isNaN, isUndefined } from './chunk-J4TT33ZX.js';
|
|
16
16
|
|
|
17
17
|
var findDuplicates = (values) => {
|
|
18
18
|
assertIsArray(values, {
|
|
@@ -2,15 +2,15 @@
|
|
|
2
2
|
* ====================================================
|
|
3
3
|
* Rzl Utils-JS.
|
|
4
4
|
* ----------------------------------------------------
|
|
5
|
-
* Version: 3.
|
|
5
|
+
* Version: 3.9.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
|
|
12
|
+
var chunkH44QVAZL_cjs = require('./chunk-H44QVAZL.cjs');
|
|
13
|
+
var chunk7C7TQC5J_cjs = require('./chunk-7C7TQC5J.cjs');
|
|
14
14
|
|
|
15
15
|
var isRegExp = (value) => {
|
|
16
16
|
return value instanceof RegExp;
|
|
@@ -23,7 +23,7 @@ function isArrayBuffer(value) {
|
|
|
23
23
|
function baseDeepEqual(value, other, customizer, seen = /* @__PURE__ */ new WeakMap()) {
|
|
24
24
|
if (value === other) return true;
|
|
25
25
|
if (value !== value && other !== other) return true;
|
|
26
|
-
if (!
|
|
26
|
+
if (!chunk7C7TQC5J_cjs.isObjectOrArray(value) || !chunk7C7TQC5J_cjs.isObjectOrArray(other)) {
|
|
27
27
|
return false;
|
|
28
28
|
}
|
|
29
29
|
if (seen.get(value) === other) return true;
|
|
@@ -31,14 +31,14 @@ function baseDeepEqual(value, other, customizer, seen = /* @__PURE__ */ new Weak
|
|
|
31
31
|
const callCustomizer = (v, o, key, valObj, othObj) => {
|
|
32
32
|
if (customizer) {
|
|
33
33
|
const result = customizer(v, o, key, valObj, othObj, seen);
|
|
34
|
-
if (!
|
|
34
|
+
if (!chunk7C7TQC5J_cjs.isUndefined(result)) return result;
|
|
35
35
|
}
|
|
36
36
|
return baseDeepEqual(v, o, customizer, seen);
|
|
37
37
|
};
|
|
38
|
-
if (
|
|
38
|
+
if (chunkH44QVAZL_cjs.isDate(value) && chunkH44QVAZL_cjs.isDate(other)) return value.getTime() === other.getTime();
|
|
39
39
|
if (isRegExp(value) && isRegExp(other))
|
|
40
40
|
return value.source === other.source && value.flags === other.flags;
|
|
41
|
-
if (
|
|
41
|
+
if (chunk7C7TQC5J_cjs.isError(value) && chunk7C7TQC5J_cjs.isError(other))
|
|
42
42
|
return value.name === other.name && value.message === other.message;
|
|
43
43
|
if (ArrayBuffer.isView(value) && ArrayBuffer.isView(other)) {
|
|
44
44
|
const v = new Uint8Array(value.buffer, value.byteOffset, value.byteLength);
|
|
@@ -53,7 +53,7 @@ function baseDeepEqual(value, other, customizer, seen = /* @__PURE__ */ new Weak
|
|
|
53
53
|
for (let i = 0; i < v.length; i++) if (v[i] !== o[i]) return false;
|
|
54
54
|
return true;
|
|
55
55
|
}
|
|
56
|
-
if (
|
|
56
|
+
if (chunkH44QVAZL_cjs.isMap(value) && chunkH44QVAZL_cjs.isMap(other)) {
|
|
57
57
|
if (value.size !== other.size) return false;
|
|
58
58
|
for (const [k, v] of value) {
|
|
59
59
|
if (!other.has(k)) return false;
|
|
@@ -61,7 +61,7 @@ function baseDeepEqual(value, other, customizer, seen = /* @__PURE__ */ new Weak
|
|
|
61
61
|
}
|
|
62
62
|
return true;
|
|
63
63
|
}
|
|
64
|
-
if (
|
|
64
|
+
if (chunk7C7TQC5J_cjs.isSet(value) && chunk7C7TQC5J_cjs.isSet(other)) {
|
|
65
65
|
if (value.size !== other.size) return false;
|
|
66
66
|
for (const v of value) {
|
|
67
67
|
let matched = false;
|
|
@@ -75,7 +75,7 @@ function baseDeepEqual(value, other, customizer, seen = /* @__PURE__ */ new Weak
|
|
|
75
75
|
}
|
|
76
76
|
return true;
|
|
77
77
|
}
|
|
78
|
-
if (
|
|
78
|
+
if (chunk7C7TQC5J_cjs.isArray(value) && chunk7C7TQC5J_cjs.isArray(other)) {
|
|
79
79
|
if (value.length !== other.length) return false;
|
|
80
80
|
for (let i = 0; i < value.length; i++) {
|
|
81
81
|
if (!callCustomizer(value[i], other[i], i, value, other)) return false;
|
|
@@ -2,21 +2,20 @@
|
|
|
2
2
|
* ====================================================
|
|
3
3
|
* Rzl Utils-JS.
|
|
4
4
|
* ----------------------------------------------------
|
|
5
|
-
* Version: 3.
|
|
5
|
+
* Version: 3.9.1.
|
|
6
6
|
* Author: Rizalvin Dwiky.
|
|
7
7
|
* Repository: https://github.com/rzl-zone/utils-js.
|
|
8
8
|
* ====================================================
|
|
9
9
|
*/
|
|
10
|
-
import { isArray, resolveErrorMessageAssertions } from './chunk-
|
|
10
|
+
import { isArray, resolveErrorMessageAssertions } from './chunk-J4TT33ZX.js';
|
|
11
11
|
|
|
12
12
|
function assertIsArray(value, options) {
|
|
13
13
|
if (isArray(value)) return;
|
|
14
|
-
|
|
14
|
+
resolveErrorMessageAssertions({
|
|
15
15
|
value,
|
|
16
16
|
options,
|
|
17
17
|
requiredValidType: "array"
|
|
18
18
|
});
|
|
19
|
-
throw new TypeError(errorMessage);
|
|
20
19
|
}
|
|
21
20
|
|
|
22
21
|
export { assertIsArray };
|
package/dist/chunk-UDA26MCU.cjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* ====================================================
|
|
3
3
|
* Rzl Utils-JS.
|
|
4
4
|
* ----------------------------------------------------
|
|
5
|
-
* Version: 3.
|
|
5
|
+
* Version: 3.9.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.9.1.
|
|
6
6
|
* Author: Rizalvin Dwiky.
|
|
7
7
|
* Repository: https://github.com/rzl-zone/utils-js.
|
|
8
8
|
* ====================================================
|
|
@@ -10,62 +10,62 @@
|
|
|
10
10
|
'use strict';
|
|
11
11
|
|
|
12
12
|
var chunkKHO2SBNA_cjs = require('./chunk-KHO2SBNA.cjs');
|
|
13
|
-
var
|
|
14
|
-
var
|
|
15
|
-
var
|
|
13
|
+
var chunk76ATVDCR_cjs = require('./chunk-76ATVDCR.cjs');
|
|
14
|
+
var chunkI33PB44Q_cjs = require('./chunk-I33PB44Q.cjs');
|
|
15
|
+
var chunkMMRHKYT6_cjs = require('./chunk-MMRHKYT6.cjs');
|
|
16
16
|
var chunkDVMHRLKP_cjs = require('./chunk-DVMHRLKP.cjs');
|
|
17
|
-
var
|
|
18
|
-
var
|
|
19
|
-
var
|
|
20
|
-
var
|
|
21
|
-
var
|
|
17
|
+
var chunkOCTHWEZK_cjs = require('./chunk-OCTHWEZK.cjs');
|
|
18
|
+
var chunkFWWPEL7J_cjs = require('./chunk-FWWPEL7J.cjs');
|
|
19
|
+
var chunkOYFUBKEG_cjs = require('./chunk-OYFUBKEG.cjs');
|
|
20
|
+
var chunkH44QVAZL_cjs = require('./chunk-H44QVAZL.cjs');
|
|
21
|
+
var chunk7C7TQC5J_cjs = require('./chunk-7C7TQC5J.cjs');
|
|
22
22
|
|
|
23
23
|
var constructURL = (baseUrl, queryParams, removeParams) => {
|
|
24
|
-
if (
|
|
25
|
-
if (
|
|
24
|
+
if (chunk7C7TQC5J_cjs.isString(baseUrl)) {
|
|
25
|
+
if (chunkFWWPEL7J_cjs.isEmptyString(baseUrl)) {
|
|
26
26
|
throw new TypeError(`First parameter (\`baseUrl\`) cannot be an empty-string.`);
|
|
27
27
|
}
|
|
28
|
-
baseUrl =
|
|
28
|
+
baseUrl = chunk76ATVDCR_cjs.normalizeString(baseUrl);
|
|
29
29
|
} else if (!chunkKHO2SBNA_cjs.isURL(baseUrl)) {
|
|
30
30
|
throw new TypeError(
|
|
31
|
-
`First parameter (\`baseUrl\`) must be of type an URL instance or a \`string\` and a non empty-string, but received: \`${
|
|
31
|
+
`First parameter (\`baseUrl\`) must be of type an URL instance or a \`string\` and a non empty-string, but received: \`${chunk7C7TQC5J_cjs.getPreciseType(
|
|
32
32
|
baseUrl
|
|
33
|
-
)}\`, with current value: \`${
|
|
33
|
+
)}\`, with current value: \`${chunkH44QVAZL_cjs.safeStableStringify(baseUrl, {
|
|
34
34
|
keepUndefined: true
|
|
35
35
|
})}\`.`
|
|
36
36
|
);
|
|
37
37
|
}
|
|
38
|
-
if (!
|
|
39
|
-
|
|
38
|
+
if (!chunk7C7TQC5J_cjs.isUndefined(removeParams)) {
|
|
39
|
+
chunkOYFUBKEG_cjs.assertIsArray(removeParams, {
|
|
40
40
|
message: ({ currentType, validType }) => `Third parameter (\`removeParams\`) must be of type \`${validType} of strings\`, but received: \`${currentType}\`.`
|
|
41
41
|
});
|
|
42
|
-
if (!removeParams.every((param) =>
|
|
42
|
+
if (!removeParams.every((param) => chunk7C7TQC5J_cjs.isNonEmptyString(param))) {
|
|
43
43
|
throw new TypeError(
|
|
44
44
|
`Third parameter (\`removeParams\`) must be of type \`array\` and contains \`string\` only and non empty-string.`
|
|
45
45
|
);
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
48
|
try {
|
|
49
|
-
if (!
|
|
49
|
+
if (!chunk7C7TQC5J_cjs.isUndefined(queryParams) && !chunk7C7TQC5J_cjs.isFunction(queryParams[Symbol.iterator])) {
|
|
50
50
|
throw new TypeError(
|
|
51
|
-
`Second parameter (\`queryParams\`) must be iterable (like URLSearchParams.entries() or an array of [[string, string | number]...]), but received: \`${
|
|
51
|
+
`Second parameter (\`queryParams\`) must be iterable (like URLSearchParams.entries() or an array of [[string, string | number]...]), but received: \`${chunk7C7TQC5J_cjs.getPreciseType(
|
|
52
52
|
queryParams
|
|
53
|
-
)}\`, with value: \`${
|
|
53
|
+
)}\`, with value: \`${chunkH44QVAZL_cjs.safeStableStringify(queryParams, {
|
|
54
54
|
keepUndefined: true
|
|
55
55
|
})}\`.`
|
|
56
56
|
);
|
|
57
57
|
}
|
|
58
58
|
const urlInstance = new URL(baseUrl);
|
|
59
|
-
if (!
|
|
59
|
+
if (!chunk7C7TQC5J_cjs.isUndefined(queryParams)) {
|
|
60
60
|
const paramObject = Object.fromEntries(queryParams);
|
|
61
|
-
if (!
|
|
61
|
+
if (!chunkMMRHKYT6_cjs.isEmptyValue(paramObject)) {
|
|
62
62
|
const mergedParams = new URLSearchParams(urlInstance.search);
|
|
63
63
|
for (const [key, value] of Object.entries(paramObject)) {
|
|
64
|
-
if (!
|
|
64
|
+
if (!chunk7C7TQC5J_cjs.isNonEmptyString(value) && !chunk7C7TQC5J_cjs.isNumber(value, { includeNaN: true })) {
|
|
65
65
|
throw new TypeError(
|
|
66
|
-
`Second parameter (\`queryParams\`) must be iterable (like URLSearchParams.entries() or an array of [[string, string | number]...]), but received: \`${
|
|
66
|
+
`Second parameter (\`queryParams\`) must be iterable (like URLSearchParams.entries() or an array of [[string, string | number]...]), but received: \`${chunk7C7TQC5J_cjs.getPreciseType(
|
|
67
67
|
queryParams
|
|
68
|
-
)}\`, with value: \`${
|
|
68
|
+
)}\`, with value: \`${chunkH44QVAZL_cjs.safeStableStringify(queryParams, {
|
|
69
69
|
keepUndefined: true
|
|
70
70
|
})}\`.`
|
|
71
71
|
);
|
|
@@ -73,7 +73,7 @@ var constructURL = (baseUrl, queryParams, removeParams) => {
|
|
|
73
73
|
mergedParams.set(key, String(value));
|
|
74
74
|
}
|
|
75
75
|
if (removeParams?.length) {
|
|
76
|
-
|
|
76
|
+
chunkI33PB44Q_cjs.toStringArrayUnRecursive(removeParams).map((paramKey) => {
|
|
77
77
|
mergedParams.delete(paramKey);
|
|
78
78
|
});
|
|
79
79
|
}
|
|
@@ -83,7 +83,7 @@ var constructURL = (baseUrl, queryParams, removeParams) => {
|
|
|
83
83
|
removeParams?.forEach((param) => urlInstance.searchParams.delete(param));
|
|
84
84
|
return urlInstance;
|
|
85
85
|
} catch (error) {
|
|
86
|
-
if (
|
|
86
|
+
if (chunk7C7TQC5J_cjs.isError(error)) throw error;
|
|
87
87
|
throw new Error(
|
|
88
88
|
"Failed to construct a valid URL in `constructURL()`, Error:" + error
|
|
89
89
|
);
|
|
@@ -91,7 +91,7 @@ var constructURL = (baseUrl, queryParams, removeParams) => {
|
|
|
91
91
|
};
|
|
92
92
|
|
|
93
93
|
var extractURLs = (url) => {
|
|
94
|
-
if (!
|
|
94
|
+
if (!chunk7C7TQC5J_cjs.isNonEmptyString(url)) return null;
|
|
95
95
|
let decoded;
|
|
96
96
|
try {
|
|
97
97
|
decoded = decodeURIComponent(url);
|
|
@@ -113,66 +113,66 @@ var extractURLs = (url) => {
|
|
|
113
113
|
};
|
|
114
114
|
|
|
115
115
|
var getFirstPrefixPathname = (result, defaultValue = "/") => {
|
|
116
|
-
if (!
|
|
116
|
+
if (!chunk7C7TQC5J_cjs.isNonEmptyString(defaultValue)) {
|
|
117
117
|
throw new TypeError(
|
|
118
|
-
`Second parameter (\`defaultValue\`) must be of type \`string\` and not an \`empty-string\`, but received: \`${
|
|
118
|
+
`Second parameter (\`defaultValue\`) must be of type \`string\` and not an \`empty-string\`, but received: \`${chunk7C7TQC5J_cjs.getPreciseType(
|
|
119
119
|
defaultValue
|
|
120
|
-
)}\`, with value: \`${
|
|
120
|
+
)}\`, with value: \`${chunkH44QVAZL_cjs.safeStableStringify(defaultValue, {
|
|
121
121
|
keepUndefined: true
|
|
122
122
|
})}\`.`
|
|
123
123
|
);
|
|
124
124
|
}
|
|
125
|
-
if (
|
|
126
|
-
if (!result.every((item) =>
|
|
125
|
+
if (chunk7C7TQC5J_cjs.isArray(result)) {
|
|
126
|
+
if (!result.every((item) => chunk7C7TQC5J_cjs.isString(item))) {
|
|
127
127
|
throw new TypeError(
|
|
128
|
-
`First parameter (\`result\`) must be of type \`string\` or \`array of string\`, but received: \`${
|
|
128
|
+
`First parameter (\`result\`) must be of type \`string\` or \`array of string\`, but received: \`${chunk7C7TQC5J_cjs.getPreciseType(
|
|
129
129
|
result
|
|
130
|
-
)}\`, with value: \`${
|
|
130
|
+
)}\`, with value: \`${chunkH44QVAZL_cjs.safeStableStringify(result, {
|
|
131
131
|
keepUndefined: true
|
|
132
132
|
})}\`.`
|
|
133
133
|
);
|
|
134
134
|
}
|
|
135
135
|
for (const item of result) {
|
|
136
|
-
const normalized =
|
|
136
|
+
const normalized = chunkOCTHWEZK_cjs.normalizePathname(item);
|
|
137
137
|
if (normalized !== "/") {
|
|
138
138
|
return normalized;
|
|
139
139
|
}
|
|
140
140
|
}
|
|
141
|
-
return
|
|
141
|
+
return chunkOCTHWEZK_cjs.normalizePathname(defaultValue);
|
|
142
142
|
}
|
|
143
|
-
if (
|
|
144
|
-
const normalized =
|
|
145
|
-
return normalized !== "/" ? normalized :
|
|
143
|
+
if (chunk7C7TQC5J_cjs.isString(result)) {
|
|
144
|
+
const normalized = chunkOCTHWEZK_cjs.normalizePathname(result);
|
|
145
|
+
return normalized !== "/" ? normalized : chunkOCTHWEZK_cjs.normalizePathname(defaultValue);
|
|
146
146
|
}
|
|
147
|
-
if (!
|
|
147
|
+
if (!chunk7C7TQC5J_cjs.isNil(result)) {
|
|
148
148
|
throw new TypeError(
|
|
149
|
-
`First parameter (\`result\`) must be of type \`string\`, \`array-string\`, \`null\` or \`undefined\`, but received: \`${
|
|
149
|
+
`First parameter (\`result\`) must be of type \`string\`, \`array-string\`, \`null\` or \`undefined\`, but received: \`${chunk7C7TQC5J_cjs.getPreciseType(
|
|
150
150
|
result
|
|
151
151
|
)}\`.`
|
|
152
152
|
);
|
|
153
153
|
}
|
|
154
|
-
return
|
|
154
|
+
return chunkOCTHWEZK_cjs.normalizePathname(defaultValue);
|
|
155
155
|
};
|
|
156
156
|
|
|
157
157
|
var getPrefixPathname = (url, base = null, options = {}) => {
|
|
158
158
|
const errors = [];
|
|
159
|
-
if (!
|
|
159
|
+
if (!chunk7C7TQC5J_cjs.isString(url) && !chunk7C7TQC5J_cjs.isArray(url)) {
|
|
160
160
|
errors.push(
|
|
161
|
-
`First parameter (\`url\`) must be of type \`string\` or \`array-string\`, but received: \`${
|
|
161
|
+
`First parameter (\`url\`) must be of type \`string\` or \`array-string\`, but received: \`${chunk7C7TQC5J_cjs.getPreciseType(
|
|
162
162
|
url
|
|
163
163
|
)}\`.`
|
|
164
164
|
);
|
|
165
165
|
}
|
|
166
|
-
if (!
|
|
166
|
+
if (!chunk7C7TQC5J_cjs.isString(base) && !chunk7C7TQC5J_cjs.isArray(base) && !chunk7C7TQC5J_cjs.isNull(base)) {
|
|
167
167
|
errors.push(
|
|
168
|
-
`Second parameter (\`base\`) must be of type \`string\`, \`array-string\` or \`null\`, but received: \`${
|
|
168
|
+
`Second parameter (\`base\`) must be of type \`string\`, \`array-string\` or \`null\`, but received: \`${chunk7C7TQC5J_cjs.getPreciseType(
|
|
169
169
|
base
|
|
170
170
|
)}\`.`
|
|
171
171
|
);
|
|
172
172
|
}
|
|
173
|
-
if (!
|
|
173
|
+
if (!chunk7C7TQC5J_cjs.isPlainObject(options)) {
|
|
174
174
|
errors.push(
|
|
175
|
-
`Second parameter (\`options\`) must be of type \`plain-object\`, but received: \`${
|
|
175
|
+
`Second parameter (\`options\`) must be of type \`plain-object\`, but received: \`${chunk7C7TQC5J_cjs.getPreciseType(
|
|
176
176
|
options
|
|
177
177
|
)}\`.`
|
|
178
178
|
);
|
|
@@ -180,48 +180,48 @@ var getPrefixPathname = (url, base = null, options = {}) => {
|
|
|
180
180
|
const { levels = 1, removeDuplicates = true } = options;
|
|
181
181
|
if (!chunkDVMHRLKP_cjs.isInteger(levels) || chunkDVMHRLKP_cjs.isInteger(levels) && levels < 0) {
|
|
182
182
|
errors.push(
|
|
183
|
-
`Parameter \`levels\` property of the \`options\` (second parameter) must be of type \`integer-number\` and minimum is \`0\`, but received: \`${
|
|
183
|
+
`Parameter \`levels\` property of the \`options\` (second parameter) must be of type \`integer-number\` and minimum is \`0\`, but received: \`${chunk7C7TQC5J_cjs.getPreciseType(
|
|
184
184
|
levels
|
|
185
|
-
)}\`, with value: \`${
|
|
185
|
+
)}\`, with value: \`${chunkH44QVAZL_cjs.safeStableStringify(levels, {
|
|
186
186
|
keepUndefined: true
|
|
187
187
|
})}\`.`
|
|
188
188
|
);
|
|
189
189
|
}
|
|
190
|
-
if (!
|
|
190
|
+
if (!chunk7C7TQC5J_cjs.isBoolean(removeDuplicates)) {
|
|
191
191
|
errors.push(
|
|
192
|
-
`Parameter \`removeDuplicates\` property of the \`options\` (second parameter) must be of type \`boolean\`, but received: \`${
|
|
192
|
+
`Parameter \`removeDuplicates\` property of the \`options\` (second parameter) must be of type \`boolean\`, but received: \`${chunk7C7TQC5J_cjs.getPreciseType(
|
|
193
193
|
removeDuplicates
|
|
194
194
|
)}\`.`
|
|
195
195
|
);
|
|
196
196
|
}
|
|
197
|
-
if (
|
|
197
|
+
if (chunk7C7TQC5J_cjs.isNonEmptyArray(errors)) {
|
|
198
198
|
throw new TypeError(
|
|
199
199
|
`Invalid parameter(s) in \`getPrefixPathname\` function:
|
|
200
200
|
- ${errors.join("\n- ")}`
|
|
201
201
|
);
|
|
202
202
|
}
|
|
203
203
|
function getLevel(singleUrl) {
|
|
204
|
-
const parts =
|
|
204
|
+
const parts = chunkOCTHWEZK_cjs.normalizePathname(singleUrl).split("/").filter(Boolean);
|
|
205
205
|
return `/${parts.slice(0, levels).join("/")}`;
|
|
206
206
|
}
|
|
207
207
|
function processUrl(singleUrl) {
|
|
208
208
|
if (base) {
|
|
209
|
-
singleUrl =
|
|
210
|
-
if (
|
|
209
|
+
singleUrl = chunkOCTHWEZK_cjs.normalizePathname(singleUrl);
|
|
210
|
+
if (chunk7C7TQC5J_cjs.isArray(base)) {
|
|
211
211
|
for (const b of base) {
|
|
212
|
-
if (singleUrl.startsWith(
|
|
212
|
+
if (singleUrl.startsWith(chunkOCTHWEZK_cjs.normalizePathname(b))) {
|
|
213
213
|
return getLevel(singleUrl);
|
|
214
214
|
}
|
|
215
215
|
}
|
|
216
|
-
} else if (
|
|
216
|
+
} else if (chunk7C7TQC5J_cjs.isNonEmptyString(base) && singleUrl.startsWith(chunkOCTHWEZK_cjs.normalizePathname(base))) {
|
|
217
217
|
return getLevel(singleUrl);
|
|
218
218
|
}
|
|
219
219
|
return null;
|
|
220
220
|
}
|
|
221
221
|
return getLevel(singleUrl);
|
|
222
222
|
}
|
|
223
|
-
if (
|
|
224
|
-
const result = url.map(processUrl).filter((r) => !
|
|
223
|
+
if (chunk7C7TQC5J_cjs.isArray(url)) {
|
|
224
|
+
const result = url.map(processUrl).filter((r) => !chunk7C7TQC5J_cjs.isNull(r));
|
|
225
225
|
const uniqueResult = removeDuplicates ? [...new Set(result)] : result;
|
|
226
226
|
if (uniqueResult.length === 1) {
|
|
227
227
|
return uniqueResult[0];
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* ====================================================
|
|
3
3
|
* Rzl Utils-JS.
|
|
4
4
|
* ----------------------------------------------------
|
|
5
|
-
* Version: 3.
|
|
5
|
+
* Version: 3.9.1.
|
|
6
6
|
* Author: Rizalvin Dwiky.
|
|
7
7
|
* Repository: https://github.com/rzl-zone/utils-js.
|
|
8
8
|
* ====================================================
|
|
@@ -10,27 +10,25 @@
|
|
|
10
10
|
'use strict';
|
|
11
11
|
|
|
12
12
|
var chunkUDA26MCU_cjs = require('./chunk-UDA26MCU.cjs');
|
|
13
|
-
var
|
|
13
|
+
var chunk7C7TQC5J_cjs = require('./chunk-7C7TQC5J.cjs');
|
|
14
14
|
|
|
15
15
|
var assertIsBigInt = (value, options = {}) => {
|
|
16
16
|
if (chunkUDA26MCU_cjs.isBigInt(value)) return;
|
|
17
|
-
|
|
17
|
+
chunk7C7TQC5J_cjs.resolveErrorMessageAssertions({
|
|
18
18
|
value,
|
|
19
19
|
options,
|
|
20
20
|
requiredValidType: "big int"
|
|
21
21
|
});
|
|
22
|
-
throw new TypeError(errorMessage);
|
|
23
22
|
};
|
|
24
23
|
|
|
25
24
|
var assertIsNumber = (value, options = {}) => {
|
|
26
|
-
const includeNaN =
|
|
27
|
-
if (
|
|
28
|
-
|
|
25
|
+
const includeNaN = chunk7C7TQC5J_cjs.hasOwnProp(options, "includeNaN") ? options.includeNaN : void 0;
|
|
26
|
+
if (chunk7C7TQC5J_cjs.isNumber(value, { includeNaN })) return;
|
|
27
|
+
chunk7C7TQC5J_cjs.resolveErrorMessageAssertions({
|
|
29
28
|
value,
|
|
30
29
|
options,
|
|
31
30
|
requiredValidType: "number"
|
|
32
31
|
});
|
|
33
|
-
throw new TypeError(errorMessage);
|
|
34
32
|
};
|
|
35
33
|
|
|
36
34
|
exports.assertIsBigInt = assertIsBigInt;
|