@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.
Files changed (124) hide show
  1. package/README.md +28 -1
  2. package/dist/assertions/index.cjs +11 -11
  3. package/dist/assertions/index.d.ts +169 -58
  4. package/dist/assertions/index.js +5 -5
  5. package/dist/{chunk-EK7FSI7F.cjs → chunk-2XGQQZ6A.cjs} +3 -3
  6. package/dist/{chunk-YS27V6LS.js → chunk-3LE6NX57.js} +5 -176
  7. package/dist/{chunk-PZQC3FZY.js → chunk-44X74C26.js} +4 -4
  8. package/dist/{chunk-4ACKNPL5.js → chunk-5KDVIEVO.js} +2 -2
  9. package/dist/{chunk-JY4HLZ4W.js → chunk-5O66AUEC.js} +2 -2
  10. package/dist/chunk-5Y6JL47L.js +302 -0
  11. package/dist/{chunk-KIYALQQF.cjs → chunk-62FS7WMB.cjs} +35 -35
  12. package/dist/{chunk-VJVCXEH7.cjs → chunk-6AMDHVS2.cjs} +9 -181
  13. package/dist/{chunk-6PKW4WCT.js → chunk-6WVOUVWD.js} +27 -15
  14. package/dist/{chunk-BYUT376O.cjs → chunk-76ATVDCR.cjs} +3 -3
  15. package/dist/{chunk-F3WBQKRI.cjs → chunk-7C7TQC5J.cjs} +29 -7
  16. package/dist/{chunk-QUITZ3GP.js → chunk-7EIFPHV3.js} +32 -16
  17. package/dist/{chunk-6RFNZ2ZZ.cjs → chunk-7NXFGJJE.cjs} +14 -14
  18. package/dist/{chunk-TFDXRT6D.cjs → chunk-ALRISPTL.cjs} +3 -3
  19. package/dist/chunk-BAV5T2E3.cjs +1 -1
  20. package/dist/{chunk-4ZOXSUXB.js → chunk-C7GC2PFX.js} +3 -3
  21. package/dist/chunk-DVMHRLKP.cjs +1 -1
  22. package/dist/{chunk-XFTUHS4Y.js → chunk-DXPM4NOU.js} +10 -8
  23. package/dist/{chunk-DPLL67OT.js → chunk-EJV5AF4L.js} +2 -2
  24. package/dist/{chunk-NREACG6M.cjs → chunk-FWWPEL7J.cjs} +3 -3
  25. package/dist/{chunk-LEX4TQW2.js → chunk-GHU356XQ.js} +4 -6
  26. package/dist/chunk-GKDSBOYE.js +209 -0
  27. package/dist/{chunk-YC7AK3KX.cjs → chunk-H44QVAZL.cjs} +31 -31
  28. package/dist/{chunk-AKKM6MOX.cjs → chunk-I33PB44Q.cjs} +15 -15
  29. package/dist/{chunk-LIU4S3JA.cjs → chunk-IX6PF5ZP.cjs} +4 -4
  30. package/dist/{chunk-3KTD3QDI.js → chunk-J4TT33ZX.js} +29 -7
  31. package/dist/{chunk-SZJ7OI4S.js → chunk-J6VLFVIL.js} +3 -3
  32. package/dist/{chunk-KTQLDIIT.cjs → chunk-JI57K7D4.cjs} +173 -163
  33. package/dist/{chunk-OFBFGFVH.js → chunk-JYOCB6OV.js} +2 -2
  34. package/dist/chunk-KHO2SBNA.cjs +1 -1
  35. package/dist/{chunk-66WLOZOD.cjs → chunk-KUVRZ2JW.cjs} +53 -51
  36. package/dist/chunk-L5RDAVVH.js +1 -1
  37. package/dist/{chunk-VCVND6CH.js → chunk-M5QB2GM5.js} +2 -2
  38. package/dist/{chunk-3LEWQV3R.js → chunk-MBFVTGYS.js} +8 -8
  39. package/dist/{chunk-UKAUXY2U.cjs → chunk-MMRHKYT6.cjs} +12 -12
  40. package/dist/{chunk-U5VR4TJN.js → chunk-MS2KSKD7.js} +9 -9
  41. package/dist/{chunk-7ZNEUWYP.js → chunk-MZ3T6L7Z.js} +2 -2
  42. package/dist/{chunk-ATLFMKAF.cjs → chunk-NAOVH4OH.cjs} +7 -7
  43. package/dist/chunk-NJ24M6ZH.cjs +308 -0
  44. package/dist/chunk-OCTHWEZK.cjs +249 -0
  45. package/dist/chunk-ONZFBJVW.js +1 -1
  46. package/dist/{chunk-FI76UZRF.js → chunk-OSSFLQDD.js} +3 -4
  47. package/dist/{chunk-7WBMA2VE.cjs → chunk-OYFUBKEG.cjs} +4 -5
  48. package/dist/{chunk-B4SDEBN7.cjs → chunk-PWKOFPAH.cjs} +3 -3
  49. package/dist/{chunk-2CQI36UD.cjs → chunk-QGTFQ7RO.cjs} +8 -6
  50. package/dist/chunk-QNKGP5DY.js +1 -1
  51. package/dist/chunk-QXTJVDWE.js +676 -0
  52. package/dist/{chunk-B6UIKBHR.cjs → chunk-QZI5PVCI.cjs} +4 -4
  53. package/dist/{chunk-WNO3EPYT.js → chunk-R2DR7SPJ.js} +102 -26
  54. package/dist/{chunk-TDYGYHSH.js → chunk-SN5HAK3Y.js} +4 -4
  55. package/dist/{chunk-D53CE4BT.js → chunk-SRWL4YCP.js} +11 -8
  56. package/dist/{chunk-7QQV66RX.cjs → chunk-TJ5OY6MC.cjs} +10 -10
  57. package/dist/{chunk-6WMB5AJR.js → chunk-TXOVQZPU.js} +3 -4
  58. package/dist/chunk-UDA26MCU.cjs +1 -1
  59. package/dist/{chunk-R3PBF6F7.cjs → chunk-UFYMRRJH.cjs} +73 -61
  60. package/dist/{chunk-5NN4ZDE2.cjs → chunk-UV5BKAYW.cjs} +6 -8
  61. package/dist/{chunk-GAJBF6DR.js → chunk-UXT4XSUK.js} +2 -2
  62. package/dist/{chunk-TDPYR5JY.js → chunk-VBSLIIDB.js} +24 -14
  63. package/dist/chunk-VCYXNIZ2.cjs +678 -0
  64. package/dist/chunk-VJDDGRIK.cjs +1 -1
  65. package/dist/{chunk-VNADVWSJ.js → chunk-WB3FT62A.js} +6 -4
  66. package/dist/{chunk-K63WO3XA.cjs → chunk-WKM6UVMG.cjs} +4 -5
  67. package/dist/{chunk-OS5OT5JA.cjs → chunk-WLEZ2KSG.cjs} +142 -126
  68. package/dist/{chunk-ZN53RM3R.js → chunk-WRGN6UBK.js} +2 -2
  69. package/dist/chunk-WVSPXFTY.js +1 -1
  70. package/dist/{chunk-2VO2CBTU.js → chunk-X6ULJZ3X.js} +2 -2
  71. package/dist/{chunk-CKUEZF4R.cjs → chunk-XYWC4EQ3.cjs} +71 -71
  72. package/dist/{chunk-A3YI6Y2P.js → chunk-YHFRCVTN.js} +3 -3
  73. package/dist/{chunk-RMJC3B5P.cjs → chunk-YQHJB7KR.cjs} +30 -27
  74. package/dist/{chunk-YGB2BQPB.cjs → chunk-YVRUY4EW.cjs} +8 -8
  75. package/dist/chunk-YWHHVDT4.js +1 -1
  76. package/dist/chunk-ZTHJQJ5F.cjs +211 -0
  77. package/dist/conversions/index.cjs +34 -34
  78. package/dist/conversions/index.d.ts +10 -12
  79. package/dist/conversions/index.js +15 -15
  80. package/dist/events/index.cjs +8 -8
  81. package/dist/events/index.d.ts +9 -9
  82. package/dist/events/index.js +4 -4
  83. package/dist/formatters/index.cjs +19 -19
  84. package/dist/formatters/index.d.ts +19 -24
  85. package/dist/formatters/index.js +9 -9
  86. package/dist/generators/index.cjs +12 -8
  87. package/dist/generators/index.d.ts +155 -26
  88. package/dist/generators/index.js +4 -4
  89. package/dist/index.d.ts +1 -1
  90. package/dist/{isPlainObject-FWmcJF6k.d.ts → isPlainObject-BTPjv6zB.d.ts} +2 -2
  91. package/dist/next/index.cjs +39 -36
  92. package/dist/next/index.d.ts +11 -11
  93. package/dist/next/index.js +12 -9
  94. package/dist/next/server/index.cjs +4 -4
  95. package/dist/next/server/index.d.ts +4 -4
  96. package/dist/next/server/index.js +2 -2
  97. package/dist/operations/index.cjs +11 -11
  98. package/dist/operations/index.d.ts +8 -9
  99. package/dist/operations/index.js +8 -8
  100. package/dist/parsers/index.cjs +6 -4
  101. package/dist/parsers/index.d.ts +224 -32
  102. package/dist/parsers/index.js +5 -3
  103. package/dist/predicates/index.cjs +77 -76
  104. package/dist/predicates/index.d.ts +15 -28
  105. package/dist/predicates/index.js +14 -13
  106. package/dist/promises/index.cjs +6 -6
  107. package/dist/promises/index.d.ts +5 -7
  108. package/dist/promises/index.js +4 -4
  109. package/dist/rzl-utils.global.js +2 -2
  110. package/dist/strings/index.cjs +23 -23
  111. package/dist/strings/index.d.ts +1 -1
  112. package/dist/strings/index.js +7 -7
  113. package/dist/tailwind/index.cjs +13 -13
  114. package/dist/tailwind/index.d.ts +18 -18
  115. package/dist/tailwind/index.js +5 -5
  116. package/dist/urls/index.cjs +23 -21
  117. package/dist/urls/index.d.ts +188 -121
  118. package/dist/urls/index.js +16 -14
  119. package/package.json +1 -1
  120. package/dist/chunk-ABA2ZSBQ.js +0 -152
  121. package/dist/chunk-BG3AS5BU.cjs +0 -173
  122. package/dist/chunk-K3SONK25.cjs +0 -157
  123. package/dist/chunk-KPCDDYTZ.js +0 -417
  124. package/dist/chunk-QAPYHLHC.cjs +0 -419
@@ -2,16 +2,16 @@
2
2
  * ====================================================
3
3
  * Rzl Utils-JS.
4
4
  * ----------------------------------------------------
5
- * Version: 3.7.1.
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 { isValidDomain } from './chunk-YS27V6LS.js';
11
- import { removeSpaces } from './chunk-4ACKNPL5.js';
12
- import { isEmptyString } from './chunk-JY4HLZ4W.js';
13
- import { safeStableStringify } from './chunk-2VO2CBTU.js';
14
- import { assertIsPlainObject, isNonEmptyString, getPreciseType, assertIsBoolean, isNil, isString, isNull, isError, hasOwnProp, isBoolean, isFunction } from './chunk-3KTD3QDI.js';
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,19 +53,68 @@ function normalizePathname(pathname, options = {
53
53
  return `Second parameter (\`options\`) must be of type \`${validType}\`, but received: \`${currentType}\`.`;
54
54
  }
55
55
  });
56
- const { defaultPath = "/", keepNullable = false, keepTrailingSlash = false } = options;
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(
60
66
  defaultPath
61
- )}\`, with value: \`${safeStableStringify(defaultPath)}\`.`
67
+ )}\`, with value: \`${safeStableStringify(defaultPath, {
68
+ keepUndefined: true
69
+ })}\`.`
62
70
  );
63
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
+ });
64
77
  assertIsBoolean(keepTrailingSlash, {
65
78
  message({ currentType, validType }) {
66
79
  return `Parameter \`keepTrailingSlash\` property of the \`options\` (second parameter) must be of type \`${validType}\`, but received: \`${currentType}\`.`;
67
80
  }
68
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
+ }
69
118
  try {
70
119
  if (keepNullable && (isNil(pathname) || !isString(pathname))) {
71
120
  if (isNull(pathname)) return null;
@@ -76,7 +125,11 @@ function normalizePathname(pathname, options = {
76
125
  /\s+/g,
77
126
  ""
78
127
  );
79
- currentPathName = stripLeadingDomain(currentPathName);
128
+ currentPathName = stripLeadingDomain(currentPathName, {
129
+ keepTrailingSlash,
130
+ localhostDomain,
131
+ ignoreDomainExtensions: ignoreDomainExtsSet
132
+ });
80
133
  let _pathName = currentPathName;
81
134
  let search = "";
82
135
  let hash = "";
@@ -105,14 +158,10 @@ function normalizePathname(pathname, options = {
105
158
  hash = decodeUnicodeSequences(hash);
106
159
  return _pathName + search + hash;
107
160
  } catch (error) {
108
- const err = isError(error) ? error : new Error("Unknown error from function `normalizePathname()`.");
109
- throw new NormalizePathnameError(
110
- `Failed to normalize pathname in function \`normalizePathname()\`: ${err.message}`,
111
- err
112
- );
161
+ throwError(error);
113
162
  }
114
163
  }
115
- function decodeUnicodeSequences(str) {
164
+ var decodeUnicodeSequences = (str) => {
116
165
  return str.replace(/(?:%(?:[0-9A-F]{2})){2,}/gi, (match) => {
117
166
  try {
118
167
  const decoded = decodeURIComponent(match);
@@ -122,32 +171,59 @@ function decodeUnicodeSequences(str) {
122
171
  return match;
123
172
  }
124
173
  });
125
- }
126
- function stripLeadingDomain(path) {
174
+ };
175
+ var stripLeadingDomain = (path, options) => {
127
176
  let currentPath = path;
177
+ const { ignoreDomainExtensions, localhostDomain } = options;
128
178
  if (/^https?:\/\//i.test(currentPath)) {
129
179
  try {
130
180
  const url = new URL(currentPath);
131
- currentPath = "/" + url.pathname.replace(/^\/+/, "").replace(/\/{2,}/g, "/") + url.search + url.hash;
132
- } catch {
181
+ currentPath = url.pathname.replace(/^\/+/, "").replace(/\/{2,}/g, "/") + url.search + url.hash;
182
+ return ensureLeadingSlash(currentPath);
183
+ } catch (error) {
184
+ throwError(error);
133
185
  }
134
186
  }
135
187
  if (currentPath.startsWith("/")) {
136
188
  currentPath = currentPath.replace(/\/{2,}/g, "/").slice(1);
137
189
  }
138
- const firstPart = currentPath.split("/")[0];
190
+ const segments = currentPath.split("/");
191
+ const firstPart = segments[0];
139
192
  const domainPart = firstPart.split(":")[0];
140
- if (isValidDomain(domainPart, {
193
+ const isDomain = isValidDomain(domainPart, {
141
194
  subdomain: true,
142
195
  allowUnicode: true,
143
196
  wildcard: true,
197
+ allowLocalhost: localhostDomain,
198
+ allowPort: true,
199
+ allowProtocol: true,
144
200
  topLevel: false
145
- }) || domainPart === "localhost") {
146
- currentPath = currentPath.slice(firstPart.length);
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
+ }
147
210
  }
148
- if (!currentPath.startsWith("/")) currentPath = "/" + currentPath;
149
- return currentPath;
150
- }
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
+ };
151
227
 
152
228
  var formatEnvPort = (envVar, options = {}) => {
153
229
  if (!isNonEmptyString(envVar)) return "";
@@ -2,15 +2,15 @@
2
2
  * ====================================================
3
3
  * Rzl Utils-JS.
4
4
  * ----------------------------------------------------
5
- * Version: 3.7.1.
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 { isFinite } from './chunk-7ZNEUWYP.js';
11
- import { isEmptyArray } from './chunk-VCVND6CH.js';
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-3KTD3QDI.js';
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.7.1.
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 { safeJsonParse } from './chunk-XFTUHS4Y.js';
11
- import { isEqual } from './chunk-SZJ7OI4S.js';
12
- import { isEmptyArray } from './chunk-VCVND6CH.js';
13
- import { assertIsArray } from './chunk-6WMB5AJR.js';
14
- import { safeStableStringify } from './chunk-2VO2CBTU.js';
15
- import { isPlainObject, isNonEmptyArray, isObjectOrArray, isArray, isNaN, isUndefined } from './chunk-3KTD3QDI.js';
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, {
@@ -57,7 +57,10 @@ var omitKeysDeep = (object, keysToOmit) => {
57
57
  if (isNonEmptyArray(duplicates)) {
58
58
  throw new Error(
59
59
  `Function "omitKeysDeep" Error: Duplicate keys detected - \`${safeStableStringify(
60
- duplicates
60
+ duplicates,
61
+ {
62
+ keepUndefined: true
63
+ }
61
64
  )}\`.`
62
65
  );
63
66
  }
@@ -2,15 +2,15 @@
2
2
  * ====================================================
3
3
  * Rzl Utils-JS.
4
4
  * ----------------------------------------------------
5
- * Version: 3.7.1.
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 chunkYC7AK3KX_cjs = require('./chunk-YC7AK3KX.cjs');
13
- var chunkF3WBQKRI_cjs = require('./chunk-F3WBQKRI.cjs');
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 (!chunkF3WBQKRI_cjs.isObjectOrArray(value) || !chunkF3WBQKRI_cjs.isObjectOrArray(other)) {
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 (!chunkF3WBQKRI_cjs.isUndefined(result)) return result;
34
+ if (!chunk7C7TQC5J_cjs.isUndefined(result)) return result;
35
35
  }
36
36
  return baseDeepEqual(v, o, customizer, seen);
37
37
  };
38
- if (chunkYC7AK3KX_cjs.isDate(value) && chunkYC7AK3KX_cjs.isDate(other)) return value.getTime() === other.getTime();
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 (chunkF3WBQKRI_cjs.isError(value) && chunkF3WBQKRI_cjs.isError(other))
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 (chunkYC7AK3KX_cjs.isMap(value) && chunkYC7AK3KX_cjs.isMap(other)) {
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 (chunkF3WBQKRI_cjs.isSet(value) && chunkF3WBQKRI_cjs.isSet(other)) {
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 (chunkF3WBQKRI_cjs.isArray(value) && chunkF3WBQKRI_cjs.isArray(other)) {
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.7.1.
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, resolveErrorMessageAssertions } from './chunk-3KTD3QDI.js';
10
+ import { isArray, resolveErrorMessageAssertions } from './chunk-J4TT33ZX.js';
11
11
 
12
12
  function assertIsArray(value, options) {
13
13
  if (isArray(value)) return;
14
- const errorMessage = resolveErrorMessageAssertions({
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 };
@@ -2,7 +2,7 @@
2
2
  * ====================================================
3
3
  * Rzl Utils-JS.
4
4
  * ----------------------------------------------------
5
- * Version: 3.7.1.
5
+ * Version: 3.9.0.
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.7.1.
5
+ * Version: 3.9.0.
6
6
  * Author: Rizalvin Dwiky.
7
7
  * Repository: https://github.com/rzl-zone/utils-js.
8
8
  * ====================================================
@@ -10,64 +10,70 @@
10
10
  'use strict';
11
11
 
12
12
  var chunkKHO2SBNA_cjs = require('./chunk-KHO2SBNA.cjs');
13
- var chunkBYUT376O_cjs = require('./chunk-BYUT376O.cjs');
14
- var chunkAKKM6MOX_cjs = require('./chunk-AKKM6MOX.cjs');
15
- var chunkUKAUXY2U_cjs = require('./chunk-UKAUXY2U.cjs');
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 chunkBG3AS5BU_cjs = require('./chunk-BG3AS5BU.cjs');
18
- var chunkNREACG6M_cjs = require('./chunk-NREACG6M.cjs');
19
- var chunk7WBMA2VE_cjs = require('./chunk-7WBMA2VE.cjs');
20
- var chunkYC7AK3KX_cjs = require('./chunk-YC7AK3KX.cjs');
21
- var chunkF3WBQKRI_cjs = require('./chunk-F3WBQKRI.cjs');
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 (chunkF3WBQKRI_cjs.isString(baseUrl)) {
25
- if (chunkNREACG6M_cjs.isEmptyString(baseUrl)) {
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 = chunkBYUT376O_cjs.normalizeString(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: \`${chunkF3WBQKRI_cjs.getPreciseType(
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: \`${chunkYC7AK3KX_cjs.safeStableStringify(baseUrl)}\`.`
33
+ )}\`, with current value: \`${chunkH44QVAZL_cjs.safeStableStringify(baseUrl, {
34
+ keepUndefined: true
35
+ })}\`.`
34
36
  );
35
37
  }
36
- if (!chunkF3WBQKRI_cjs.isUndefined(removeParams)) {
37
- chunk7WBMA2VE_cjs.assertIsArray(removeParams, {
38
+ if (!chunk7C7TQC5J_cjs.isUndefined(removeParams)) {
39
+ chunkOYFUBKEG_cjs.assertIsArray(removeParams, {
38
40
  message: ({ currentType, validType }) => `Third parameter (\`removeParams\`) must be of type \`${validType} of strings\`, but received: \`${currentType}\`.`
39
41
  });
40
- if (!removeParams.every((param) => chunkF3WBQKRI_cjs.isNonEmptyString(param))) {
42
+ if (!removeParams.every((param) => chunk7C7TQC5J_cjs.isNonEmptyString(param))) {
41
43
  throw new TypeError(
42
44
  `Third parameter (\`removeParams\`) must be of type \`array\` and contains \`string\` only and non empty-string.`
43
45
  );
44
46
  }
45
47
  }
46
48
  try {
47
- if (!chunkF3WBQKRI_cjs.isUndefined(queryParams) && !chunkF3WBQKRI_cjs.isFunction(queryParams[Symbol.iterator])) {
49
+ if (!chunk7C7TQC5J_cjs.isUndefined(queryParams) && !chunk7C7TQC5J_cjs.isFunction(queryParams[Symbol.iterator])) {
48
50
  throw new TypeError(
49
- `Second parameter (\`queryParams\`) must be iterable (like URLSearchParams.entries() or an array of [[string, string | number]...]), but received: \`${chunkF3WBQKRI_cjs.getPreciseType(
51
+ `Second parameter (\`queryParams\`) must be iterable (like URLSearchParams.entries() or an array of [[string, string | number]...]), but received: \`${chunk7C7TQC5J_cjs.getPreciseType(
50
52
  queryParams
51
- )}\`, with value: \`${chunkYC7AK3KX_cjs.safeStableStringify(queryParams)}\`.`
53
+ )}\`, with value: \`${chunkH44QVAZL_cjs.safeStableStringify(queryParams, {
54
+ keepUndefined: true
55
+ })}\`.`
52
56
  );
53
57
  }
54
58
  const urlInstance = new URL(baseUrl);
55
- if (!chunkF3WBQKRI_cjs.isUndefined(queryParams)) {
59
+ if (!chunk7C7TQC5J_cjs.isUndefined(queryParams)) {
56
60
  const paramObject = Object.fromEntries(queryParams);
57
- if (!chunkUKAUXY2U_cjs.isEmptyValue(paramObject)) {
61
+ if (!chunkMMRHKYT6_cjs.isEmptyValue(paramObject)) {
58
62
  const mergedParams = new URLSearchParams(urlInstance.search);
59
63
  for (const [key, value] of Object.entries(paramObject)) {
60
- if (!chunkF3WBQKRI_cjs.isNonEmptyString(value) && !chunkF3WBQKRI_cjs.isNumber(value, { includeNaN: true })) {
64
+ if (!chunk7C7TQC5J_cjs.isNonEmptyString(value) && !chunk7C7TQC5J_cjs.isNumber(value, { includeNaN: true })) {
61
65
  throw new TypeError(
62
- `Second parameter (\`queryParams\`) must be iterable (like URLSearchParams.entries() or an array of [[string, string | number]...]), but received: \`${chunkF3WBQKRI_cjs.getPreciseType(
66
+ `Second parameter (\`queryParams\`) must be iterable (like URLSearchParams.entries() or an array of [[string, string | number]...]), but received: \`${chunk7C7TQC5J_cjs.getPreciseType(
63
67
  queryParams
64
- )}\`, with value: \`${chunkYC7AK3KX_cjs.safeStableStringify(queryParams)}\`.`
68
+ )}\`, with value: \`${chunkH44QVAZL_cjs.safeStableStringify(queryParams, {
69
+ keepUndefined: true
70
+ })}\`.`
65
71
  );
66
72
  }
67
73
  mergedParams.set(key, String(value));
68
74
  }
69
75
  if (removeParams?.length) {
70
- chunkAKKM6MOX_cjs.toStringArrayUnRecursive(removeParams).map((paramKey) => {
76
+ chunkI33PB44Q_cjs.toStringArrayUnRecursive(removeParams).map((paramKey) => {
71
77
  mergedParams.delete(paramKey);
72
78
  });
73
79
  }
@@ -77,7 +83,7 @@ var constructURL = (baseUrl, queryParams, removeParams) => {
77
83
  removeParams?.forEach((param) => urlInstance.searchParams.delete(param));
78
84
  return urlInstance;
79
85
  } catch (error) {
80
- if (chunkF3WBQKRI_cjs.isError(error)) throw error;
86
+ if (chunk7C7TQC5J_cjs.isError(error)) throw error;
81
87
  throw new Error(
82
88
  "Failed to construct a valid URL in `constructURL()`, Error:" + error
83
89
  );
@@ -85,7 +91,7 @@ var constructURL = (baseUrl, queryParams, removeParams) => {
85
91
  };
86
92
 
87
93
  var extractURLs = (url) => {
88
- if (!chunkF3WBQKRI_cjs.isNonEmptyString(url)) return null;
94
+ if (!chunk7C7TQC5J_cjs.isNonEmptyString(url)) return null;
89
95
  let decoded;
90
96
  try {
91
97
  decoded = decodeURIComponent(url);
@@ -107,62 +113,66 @@ var extractURLs = (url) => {
107
113
  };
108
114
 
109
115
  var getFirstPrefixPathname = (result, defaultValue = "/") => {
110
- if (!chunkF3WBQKRI_cjs.isNonEmptyString(defaultValue)) {
116
+ if (!chunk7C7TQC5J_cjs.isNonEmptyString(defaultValue)) {
111
117
  throw new TypeError(
112
- `Second parameter (\`defaultValue\`) must be of type \`string\` and not an \`empty-string\`, but received: \`${chunkF3WBQKRI_cjs.getPreciseType(
118
+ `Second parameter (\`defaultValue\`) must be of type \`string\` and not an \`empty-string\`, but received: \`${chunk7C7TQC5J_cjs.getPreciseType(
113
119
  defaultValue
114
- )}\`, with value: \`${chunkYC7AK3KX_cjs.safeStableStringify(defaultValue)}\`.`
120
+ )}\`, with value: \`${chunkH44QVAZL_cjs.safeStableStringify(defaultValue, {
121
+ keepUndefined: true
122
+ })}\`.`
115
123
  );
116
124
  }
117
- if (chunkF3WBQKRI_cjs.isArray(result)) {
118
- if (!result.every((item) => chunkF3WBQKRI_cjs.isString(item))) {
125
+ if (chunk7C7TQC5J_cjs.isArray(result)) {
126
+ if (!result.every((item) => chunk7C7TQC5J_cjs.isString(item))) {
119
127
  throw new TypeError(
120
- `First parameter (\`result\`) must be of type \`string\` or \`array of string\`, but received: \`${chunkF3WBQKRI_cjs.getPreciseType(
128
+ `First parameter (\`result\`) must be of type \`string\` or \`array of string\`, but received: \`${chunk7C7TQC5J_cjs.getPreciseType(
121
129
  result
122
- )}\`, with value: \`${chunkYC7AK3KX_cjs.safeStableStringify(result)}\`.`
130
+ )}\`, with value: \`${chunkH44QVAZL_cjs.safeStableStringify(result, {
131
+ keepUndefined: true
132
+ })}\`.`
123
133
  );
124
134
  }
125
135
  for (const item of result) {
126
- const normalized = chunkBG3AS5BU_cjs.normalizePathname(item);
136
+ const normalized = chunkOCTHWEZK_cjs.normalizePathname(item);
127
137
  if (normalized !== "/") {
128
138
  return normalized;
129
139
  }
130
140
  }
131
- return chunkBG3AS5BU_cjs.normalizePathname(defaultValue);
141
+ return chunkOCTHWEZK_cjs.normalizePathname(defaultValue);
132
142
  }
133
- if (chunkF3WBQKRI_cjs.isString(result)) {
134
- const normalized = chunkBG3AS5BU_cjs.normalizePathname(result);
135
- return normalized !== "/" ? normalized : chunkBG3AS5BU_cjs.normalizePathname(defaultValue);
143
+ if (chunk7C7TQC5J_cjs.isString(result)) {
144
+ const normalized = chunkOCTHWEZK_cjs.normalizePathname(result);
145
+ return normalized !== "/" ? normalized : chunkOCTHWEZK_cjs.normalizePathname(defaultValue);
136
146
  }
137
- if (!chunkF3WBQKRI_cjs.isNil(result)) {
147
+ if (!chunk7C7TQC5J_cjs.isNil(result)) {
138
148
  throw new TypeError(
139
- `First parameter (\`result\`) must be of type \`string\`, \`array-string\`, \`null\` or \`undefined\`, but received: \`${chunkF3WBQKRI_cjs.getPreciseType(
149
+ `First parameter (\`result\`) must be of type \`string\`, \`array-string\`, \`null\` or \`undefined\`, but received: \`${chunk7C7TQC5J_cjs.getPreciseType(
140
150
  result
141
151
  )}\`.`
142
152
  );
143
153
  }
144
- return chunkBG3AS5BU_cjs.normalizePathname(defaultValue);
154
+ return chunkOCTHWEZK_cjs.normalizePathname(defaultValue);
145
155
  };
146
156
 
147
157
  var getPrefixPathname = (url, base = null, options = {}) => {
148
158
  const errors = [];
149
- if (!chunkF3WBQKRI_cjs.isString(url) && !chunkF3WBQKRI_cjs.isArray(url)) {
159
+ if (!chunk7C7TQC5J_cjs.isString(url) && !chunk7C7TQC5J_cjs.isArray(url)) {
150
160
  errors.push(
151
- `First parameter (\`url\`) must be of type \`string\` or \`array-string\`, but received: \`${chunkF3WBQKRI_cjs.getPreciseType(
161
+ `First parameter (\`url\`) must be of type \`string\` or \`array-string\`, but received: \`${chunk7C7TQC5J_cjs.getPreciseType(
152
162
  url
153
163
  )}\`.`
154
164
  );
155
165
  }
156
- if (!chunkF3WBQKRI_cjs.isString(base) && !chunkF3WBQKRI_cjs.isArray(base) && !chunkF3WBQKRI_cjs.isNull(base)) {
166
+ if (!chunk7C7TQC5J_cjs.isString(base) && !chunk7C7TQC5J_cjs.isArray(base) && !chunk7C7TQC5J_cjs.isNull(base)) {
157
167
  errors.push(
158
- `Second parameter (\`base\`) must be of type \`string\`, \`array-string\` or \`null\`, but received: \`${chunkF3WBQKRI_cjs.getPreciseType(
168
+ `Second parameter (\`base\`) must be of type \`string\`, \`array-string\` or \`null\`, but received: \`${chunk7C7TQC5J_cjs.getPreciseType(
159
169
  base
160
170
  )}\`.`
161
171
  );
162
172
  }
163
- if (!chunkF3WBQKRI_cjs.isPlainObject(options)) {
173
+ if (!chunk7C7TQC5J_cjs.isPlainObject(options)) {
164
174
  errors.push(
165
- `Second parameter (\`options\`) must be of type \`plain-object\`, but received: \`${chunkF3WBQKRI_cjs.getPreciseType(
175
+ `Second parameter (\`options\`) must be of type \`plain-object\`, but received: \`${chunk7C7TQC5J_cjs.getPreciseType(
166
176
  options
167
177
  )}\`.`
168
178
  );
@@ -170,46 +180,48 @@ var getPrefixPathname = (url, base = null, options = {}) => {
170
180
  const { levels = 1, removeDuplicates = true } = options;
171
181
  if (!chunkDVMHRLKP_cjs.isInteger(levels) || chunkDVMHRLKP_cjs.isInteger(levels) && levels < 0) {
172
182
  errors.push(
173
- `Parameter \`levels\` property of the \`options\` (second parameter) must be of type \`integer-number\` and minimum is \`0\`, but received: \`${chunkF3WBQKRI_cjs.getPreciseType(
183
+ `Parameter \`levels\` property of the \`options\` (second parameter) must be of type \`integer-number\` and minimum is \`0\`, but received: \`${chunk7C7TQC5J_cjs.getPreciseType(
174
184
  levels
175
- )}\`, with value: \`${chunkYC7AK3KX_cjs.safeStableStringify(levels)}\`.`
185
+ )}\`, with value: \`${chunkH44QVAZL_cjs.safeStableStringify(levels, {
186
+ keepUndefined: true
187
+ })}\`.`
176
188
  );
177
189
  }
178
- if (!chunkF3WBQKRI_cjs.isBoolean(removeDuplicates)) {
190
+ if (!chunk7C7TQC5J_cjs.isBoolean(removeDuplicates)) {
179
191
  errors.push(
180
- `Parameter \`removeDuplicates\` property of the \`options\` (second parameter) must be of type \`boolean\`, but received: \`${chunkF3WBQKRI_cjs.getPreciseType(
192
+ `Parameter \`removeDuplicates\` property of the \`options\` (second parameter) must be of type \`boolean\`, but received: \`${chunk7C7TQC5J_cjs.getPreciseType(
181
193
  removeDuplicates
182
194
  )}\`.`
183
195
  );
184
196
  }
185
- if (chunkF3WBQKRI_cjs.isNonEmptyArray(errors)) {
197
+ if (chunk7C7TQC5J_cjs.isNonEmptyArray(errors)) {
186
198
  throw new TypeError(
187
199
  `Invalid parameter(s) in \`getPrefixPathname\` function:
188
200
  - ${errors.join("\n- ")}`
189
201
  );
190
202
  }
191
203
  function getLevel(singleUrl) {
192
- const parts = chunkBG3AS5BU_cjs.normalizePathname(singleUrl).split("/").filter(Boolean);
204
+ const parts = chunkOCTHWEZK_cjs.normalizePathname(singleUrl).split("/").filter(Boolean);
193
205
  return `/${parts.slice(0, levels).join("/")}`;
194
206
  }
195
207
  function processUrl(singleUrl) {
196
208
  if (base) {
197
- singleUrl = chunkBG3AS5BU_cjs.normalizePathname(singleUrl);
198
- if (chunkF3WBQKRI_cjs.isArray(base)) {
209
+ singleUrl = chunkOCTHWEZK_cjs.normalizePathname(singleUrl);
210
+ if (chunk7C7TQC5J_cjs.isArray(base)) {
199
211
  for (const b of base) {
200
- if (singleUrl.startsWith(chunkBG3AS5BU_cjs.normalizePathname(b))) {
212
+ if (singleUrl.startsWith(chunkOCTHWEZK_cjs.normalizePathname(b))) {
201
213
  return getLevel(singleUrl);
202
214
  }
203
215
  }
204
- } else if (chunkF3WBQKRI_cjs.isNonEmptyString(base) && singleUrl.startsWith(chunkBG3AS5BU_cjs.normalizePathname(base))) {
216
+ } else if (chunk7C7TQC5J_cjs.isNonEmptyString(base) && singleUrl.startsWith(chunkOCTHWEZK_cjs.normalizePathname(base))) {
205
217
  return getLevel(singleUrl);
206
218
  }
207
219
  return null;
208
220
  }
209
221
  return getLevel(singleUrl);
210
222
  }
211
- if (chunkF3WBQKRI_cjs.isArray(url)) {
212
- const result = url.map(processUrl).filter((r) => !chunkF3WBQKRI_cjs.isNull(r));
223
+ if (chunk7C7TQC5J_cjs.isArray(url)) {
224
+ const result = url.map(processUrl).filter((r) => !chunk7C7TQC5J_cjs.isNull(r));
213
225
  const uniqueResult = removeDuplicates ? [...new Set(result)] : result;
214
226
  if (uniqueResult.length === 1) {
215
227
  return uniqueResult[0];