@rzl-zone/utils-js 3.10.0 → 3.11.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (122) hide show
  1. package/README.md +131 -129
  2. package/dist/assertions/index.cjs +11 -11
  3. package/dist/assertions/index.d.ts +487 -215
  4. package/dist/assertions/index.js +5 -5
  5. package/dist/{chunk-SN5HAK3Y.js → chunk-22V4WP3H.js} +4 -4
  6. package/dist/{chunk-EJV5AF4L.js → chunk-2XSZ2ANI.js} +2 -2
  7. package/dist/{chunk-OSSFLQDD.js → chunk-3T6VSWYX.js} +2 -2
  8. package/dist/{chunk-3LE6NX57.js → chunk-5WIEDF2J.js} +4 -4
  9. package/dist/{chunk-WLEZ2KSG.cjs → chunk-6EDFZJZ5.cjs} +126 -126
  10. package/dist/{chunk-GHU356XQ.js → chunk-6LXWT2I5.js} +3 -3
  11. package/dist/{chunk-GKDSBOYE.js → chunk-6YGBRENU.js} +3 -3
  12. package/dist/{chunk-NAOVH4OH.cjs → chunk-7FGNVDEV.cjs} +7 -7
  13. package/dist/{chunk-X6ULJZ3X.js → chunk-AXDYWO67.js} +2 -2
  14. package/dist/{chunk-UV5BKAYW.cjs → chunk-B6PMNZ4M.cjs} +7 -7
  15. package/dist/chunk-BAV5T2E3.cjs +1 -1
  16. package/dist/{chunk-YHFRCVTN.js → chunk-BLF7SD66.js} +3 -3
  17. package/dist/{chunk-QZI5PVCI.cjs → chunk-BMZZXZJ2.cjs} +4 -4
  18. package/dist/{chunk-DXPM4NOU.js → chunk-BOYP3ARU.js} +4 -4
  19. package/dist/{chunk-UXT4XSUK.js → chunk-BPYW5YL7.js} +2 -2
  20. package/dist/{chunk-QGTFQ7RO.cjs → chunk-C2PV3VWC.cjs} +6 -6
  21. package/dist/{chunk-MZ3T6L7Z.js → chunk-CCJ2MSN7.js} +2 -2
  22. package/dist/{chunk-H44QVAZL.cjs → chunk-DAPAK2W3.cjs} +31 -31
  23. package/dist/{chunk-OYFUBKEG.cjs → chunk-DLS3G6WQ.cjs} +4 -4
  24. package/dist/{chunk-MS2KSKD7.js → chunk-DNMCR5JH.js} +9 -9
  25. package/dist/chunk-DVMHRLKP.cjs +1 -1
  26. package/dist/{chunk-IX6PF5ZP.cjs → chunk-EBYFYZW4.cjs} +4 -4
  27. package/dist/{chunk-5Y6JL47L.js → chunk-ENMRZ4BE.js} +3 -3
  28. package/dist/{chunk-7EIFPHV3.js → chunk-FJ4BQFVO.js} +8 -8
  29. package/dist/{chunk-TJ5OY6MC.cjs → chunk-GIKL4PUF.cjs} +10 -10
  30. package/dist/{chunk-M5QB2GM5.js → chunk-GOFINGT6.js} +2 -2
  31. package/dist/{chunk-J6VLFVIL.js → chunk-GXKQ3LHF.js} +3 -3
  32. package/dist/{chunk-5KDVIEVO.js → chunk-HNBRGN4R.js} +2 -2
  33. package/dist/{chunk-OCTHWEZK.cjs → chunk-HYN6FC5A.cjs} +34 -34
  34. package/dist/{chunk-MBFVTGYS.js → chunk-IZGVBYFN.js} +4 -4
  35. package/dist/{chunk-QXTJVDWE.js → chunk-JIE447J5.js} +3 -3
  36. package/dist/{chunk-UFYMRRJH.cjs → chunk-JXEIJM5M.cjs} +61 -61
  37. package/dist/{chunk-WB3FT62A.js → chunk-K47GZDBH.js} +3 -3
  38. package/dist/{chunk-KUVRZ2JW.cjs → chunk-K5536YHG.cjs} +50 -50
  39. package/dist/chunk-KHO2SBNA.cjs +1 -1
  40. package/dist/{chunk-NJ24M6ZH.cjs → chunk-KXJ7X325.cjs} +37 -37
  41. package/dist/chunk-L5RDAVVH.js +1 -1
  42. package/dist/{chunk-SRWL4YCP.js → chunk-LJHPTLWB.js} +7 -7
  43. package/dist/{chunk-6AMDHVS2.cjs → chunk-M7ELWZXM.cjs} +9 -9
  44. package/dist/chunk-MSUW5VHZ.js +1590 -0
  45. package/dist/{chunk-2XGQQZ6A.cjs → chunk-MUHRPRR7.cjs} +3 -3
  46. package/dist/{chunk-XYWC4EQ3.cjs → chunk-MV3TSQSH.cjs} +71 -71
  47. package/dist/{chunk-VCYXNIZ2.cjs → chunk-NLZLXWAU.cjs} +9 -9
  48. package/dist/{chunk-76ATVDCR.cjs → chunk-NVRZPF5M.cjs} +3 -3
  49. package/dist/chunk-ONZFBJVW.js +1 -1
  50. package/dist/{chunk-62FS7WMB.cjs → chunk-PGNL7JXO.cjs} +31 -31
  51. package/dist/{chunk-JI57K7D4.cjs → chunk-Q4GEQS7X.cjs} +161 -161
  52. package/dist/chunk-QNKGP5DY.js +1 -1
  53. package/dist/{chunk-ZTHJQJ5F.cjs → chunk-QYI2VJLS.cjs} +9 -9
  54. package/dist/{chunk-C7GC2PFX.js → chunk-RBWZII5I.js} +3 -3
  55. package/dist/{chunk-MMRHKYT6.cjs → chunk-RMP7VMPB.cjs} +12 -12
  56. package/dist/{chunk-TXOVQZPU.js → chunk-RZOGBYIS.js} +2 -2
  57. package/dist/{chunk-ALRISPTL.cjs → chunk-SU3UELUB.cjs} +3 -3
  58. package/dist/chunk-SYHPSOUU.cjs +1626 -0
  59. package/dist/{chunk-R2DR7SPJ.js → chunk-SZUNAEMR.js} +6 -6
  60. package/dist/{chunk-YVRUY4EW.cjs → chunk-TER22LO4.cjs} +8 -8
  61. package/dist/{chunk-WRGN6UBK.js → chunk-TJHGRQ4P.js} +2 -2
  62. package/dist/{chunk-I33PB44Q.cjs → chunk-U23I7JPB.cjs} +15 -15
  63. package/dist/{chunk-VBSLIIDB.js → chunk-U7HHN47R.js} +10 -10
  64. package/dist/chunk-UDA26MCU.cjs +1 -1
  65. package/dist/{chunk-44X74C26.js → chunk-UIAWUZ4H.js} +4 -4
  66. package/dist/{chunk-5O66AUEC.js → chunk-ULQPCIA2.js} +2 -2
  67. package/dist/chunk-VJDDGRIK.cjs +1 -1
  68. package/dist/{chunk-6WVOUVWD.js → chunk-WETQI6HM.js} +9 -9
  69. package/dist/{chunk-FWWPEL7J.cjs → chunk-WLOQQFDS.cjs} +3 -3
  70. package/dist/chunk-WVSPXFTY.js +1 -1
  71. package/dist/{chunk-WKM6UVMG.cjs → chunk-WXFTVXBF.cjs} +4 -4
  72. package/dist/{chunk-YQHJB7KR.cjs → chunk-XPVTIGU2.cjs} +26 -26
  73. package/dist/{chunk-PWKOFPAH.cjs → chunk-XX6RUGTM.cjs} +3 -3
  74. package/dist/chunk-YWHHVDT4.js +1 -1
  75. package/dist/{chunk-7NXFGJJE.cjs → chunk-ZPDMWDGZ.cjs} +14 -14
  76. package/dist/{chunk-JYOCB6OV.js → chunk-ZVWZEGQP.js} +2 -2
  77. package/dist/conversions/index.cjs +34 -34
  78. package/dist/conversions/index.d.ts +489 -333
  79. package/dist/conversions/index.js +15 -15
  80. package/dist/events/index.cjs +8 -8
  81. package/dist/events/index.d.ts +35 -29
  82. package/dist/events/index.js +4 -4
  83. package/dist/formatters/index.cjs +19 -19
  84. package/dist/formatters/index.d.ts +917 -873
  85. package/dist/formatters/index.js +9 -9
  86. package/dist/generators/index.cjs +9 -9
  87. package/dist/generators/index.d.ts +104 -86
  88. package/dist/generators/index.js +4 -4
  89. package/dist/index.d.ts +1 -1
  90. package/dist/isPlainObject-0p3VveWr.d.ts +534 -0
  91. package/dist/next/index.cjs +37 -37
  92. package/dist/next/index.d.ts +36 -21
  93. package/dist/next/index.js +9 -9
  94. package/dist/next/server/index.cjs +4 -4
  95. package/dist/next/server/index.d.ts +6 -3
  96. package/dist/next/server/index.js +2 -2
  97. package/dist/operations/index.cjs +11 -11
  98. package/dist/operations/index.d.ts +14 -5
  99. package/dist/operations/index.js +8 -8
  100. package/dist/parsers/index.cjs +6 -6
  101. package/dist/parsers/index.d.ts +68 -65
  102. package/dist/parsers/index.js +5 -5
  103. package/dist/predicates/index.cjs +77 -77
  104. package/dist/predicates/index.d.ts +442 -258
  105. package/dist/predicates/index.js +14 -14
  106. package/dist/promises/index.cjs +6 -6
  107. package/dist/promises/index.d.ts +28 -16
  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 +82 -54
  112. package/dist/strings/index.js +7 -7
  113. package/dist/tailwind/index.cjs +13 -13
  114. package/dist/tailwind/index.d.ts +186 -169
  115. package/dist/tailwind/index.js +5 -5
  116. package/dist/urls/index.cjs +23 -23
  117. package/dist/urls/index.d.ts +252 -229
  118. package/dist/urls/index.js +16 -16
  119. package/package.json +6 -4
  120. package/dist/chunk-7C7TQC5J.cjs +0 -620
  121. package/dist/chunk-J4TT33ZX.js +0 -584
  122. package/dist/isPlainObject-BTPjv6zB.d.ts +0 -178
@@ -0,0 +1,1626 @@
1
+ /*!
2
+ * ====================================================
3
+ * Rzl Utils-JS.
4
+ * ----------------------------------------------------
5
+ * Version: 3.11.1.
6
+ * Author: Rizalvin Dwiky.
7
+ * Repository: https://github.com/rzl-zone/utils-js.
8
+ * ====================================================
9
+ */
10
+ 'use strict';
11
+
12
+ var isBoolean = (value) => {
13
+ return typeof value === "boolean";
14
+ };
15
+
16
+ var isFunction = (value) => {
17
+ return typeof value === "function";
18
+ };
19
+
20
+ function isNil(value) {
21
+ return value == null;
22
+ }
23
+
24
+ function isArray(value) {
25
+ return Array.isArray(value);
26
+ }
27
+
28
+ function isObject(value) {
29
+ return typeof value === "object" && !isNil(value) && !isArray(value);
30
+ }
31
+
32
+ function isPlainObject(value) {
33
+ if (!isObject(value)) return false;
34
+ const proto = Object.getPrototypeOf(value);
35
+ return proto === Object.prototype || proto === null;
36
+ }
37
+
38
+ var isString = (value) => {
39
+ return typeof value === "string";
40
+ };
41
+
42
+ function isNumberObject(value) {
43
+ return isObject(value) && Object.prototype.toString.call(value) === "[object Number]";
44
+ }
45
+
46
+ function isNaN(value) {
47
+ return typeof value === "number" ? Number.isNaN(value) : isNumberObject(value) && Number.isNaN(value.valueOf());
48
+ }
49
+
50
+ var isNull = (val) => val === null;
51
+
52
+ var assertIsBoolean = (value, options = {}) => {
53
+ if (isBoolean(value)) return;
54
+ resolveErrorMessageAssertions({
55
+ value,
56
+ options,
57
+ requiredValidType: "boolean"
58
+ });
59
+ };
60
+
61
+ var isNumber = (value, options = {}) => {
62
+ assertIsPlainObject(options, {
63
+ message: ({ currentType, validType }) => `Second parameter (\`options\`) must be of type \`${validType}\`, but received: \`${currentType}\`.`
64
+ });
65
+ const includeNaN = isPlainObject(options) && isBoolean(options.includeNaN) ? options.includeNaN : false;
66
+ assertIsBoolean(includeNaN, {
67
+ message: ({ currentType, validType }) => `Parameter \`includeNaN\` property of the \`options\` (second parameter) must be of type \`${validType}\`, but received: \`${currentType}\`.`
68
+ });
69
+ const aNumber = typeof value === "number";
70
+ return includeNaN ? aNumber : aNumber && !Number.isNaN(value);
71
+ };
72
+
73
+ var isSymbol = (value) => {
74
+ return typeof value === "symbol";
75
+ };
76
+
77
+ var isUndefined = (value) => {
78
+ return typeof value === "undefined";
79
+ };
80
+
81
+ function isObjectOrArray(value) {
82
+ return isArray(value) || isObject(value);
83
+ }
84
+
85
+ function hasOwnProp(obj, key, options = {}) {
86
+ if (!isString(obj) && !isObjectOrArray(obj) && !isFunction(obj)) return false;
87
+ assertIsPlainObject(options, {
88
+ message: ({ currentType, validType }) => `Third parameter (\`options\`) must be of type \`${validType}\`, but received: \`${currentType}\`.`
89
+ });
90
+ const discardUndefined = options.discardUndefined === void 0 ? true : options.discardUndefined;
91
+ const discardNull = options.discardNull === void 0 ? false : options.discardNull;
92
+ assertIsBoolean(discardUndefined, {
93
+ message: ({ currentType, validType }) => `Parameter \`discardUndefined\` property of the \`options\` (third parameter) must be of type \`${validType}\`, but received: \`${currentType}\`.`
94
+ });
95
+ assertIsBoolean(discardNull, {
96
+ message: ({ currentType, validType }) => `Parameter \`discardNull\` property of the \`options\` (third parameter) must be of type \`${validType}\`, but received: \`${currentType}\`.`
97
+ });
98
+ const path = [];
99
+ if (isString(key) && key.trim().length > 0 || isNumber(key, { includeNaN: true })) {
100
+ const strKey = isNumber(key, { includeNaN: true }) ? String(key) : key;
101
+ strKey.split(".").forEach((k) => {
102
+ const bracketMatch = k.match(/^\[(\d+)\]$/);
103
+ const symbolMatch = k.match(/^Symbol\((.+)\)$/);
104
+ if (bracketMatch) path.push(Number(bracketMatch[1]));
105
+ else if (symbolMatch) path.push(Symbol.for(symbolMatch[1]));
106
+ else if (!isNaN(Number(k))) path.push(Number(k));
107
+ else path.push(k);
108
+ });
109
+ } else if (isSymbol(key)) {
110
+ path.push(key);
111
+ } else {
112
+ return false;
113
+ }
114
+ let current = isString(obj) && obj.trim().length > 0 ? Object(obj) : obj;
115
+ for (const k of path) {
116
+ if (isString(k) && k.trim().length > 0 || isNumber(k, { includeNaN: true })) {
117
+ if (isNull(current) || !Object.prototype.hasOwnProperty.call(current, k)) {
118
+ return false;
119
+ }
120
+ current = current[k];
121
+ } else if (isSymbol(k)) {
122
+ if (isNull(current) || typeof current !== "object" && !isFunction(current)) {
123
+ return false;
124
+ }
125
+ const symbols = Object.getOwnPropertySymbols(current);
126
+ const matched = symbols.find((s) => s === k || s.description === k.description);
127
+ if (!matched) return false;
128
+ current = current[matched];
129
+ } else {
130
+ return false;
131
+ }
132
+ }
133
+ if (discardUndefined && isUndefined(current)) return false;
134
+ if (discardNull && isNull(current)) return false;
135
+ return true;
136
+ }
137
+
138
+ var isNonEmptyString = (value, options = {}) => {
139
+ if (!isString(value)) return false;
140
+ assertIsPlainObject(options, {
141
+ message: ({ currentType, validType }) => `Second parameter (\`options\`) must be of type \`${validType}\`, but received: \`${currentType}\`.`
142
+ });
143
+ const trim = hasOwnProp(options, "trim") ? options.trim : true;
144
+ assertIsBoolean(trim, {
145
+ message: ({ currentType, validType }) => `Parameter \`trim\` property of the \`options\` (second parameter) must be of type \`${validType}\`, but received: \`${currentType}\`.`
146
+ });
147
+ const str = trim ? value.trim() : value;
148
+ return str.length > 0;
149
+ };
150
+
151
+ var isError = (error) => {
152
+ return Object.prototype.toString.call(error) === "[object Error]" || error instanceof Error;
153
+ };
154
+
155
+ var isBuffer = (value) => {
156
+ return typeof Buffer !== "undefined" && typeof Buffer.isBuffer === "function" && Buffer.isBuffer(value);
157
+ };
158
+
159
+ function isStringObject(value) {
160
+ return isObject(value) && Object.prototype.toString.call(value) === "[object String]";
161
+ }
162
+
163
+ function isBooleanObject(value) {
164
+ return isObject(value) && Object.prototype.toString.call(value) === "[object Boolean]";
165
+ }
166
+
167
+ function isInfinityNumber(value) {
168
+ if (typeof value === "number" || isNumberObject(value)) {
169
+ const num = Number(value);
170
+ return num === Infinity || num === -Infinity;
171
+ }
172
+ return false;
173
+ }
174
+
175
+ function isNonEmptyArray(value) {
176
+ return Array.isArray(value) && value.length > 0;
177
+ }
178
+
179
+ function isSet(value) {
180
+ return Object.prototype.toString.call(value) === "[object Set]" || value instanceof Set;
181
+ }
182
+
183
+ var validateCaseInputWordsCase = (input) => {
184
+ let result = "";
185
+ if (isArray(input)) {
186
+ result = input.map((x) => isNonEmptyString(x) ? x.trim() : "").filter((x) => x.length).join("-");
187
+ } else if (isNonEmptyString(input)) {
188
+ result = input.trim();
189
+ }
190
+ return result.split(/[^\p{L}\p{N}]+/u).filter(Boolean);
191
+ };
192
+ var validateCaseIgnoreWordsCase = (ignoreWord) => {
193
+ const result = /* @__PURE__ */ new Set([]);
194
+ const normalizeWord = (word) => word.trim().split(/[^\p{L}\p{N}]+/u).filter(Boolean).join("");
195
+ if (isNonEmptyString(ignoreWord)) {
196
+ const clean = normalizeWord(ignoreWord);
197
+ if (clean) result.add(clean);
198
+ }
199
+ if (isNonEmptyArray(ignoreWord)) {
200
+ ignoreWord.forEach((w) => {
201
+ if (isNonEmptyString(w)) {
202
+ const clean = normalizeWord(w);
203
+ if (clean) result.add(clean);
204
+ }
205
+ });
206
+ }
207
+ if (isSet(ignoreWord)) {
208
+ ignoreWord.forEach((w) => {
209
+ if (isNonEmptyString(w)) {
210
+ const clean = normalizeWord(w);
211
+ if (clean) result.add(clean);
212
+ }
213
+ });
214
+ }
215
+ return result;
216
+ };
217
+
218
+ var slugify = (input, ignoreWord) => {
219
+ if (!isNonEmptyArray(input) && !isNonEmptyString(input)) return "";
220
+ const wordsValidated = validateCaseInputWordsCase(input);
221
+ const ignoreWordsValidated = validateCaseIgnoreWordsCase(ignoreWord);
222
+ const slug = wordsValidated.map((word) => {
223
+ if (ignoreWordsValidated.has(word)) return word;
224
+ return word.toLowerCase();
225
+ }).join("-");
226
+ return slug.replace(/^-+|-+$/g, "");
227
+ };
228
+
229
+ var toDotCase = (input, ignoreWord) => {
230
+ if (!isNonEmptyArray(input) && !isNonEmptyString(input)) return "";
231
+ const wordsValidated = validateCaseInputWordsCase(input);
232
+ const ignoreWordsValidated = validateCaseIgnoreWordsCase(ignoreWord);
233
+ return wordsValidated.map((word) => {
234
+ if (ignoreWordsValidated.has(word)) return word;
235
+ return word.toLowerCase();
236
+ }).join(".");
237
+ };
238
+
239
+ var toCamelCase = (input, ignoreWord) => {
240
+ if (!isNonEmptyArray(input) && !isNonEmptyString(input)) return "";
241
+ const wordsValidated = validateCaseInputWordsCase(input);
242
+ const ignoreWordsValidated = validateCaseIgnoreWordsCase(ignoreWord);
243
+ return wordsValidated.map((word, index) => {
244
+ if (ignoreWordsValidated.has(word)) return word;
245
+ return index === 0 ? word.toLowerCase() : word.charAt(0).toUpperCase() + word.slice(1).toLowerCase();
246
+ }).join("");
247
+ };
248
+
249
+ var toKebabCase = (input, ignoreWord) => {
250
+ if (!isNonEmptyArray(input) && !isNonEmptyString(input)) return "";
251
+ const wordsValidated = validateCaseInputWordsCase(input);
252
+ const ignoreWordsValidated = validateCaseIgnoreWordsCase(ignoreWord);
253
+ return wordsValidated.map((word) => {
254
+ if (ignoreWordsValidated.has(word)) return word;
255
+ return word.toLowerCase();
256
+ }).join("-");
257
+ };
258
+
259
+ var toSnakeCase = (input, ignoreWord) => {
260
+ if (!isNonEmptyArray(input) && !isNonEmptyString(input)) return "";
261
+ const wordsValidated = validateCaseInputWordsCase(input);
262
+ const ignoreWordsValidated = validateCaseIgnoreWordsCase(ignoreWord);
263
+ return wordsValidated.map((word) => {
264
+ if (ignoreWordsValidated.has(word)) return word;
265
+ return word.toLowerCase();
266
+ }).join("_");
267
+ };
268
+
269
+ var toLowerCase = (input, ignoreWord) => {
270
+ if (!isNonEmptyArray(input) && !isNonEmptyString(input)) return "";
271
+ const wordsValidated = validateCaseInputWordsCase(input);
272
+ const ignoreWordsValidated = validateCaseIgnoreWordsCase(ignoreWord);
273
+ return wordsValidated.map((word) => {
274
+ if (ignoreWordsValidated.has(word)) return word;
275
+ return word.toLowerCase();
276
+ }).join(" ");
277
+ };
278
+
279
+ var toPascalCase = (input, ignoreWord) => {
280
+ if (!isNonEmptyArray(input) && !isNonEmptyString(input)) return "";
281
+ const wordsValidated = validateCaseInputWordsCase(input);
282
+ const ignoreWordsValidated = validateCaseIgnoreWordsCase(ignoreWord);
283
+ return wordsValidated.map((word) => {
284
+ if (ignoreWordsValidated.has(word)) return word;
285
+ return word.charAt(0).toUpperCase() + word.slice(1).toLowerCase();
286
+ }).join("");
287
+ };
288
+
289
+ var toPascalCaseSpace = (input, ignoreWord) => {
290
+ if (!isNonEmptyArray(input) && !isNonEmptyString(input)) return "";
291
+ const wordsValidated = validateCaseInputWordsCase(input);
292
+ const ignoreWordsValidated = validateCaseIgnoreWordsCase(ignoreWord);
293
+ return wordsValidated.map((word) => {
294
+ if (ignoreWordsValidated.has(word)) return word;
295
+ return word.charAt(0).toUpperCase() + word.slice(1).toLowerCase();
296
+ }).join(" ");
297
+ };
298
+
299
+ var PreciseType = class _PreciseType {
300
+ /** ----------------------------------------------------------
301
+ * * ***Mapping table of JavaScript built-in and environment-specific types.***
302
+ * ----------------------------------------------------------
303
+ * - **Behavior:**
304
+ * - Maps internal or native type identifiers to **human-readable names** (usually PascalCase).
305
+ * - Keys are normalized to lowercase and stripped of spaces, dashes, or underscores.
306
+ * - Extend or modify entries to match your environment or platform.
307
+ *
308
+ * - **⚠️ Internal:**
309
+ * - Used internally by {@link getPreciseType | `getPreciseType`}.
310
+ * - Not intended for direct use in application code.
311
+ *
312
+ * @internal
313
+ */
314
+ static FIXES_RAW = Object.freeze({
315
+ // primitives
316
+ string: "String",
317
+ number: "Number",
318
+ boolean: "Boolean",
319
+ bigint: "Bigint",
320
+ symbol: "Symbol",
321
+ undefined: "Undefined",
322
+ null: "Null",
323
+ regexp: "Reg Exp",
324
+ // reflect / proxy / atomics
325
+ reflect: "Reflect",
326
+ proxy: "Proxy",
327
+ atomics: "Atomics",
328
+ // core / objects
329
+ array: "Array",
330
+ object: "Object",
331
+ function: "Function",
332
+ arguments: "Arguments",
333
+ // functions
334
+ asyncfunction: "Async Function",
335
+ generatorfunction: "Generator Function",
336
+ asyncgeneratorfunction: "Async Generator Function",
337
+ generator: "Generator",
338
+ promise: "Promise",
339
+ // errors
340
+ evalerror: "Eval Error",
341
+ rangeerror: "Range Error",
342
+ referenceerror: "Reference Error",
343
+ syntaxerror: "Syntax Error",
344
+ typeerror: "Type Error",
345
+ urierror: "URI Error",
346
+ aggregateerror: "Aggregate Error",
347
+ error: "Error",
348
+ // typed arrays & binary
349
+ int8array: "Int 8 Array",
350
+ uint8array: "Uint 8 Array",
351
+ uint8clampedarray: "Uint 8 Clamped Array",
352
+ int16array: "Int 16 Array",
353
+ uint16array: "Uint 16 Array",
354
+ int32array: "Int 32 Array",
355
+ uint32array: "Uint 32 Array",
356
+ float32array: "Float 32 Array",
357
+ float64array: "Float 64 Array",
358
+ bigint64array: "Big Int 64 Array",
359
+ biguint64array: "Big Uint 64 Array",
360
+ arraybuffer: "Array Buffer",
361
+ sharedarraybuffer: "Shared Array Buffer",
362
+ dataview: "Data View",
363
+ arraybufferview: "Array Buffer View",
364
+ // collections
365
+ map: "Map",
366
+ set: "Set",
367
+ weakmap: "Weak Map",
368
+ weakset: "Weak Set",
369
+ // iterators (note: toString tag can be "Map Iterator" etc.)
370
+ mapiterator: "Map Iterator",
371
+ weakmapiterator: "Weak Map Iterator",
372
+ setiterator: "Set Iterator",
373
+ weaksetiterator: "Weak Set Iterator",
374
+ arrayiterator: "Array Iterator",
375
+ stringiterator: "String Iterator",
376
+ asynciterator: "Async Iterator",
377
+ iteratorresult: "Iterator Result",
378
+ arrayiteratorresult: "Array Iterator Result",
379
+ // streams / fetch / web
380
+ readablestream: "Readable Stream",
381
+ writablestream: "Writable Stream",
382
+ transformstream: "Transform Stream",
383
+ readablestreamdefaultreader: "Readable Stream Default Reader",
384
+ writablestreamdefaultwriter: "Writable Stream Default Writer",
385
+ readablestreamdefaultcontroller: "Readable Stream Default Controller",
386
+ transformstreamdefaultcontroller: "Transform Stream Default Controller",
387
+ abortcontroller: "Abort Controller",
388
+ abortsignal: "Abort Signal",
389
+ fetch: "fetch",
390
+ request: "Request",
391
+ response: "Response",
392
+ headers: "Headers",
393
+ formdata: "FormData",
394
+ blob: "Blob",
395
+ file: "File",
396
+ filelist: "FileList",
397
+ filereader: "FileReader",
398
+ // intl
399
+ intl: "Intl",
400
+ collator: "Intl. Collator",
401
+ datetimeformat: "Intl. Date Time Format",
402
+ displaynames: "Intl. Display Names",
403
+ listformat: "Intl. List Format",
404
+ locale: "Intl. Locale",
405
+ numberformat: "Intl. Number Format",
406
+ pluralrules: "Intl. Plural Rules",
407
+ relativetimeformat: "Intl. Relative Time Format",
408
+ segmenter: "Intl. Segmenter",
409
+ // es2021+
410
+ weakref: "Weak Ref",
411
+ urlpattern: "URLPattern",
412
+ structuredclone: "structured Clone",
413
+ finalizationregistry: "Finalization Registry",
414
+ // performance / observers
415
+ performance: "Performance",
416
+ performanceobserver: "Performance Observer",
417
+ performanceentry: "Performance Entry",
418
+ performancemark: "Performance Mark",
419
+ performancemeasure: "Performance Measure",
420
+ // webassembly
421
+ webassembly: "Web Assembly",
422
+ wasmmodule: "WebAssembly. Module",
423
+ wasminstance: "WebAssembly. Instance",
424
+ wasmmemory: "WebAssembly. Memory",
425
+ wasmtable: "WebAssembly. Table",
426
+ // node-ish / common hosts
427
+ buffer: "Buffer",
428
+ process: "Process",
429
+ eventemitter: "Event Emitter",
430
+ stream: "Stream",
431
+ fs: "fs",
432
+ path: "path",
433
+ url: "URL",
434
+ urlsearchparams: "URL Search Params",
435
+ // DOM basics
436
+ node: "Node",
437
+ element: "Element",
438
+ htmlelement: "HTML Element",
439
+ svgelement: "SVG Element",
440
+ document: "Document",
441
+ documentfragment: "Document Fragment",
442
+ shadowroot: "Shadow Root",
443
+ nodelist: "Node List",
444
+ htmlcollection: "HTML Collection",
445
+ // observers / misc DOM
446
+ resizeobserver: "Resize Observer",
447
+ mutationobserver: "Mutation Observer",
448
+ intersectionobserver: "Intersection Observer",
449
+ // Reflection / Symbolic
450
+ symboliterator: "Symbol. Iterator",
451
+ symbolasynciterator: "Symbol. Async Iterator",
452
+ symboltostringtag: "Symbol. To String Tag",
453
+ symbolspecies: "Symbol. Species",
454
+ symbolhasinstance: "Symbol. Has Instance",
455
+ symbolisconcatspreadable: "Symbol. Is Concat Spreadable",
456
+ symbolunscopables: "Symbol. Unscopables",
457
+ symbolmatch: "Symbol. Match",
458
+ symbolreplace: "Symbol. Replace",
459
+ symbolsearch: "Symbol. Search",
460
+ symbolsplit: "Symbol. Split",
461
+ symboltoprimitive: "Symbol. To Primitive",
462
+ symbolmatchall: "Symbol. Match All",
463
+ symbolarguments: "Symbol. Arguments",
464
+ // deprecated
465
+ // Numbers & Math
466
+ math: "Math",
467
+ bigintconstructor: "Bigint Constructor",
468
+ numberconstructor: "Number Constructor",
469
+ stringconstructor: "String Constructor",
470
+ booleanconstructor: "Boolean Constructor",
471
+ // URL / Networking (modern web)
472
+ formdataevent: "Form Data Event",
473
+ customevent: "Custom Event",
474
+ messagechannel: "Message Channel",
475
+ messageport: "Message Port",
476
+ messageevent: "Message Event",
477
+ websocket: "Web Socket",
478
+ eventsource: "Event Source",
479
+ // Storage APIs
480
+ indexeddb: "IndexedDB",
481
+ idbrequest: "IDB Request",
482
+ idbtransaction: "IDB Transaction",
483
+ idbobjectstore: "IDB Object Store",
484
+ idbcursor: "IDB Cursor",
485
+ localstorage: "Local Storage",
486
+ sessionstorage: "Session Storage",
487
+ // Navigator / Browser APIs
488
+ navigator: "Navigator",
489
+ geolocation: "Geolocation",
490
+ clipboard: "Clipboard",
491
+ notification: "Notification",
492
+ // Canvas / Graphics
493
+ canvas: "Canvas",
494
+ canvasrenderingcontext2d: "Canvas Rendering Context 2D",
495
+ offscreencanvas: "Offscreen Canvas",
496
+ webglrenderingcontext: "WebGL Rendering Context",
497
+ imagedata: "Image Data",
498
+ imagebitmap: "Image Bitmap",
499
+ // Media
500
+ mediastream: "Media Stream",
501
+ mediarecorder: "Media Recorder",
502
+ mediastreamtrack: "Media Stream Track",
503
+ audiocontext: "Audio Context",
504
+ audiobuffer: "Audio Buffer",
505
+ audioworklet: "Audio Worklet",
506
+ // Workers
507
+ worker: "Worker",
508
+ sharedworker: "Shared Worker",
509
+ serviceworker: "Service Worker",
510
+ workerglobalscope: "Worker Global Scope",
511
+ // Structured Clone / Transferable
512
+ structuredcloneerror: "Structured Clone Error",
513
+ transferable: "Transferable",
514
+ // Testing / Diagnostics
515
+ report: "Report",
516
+ console: "Console",
517
+ diagnosticreport: "Diagnostic Report",
518
+ // Misc
519
+ domrect: "DOM Rect",
520
+ dompoint: "DOM Point",
521
+ dommatrix: "DOM Matrix",
522
+ domparser: "DOM Parser",
523
+ xmlhttprequest: "XML HTTP Request",
524
+ customelementregistry: "Custom Element Registry",
525
+ // additions-ons
526
+ text: "Text",
527
+ comment: "Comment",
528
+ animation: "Animation",
529
+ documenttype: "Document Type",
530
+ characterdata: "Character Data",
531
+ animationevent: "Animation Event",
532
+ customemmetregistry: "Custom Emmet Registry",
533
+ websocketmessageevent: "WebSocket Message Event"
534
+ });
535
+ /** ----------------------------------------------------------
536
+ * * ***List of JavaScript special numeric values.***
537
+ * ----------------------------------------------------------
538
+ *
539
+ * - Contains special values recognized by {@link getPreciseType | `getPreciseType`},
540
+ * such as `"Infinity"`, `"-Infinity"`, and `"NaN"`.
541
+ *
542
+ * - **⚠️ Internal:**
543
+ * - Used by {@link getPreciseType | `getPreciseType`} for numeric edge-case detection.
544
+ *
545
+ * @internal
546
+ */
547
+ static SPECIAL_TYPE = Object.freeze([
548
+ "-Infinity",
549
+ "Infinity",
550
+ "NaN"
551
+ ]);
552
+ /** ----------------------------------------------------------
553
+ * * ***List of acronyms to keep uppercase in formatted output.***
554
+ * ----------------------------------------------------------
555
+ *
556
+ * - **Behavior:**
557
+ * - Prevents transformations (like camelCase or kebab-case) from altering
558
+ * known acronyms such as `HTML`, `URL`, `API`, etc.
559
+ * - Extend this list if you want more acronyms to remain uppercase.
560
+ *
561
+ * - **⚠️ Internal:**
562
+ * - Used internally by {@link getPreciseType | `getPreciseType`} and related formatters.
563
+ *
564
+ * @internal
565
+ */
566
+ static ACRONYMS = Object.freeze([
567
+ // Web & Protocols
568
+ "URI",
569
+ "URL",
570
+ "URN",
571
+ "HTTP",
572
+ "HTTPS",
573
+ "FTP",
574
+ "FTPS",
575
+ "SFTP",
576
+ "SSH",
577
+ "SMTP",
578
+ "POP3",
579
+ "IMAP",
580
+ "WS",
581
+ "WSS",
582
+ "TCP",
583
+ "UDP",
584
+ "IP",
585
+ "ICMP",
586
+ "ARP",
587
+ "RTP",
588
+ "RTSP",
589
+ "SIP",
590
+ // Web APIs & Standards
591
+ "HTML",
592
+ "XHTML",
593
+ "XML",
594
+ "WBR",
595
+ "CSS",
596
+ "SVG",
597
+ "JSON",
598
+ "JSONP",
599
+ "DOM",
600
+ "IDB",
601
+ "DB",
602
+ "RTC",
603
+ "ICE",
604
+ "TLS",
605
+ "SSL",
606
+ "CORS",
607
+ "WASM",
608
+ "CSR",
609
+ "SSR",
610
+ "PWA",
611
+ "DPI",
612
+ "CDN",
613
+ // Programming / JS Ecosystem
614
+ "JS",
615
+ "TS",
616
+ "JSX",
617
+ "TSX",
618
+ "CLI",
619
+ "API",
620
+ "SDK",
621
+ "UI",
622
+ "UX",
623
+ "OS",
624
+ "ID",
625
+ "UUID",
626
+ "PID",
627
+ "NPM",
628
+ "YARN",
629
+ "ESM",
630
+ "CJS",
631
+ "BOM",
632
+ "MVC",
633
+ "MVVM",
634
+ "ORM",
635
+ "DAO",
636
+ "CRUD",
637
+ "FIFO",
638
+ "LIFO",
639
+ "OOP",
640
+ "FP",
641
+ "REPL",
642
+ // Data Formats & Types
643
+ "CSV",
644
+ "TSV",
645
+ "SQL",
646
+ "YAML",
647
+ "JSON",
648
+ "MD",
649
+ "INI",
650
+ "PDF",
651
+ "XLS",
652
+ "XLSX",
653
+ "RTF",
654
+ "XML",
655
+ "BMP",
656
+ "GIF",
657
+ "PNG",
658
+ "JPEG",
659
+ "WEBP",
660
+ "MP3",
661
+ "MP4",
662
+ "AVI",
663
+ "MOV",
664
+ "FLAC",
665
+ "MKV",
666
+ "WAV",
667
+ // Common Abbreviations
668
+ "URLSearchParams",
669
+ "XHR",
670
+ "2D",
671
+ "3D",
672
+ "GL",
673
+ "WebGL",
674
+ "TTL",
675
+ "UID",
676
+ "GID",
677
+ "MAC",
678
+ "IP",
679
+ "DNS",
680
+ "DHCP",
681
+ "VPN",
682
+ "LAN",
683
+ "WAN",
684
+ "SSID",
685
+ "IoT",
686
+ "API",
687
+ "SDK",
688
+ "CLI",
689
+ "LTS",
690
+ "EOL",
691
+ // Hardware & Infrastructure
692
+ "CPU",
693
+ "GPU",
694
+ "RAM",
695
+ "ROM",
696
+ "SSD",
697
+ "HDD",
698
+ "BIOS",
699
+ "USB",
700
+ "PCI",
701
+ "SATA",
702
+ "DIMM",
703
+ "DDR",
704
+ "VGA",
705
+ "HDMI",
706
+ "KVM",
707
+ "ASIC",
708
+ "FPGA",
709
+ "SoC",
710
+ "NAS",
711
+ "SAN",
712
+ // Networking
713
+ "TCP",
714
+ "UDP",
715
+ "IP",
716
+ "MAC",
717
+ "DNS",
718
+ "DHCP",
719
+ "VPN",
720
+ "LAN",
721
+ "WAN",
722
+ "SSID",
723
+ "NAT",
724
+ "QoS",
725
+ "MPLS",
726
+ "BGP",
727
+ "OSPF",
728
+ "ICMP",
729
+ "IGMP",
730
+ "LLDP",
731
+ "ARP",
732
+ "RARP",
733
+ // Security
734
+ "AES",
735
+ "RSA",
736
+ "OTP",
737
+ "MFA",
738
+ "PKI",
739
+ "VPN",
740
+ "IAM",
741
+ "ACL",
742
+ "CSP",
743
+ "XSS",
744
+ "CSRF",
745
+ "HSTS",
746
+ "WAF",
747
+ "DDoS",
748
+ "IDS",
749
+ "IPS",
750
+ "SOC",
751
+ "SIEM",
752
+ // Cloud / DevOps / Infrastructure
753
+ "AWS",
754
+ "GCP",
755
+ "AZURE",
756
+ "CI",
757
+ "CD",
758
+ "K8S",
759
+ "IaC",
760
+ "PaaS",
761
+ "SaaS",
762
+ "IaaS",
763
+ "API",
764
+ "CLI",
765
+ "SDK",
766
+ "REST",
767
+ "SOAP",
768
+ "JSON-RPC",
769
+ "gRPC",
770
+ "ELB",
771
+ "EKS",
772
+ "AKS",
773
+ "FaaS",
774
+ "CaaS",
775
+ // User Interface & Tools
776
+ "GUI",
777
+ "IDE",
778
+ "FAQ",
779
+ "UX",
780
+ "UI",
781
+ "CLI",
782
+ "API",
783
+ "SDK",
784
+ "LTS",
785
+ "EOL",
786
+ "WYSIWYG",
787
+ "CMS",
788
+ "CRM",
789
+ // Miscellaneous
790
+ "GPS",
791
+ "LED",
792
+ "OLED",
793
+ "LCD",
794
+ "RFID",
795
+ "NFC",
796
+ "CPU",
797
+ "GPU",
798
+ "AI",
799
+ "ML",
800
+ "DL",
801
+ "DB",
802
+ "SQL",
803
+ "NoSQL",
804
+ "ORM",
805
+ "JSON",
806
+ "XML",
807
+ "CSV",
808
+ "HTTP",
809
+ "HTTPS",
810
+ // Testing & QA
811
+ "TDD",
812
+ "BDD",
813
+ "CI",
814
+ "CD",
815
+ "QA",
816
+ "SLA",
817
+ "SLO",
818
+ "MTTR",
819
+ "MTBF",
820
+ "UAT",
821
+ "RPA",
822
+ // Business & Project Management
823
+ "KPI",
824
+ "OKR",
825
+ "ROI",
826
+ "RFP",
827
+ "SLA",
828
+ "CRM",
829
+ "ERP",
830
+ "PMO",
831
+ "SCRUM",
832
+ "KANBAN",
833
+ // Multimedia & Graphics
834
+ "FPS",
835
+ "HDR",
836
+ "VR",
837
+ "AR",
838
+ "3D",
839
+ "2D",
840
+ "MP3",
841
+ "MP4",
842
+ "GIF",
843
+ "PNG",
844
+ "JPEG",
845
+ "SVG",
846
+ "BMP",
847
+ "TIFF",
848
+ // Operating Systems & File Systems
849
+ "POSIX",
850
+ "NTFS",
851
+ "FAT",
852
+ "EXT",
853
+ "EXT4",
854
+ "APFS",
855
+ "HFS",
856
+ "ISO",
857
+ // Programming Languages & Tools
858
+ "HTML",
859
+ "CSS",
860
+ "JS",
861
+ "TS",
862
+ "PHP",
863
+ "SQL",
864
+ "JSON",
865
+ "XML",
866
+ "YAML",
867
+ "BASH",
868
+ "ZSH",
869
+ "JSON",
870
+ "YAML",
871
+ "INI",
872
+ "DOTENV",
873
+ // Containers & Virtualization
874
+ "VM",
875
+ "VMM",
876
+ "VPC",
877
+ "OCI",
878
+ "LXC",
879
+ "Docker",
880
+ "K8S",
881
+ "CRI",
882
+ "CNI"
883
+ ]);
884
+ /** ----------------------------------------------------------
885
+ * * ***Normalized lookup table for type mapping.***
886
+ * ----------------------------------------------------------
887
+ *
888
+ * - **Behavior:**
889
+ * - Converts all keys from {@link FIXES_RAW | `FIXES_RAW`} into normalized form
890
+ * (lowercased and stripped of separators) for consistent lookup.
891
+ * - Values remain the formatted human-readable type names.
892
+ *
893
+ * - **⚠️ Internal:**
894
+ * - Helper table for {@link getPreciseType | `getPreciseType`} and related matchers.
895
+ *
896
+ * @internal
897
+ */
898
+ static FIXES_CASTABLE_TABLE = Object.freeze(
899
+ Object.entries(_PreciseType.FIXES_RAW).reduce((acc, [k, v]) => {
900
+ acc[_PreciseType.normalizeKeyForCase(k)] = v;
901
+ return acc;
902
+ }, {})
903
+ );
904
+ /** @internal */
905
+ formatCase = "toKebabCase";
906
+ /** @internal */
907
+ useAcronyms = false;
908
+ constructor(params) {
909
+ this.formatCase = params?.formatCase;
910
+ this.useAcronyms = params?.useAcronyms;
911
+ }
912
+ /** @internal */
913
+ determineOptions(options) {
914
+ return {
915
+ formatCase: options?.formatCase || this.formatCase,
916
+ useAcronyms: options?.useAcronyms ?? this.useAcronyms
917
+ };
918
+ }
919
+ // ------------------------
920
+ // Helpers for DOM detection
921
+ // ------------------------
922
+ /** @internal */
923
+ getHtmlElementType(value, options) {
924
+ const { formatCase, useAcronyms } = this.determineOptions(options);
925
+ if (typeof HTMLElement === "undefined" || !(value instanceof HTMLElement))
926
+ return null;
927
+ const tagName = value.tagName;
928
+ const DEFAULTS = {
929
+ a: "Anchor",
930
+ abbr: "Abbreviation",
931
+ address: "Address",
932
+ area: "Area",
933
+ article: "Article",
934
+ aside: "Aside",
935
+ audio: "Audio",
936
+ b: "Bold",
937
+ base: "Base",
938
+ bdi: "BDI",
939
+ bdo: "BDO",
940
+ blockquote: "Blockquote",
941
+ body: "Body",
942
+ br: "Break",
943
+ button: "Button",
944
+ canvas: "Canvas",
945
+ caption: "Caption",
946
+ cite: "Cite",
947
+ code: "Code",
948
+ col: "Column",
949
+ colgroup: "Column Group",
950
+ data: "Data",
951
+ datalist: "Datalist",
952
+ dd: "Definition Description",
953
+ del: "Deleted Text",
954
+ details: "Details",
955
+ dfn: "Definition",
956
+ dialog: "Dialog",
957
+ div: "Div",
958
+ dl: "Definition List",
959
+ dt: "Definition Term",
960
+ em: "Emphasis",
961
+ embed: "Embed",
962
+ fieldset: "Fieldset",
963
+ figcaption: "Figcaption",
964
+ figure: "Figure",
965
+ footer: "Footer",
966
+ form: "Form",
967
+ h1: "Heading 1",
968
+ h2: "Heading 2",
969
+ h3: "Heading 3",
970
+ h4: "Heading 4",
971
+ h5: "Heading 5",
972
+ h6: "Heading 6",
973
+ head: "Head",
974
+ header: "Header",
975
+ hr: "Horizontal Rule",
976
+ html: "HTML",
977
+ i: "Italic",
978
+ iframe: "IFrame",
979
+ img: "Image",
980
+ input: "Input",
981
+ ins: "Inserted Text",
982
+ kbd: "Keyboard",
983
+ label: "Label",
984
+ legend: "Legend",
985
+ li: "List Item",
986
+ link: "Link",
987
+ main: "Main",
988
+ map: "Map",
989
+ mark: "Mark",
990
+ meta: "Meta",
991
+ meter: "Meter",
992
+ nav: "Nav",
993
+ noscript: "NoScript",
994
+ object: "Object",
995
+ ol: "Ordered List",
996
+ optgroup: "Option Group",
997
+ option: "Option",
998
+ output: "Output",
999
+ p: "Paragraph",
1000
+ param: "Param",
1001
+ picture: "Picture",
1002
+ pre: "Preformatted",
1003
+ progress: "Progress",
1004
+ q: "Quote",
1005
+ rp: "RP",
1006
+ rt: "RT",
1007
+ ruby: "Ruby",
1008
+ s: "Strikethrough",
1009
+ samp: "Sample",
1010
+ script: "Script",
1011
+ section: "Section",
1012
+ select: "Select",
1013
+ small: "Small",
1014
+ source: "Source",
1015
+ span: "Span",
1016
+ strong: "Strong",
1017
+ style: "Style",
1018
+ sub: "Subscript",
1019
+ summary: "Summary",
1020
+ sup: "Superscript",
1021
+ table: "Table",
1022
+ tbody: "Table Body",
1023
+ td: "Table Data",
1024
+ template: "Template",
1025
+ textarea: "Textarea",
1026
+ tfoot: "Table Footer",
1027
+ th: "Table Header",
1028
+ thead: "Table Head",
1029
+ time: "Time",
1030
+ title: "Title",
1031
+ tr: "Table Row",
1032
+ track: "Track",
1033
+ u: "Underline",
1034
+ ul: "Unordered List",
1035
+ var: "Variable",
1036
+ video: "Video",
1037
+ wbr: "WBR"
1038
+ };
1039
+ const displayName = _PreciseType.FIXES_CASTABLE_TABLE[_PreciseType.normalizeKeyForCase(tagName)] ?? (DEFAULTS[tagName] ? `HTML ${DEFAULTS[tagName]} Element` : "HTML Element");
1040
+ return this.converter(displayName, { formatCase, useAcronyms });
1041
+ }
1042
+ /** @internal */
1043
+ getCommentNodeType(value, options) {
1044
+ const { formatCase, useAcronyms } = this.determineOptions(options);
1045
+ if (value instanceof Comment) {
1046
+ return this.converter(
1047
+ _PreciseType.FIXES_CASTABLE_TABLE[_PreciseType.normalizeKeyForCase("comment")] ?? "Comment",
1048
+ { formatCase, useAcronyms }
1049
+ );
1050
+ }
1051
+ return null;
1052
+ }
1053
+ /** @internal */
1054
+ getTextNodeType(value, options) {
1055
+ const { formatCase, useAcronyms } = this.determineOptions(options);
1056
+ if (value instanceof Text) {
1057
+ return this.converter(
1058
+ _PreciseType.FIXES_CASTABLE_TABLE[_PreciseType.normalizeKeyForCase("text")] ?? "Text",
1059
+ { formatCase, useAcronyms }
1060
+ );
1061
+ }
1062
+ return null;
1063
+ }
1064
+ /** @internal */
1065
+ getOtherNodeType(value, options) {
1066
+ const { formatCase, useAcronyms } = this.determineOptions(options);
1067
+ if (typeof Node !== "undefined" && value instanceof Node) {
1068
+ return this.converter(
1069
+ _PreciseType.FIXES_CASTABLE_TABLE[_PreciseType.normalizeKeyForCase("node")] ?? "Node",
1070
+ { formatCase, useAcronyms }
1071
+ );
1072
+ }
1073
+ return null;
1074
+ }
1075
+ /** ----------------------------------------------------------
1076
+ * * ***Retrieves the canonical string representation of a given `Symbol`.***
1077
+ * ----------------------------------------------------------
1078
+ *
1079
+ * - **Description:**
1080
+ * - Converts a JavaScript `Symbol` (including well-known symbols) into a standardized,
1081
+ * human-readable name string.
1082
+ * - Maps **well-known symbols** (e.g., `Symbol.iterator`, `Symbol.asyncIterator`, `Symbol.toStringTag`)
1083
+ * to their corresponding normalized key in {@link PreciseType.castableTable | `castableTable`}.
1084
+ * - Supports formatted output according to the given `formatCase` and `useAcronyms` options.
1085
+ * - Falls back to the general `"Symbol"` type name if the provided symbol is not recognized.
1086
+ *
1087
+ * - **Example:**
1088
+ * ```ts
1089
+ * const precise = new PreciseType();
1090
+ *
1091
+ * precise.getSymbolName(Symbol.iterator);
1092
+ * // ➜ "symbol-iterator"
1093
+ *
1094
+ * precise.getSymbolName(Symbol.toStringTag, { formatCase: "toPascalCase" });
1095
+ * // ➜ "SymbolToStringTag"
1096
+ *
1097
+ * precise.getSymbolName(Symbol("custom"));
1098
+ * // ➜ "symbol"
1099
+ * ```
1100
+ *
1101
+ * - **Options:**
1102
+ * - `formatCase` → Determines the string case style for the resulting symbol name.
1103
+ * - `useAcronyms` → Preserves known acronyms (like `URL`, `DOM`, `HTML`) if set to `true`.
1104
+ *
1105
+ * - **⚠️ Internal:**
1106
+ * - Helper for {@link getPreciseType | `getPreciseType`} that normalizes `Symbol` detection.
1107
+ * - Not recommended for direct external use.
1108
+ *
1109
+ * @param value - The `Symbol` instance to analyze.
1110
+ * @param options - Optional settings for case formatting and acronym preservation.
1111
+ * @returns The formatted symbol name string.
1112
+ *
1113
+ * @internal
1114
+ */
1115
+ getSymbolName(value, options) {
1116
+ const { formatCase, useAcronyms } = this.determineOptions(options);
1117
+ const symbolMap = /* @__PURE__ */ new Map([
1118
+ [Symbol.iterator, "symboliterator"],
1119
+ [Symbol.asyncIterator, "symbolasynciterator"],
1120
+ [Symbol.toStringTag, "symboltostringtag"],
1121
+ [Symbol.species, "symbolspecies"],
1122
+ [Symbol.hasInstance, "symbolhasinstance"],
1123
+ [Symbol.isConcatSpreadable, "symbolisconcatspreadable"],
1124
+ [Symbol.unscopables, "symbolunscopables"],
1125
+ [Symbol.match, "symbolmatch"],
1126
+ [Symbol.replace, "symbolreplace"],
1127
+ [Symbol.search, "symbolsearch"],
1128
+ [Symbol.split, "symbolsplit"],
1129
+ [Symbol.toPrimitive, "symboltoprimitive"],
1130
+ [Symbol.matchAll, "symbolmatchall"]
1131
+ ]);
1132
+ const key = symbolMap.get(value);
1133
+ if (key) {
1134
+ return this.converter(
1135
+ _PreciseType.FIXES_CASTABLE_TABLE[_PreciseType.normalizeKeyForCase(key)] ?? key,
1136
+ {
1137
+ formatCase,
1138
+ useAcronyms
1139
+ }
1140
+ );
1141
+ }
1142
+ return this.converter(
1143
+ _PreciseType.FIXES_CASTABLE_TABLE[_PreciseType.normalizeKeyForCase("symbol")] ?? "Symbol",
1144
+ { formatCase, useAcronyms }
1145
+ );
1146
+ }
1147
+ /** ----------------------------------------------------------
1148
+ * * ***Detects the precise DOM node type of a given value.***
1149
+ * ----------------------------------------------------------
1150
+ *
1151
+ * - **Description:**
1152
+ * - Determines the specific **DOM Node subtype** (e.g., `HTMLDivElement`, `Comment`, `Text`, etc.)
1153
+ * based on the given input `value`.
1154
+ * - This method sequentially checks various DOM-related helpers:
1155
+ * - {@link PreciseType.getHtmlElementType | `getHtmlElementType`}
1156
+ * - {@link PreciseType.getCommentNodeType | `getCommentNodeType`}
1157
+ * - {@link PreciseType.getTextNodeType | `getTextNodeType`}
1158
+ * - {@link PreciseType.getOtherNodeType | `getOtherNodeType`}
1159
+ * - Returns the first non-null type result found.
1160
+ * - If no valid DOM node type is detected or an error occurs, it gracefully returns `null`.
1161
+ *
1162
+ * - **Example:**
1163
+ * ```ts
1164
+ * const detector = new PreciseType();
1165
+ * detector.detectDomNodeType(document.createElement("div"));
1166
+ * // ➜ "HTMLDivElement"
1167
+ *
1168
+ * detector.detectDomNodeType(document.createComment("test"));
1169
+ * // ➜ "Comment"
1170
+ *
1171
+ * detector.detectDomNodeType("not a node");
1172
+ * // ➜ null
1173
+ * ```
1174
+ *
1175
+ * - **Options:**
1176
+ * - `formatCase` → Controls the output formatting (e.g., `"toKebabCase"`, `"toPascalCase"`, etc.).
1177
+ * - `useAcronyms` → Determines if acronyms like `"HTML"` or `"SVG"` remain uppercase.
1178
+ *
1179
+ * - **⚠️ Internal:**
1180
+ * - Used internally by {@link getPreciseType | `getPreciseType`} to refine DOM-related type detection.
1181
+ * - Not intended for direct external use.
1182
+ *
1183
+ * @param value - The value to be inspected for a DOM node type.
1184
+ * @param options - Optional configuration to adjust case formatting and acronym behavior.
1185
+ * @returns The detected DOM node type string, or `null` if not applicable.
1186
+ *
1187
+ * @internal
1188
+ */
1189
+ detectDomNodeType(value, options) {
1190
+ const { formatCase, useAcronyms } = this.determineOptions(options);
1191
+ try {
1192
+ return this.getHtmlElementType(value, { formatCase, useAcronyms }) || this.getCommentNodeType(value, { formatCase, useAcronyms }) || this.getTextNodeType(value, { formatCase, useAcronyms }) || this.getOtherNodeType(value, { formatCase, useAcronyms });
1193
+ } catch {
1194
+ return null;
1195
+ }
1196
+ }
1197
+ /** ----------------------------------------------------------
1198
+ * * ***Detects whether a given value is a Proxy instance.***
1199
+ * ----------------------------------------------------------
1200
+ *
1201
+ * - **Behavior:**
1202
+ * - Attempts to define and delete a temporary property to trigger potential Proxy traps.
1203
+ * - Works because most Proxy handlers will throw or behave differently during these operations.
1204
+ * - Transparent Proxies (without traps) will **not** be detected.
1205
+ *
1206
+ * @description
1207
+ * This method performs a heuristic check — it’s **not foolproof**, but reliably distinguishes
1208
+ * most Proxy-wrapped objects from ordinary ones without using non-standard APIs.
1209
+ *
1210
+ * @param value - The value to inspect.
1211
+ * @returns `true` if the value behaves like a Proxy (throws on property mutation),
1212
+ * otherwise `false`.
1213
+ *
1214
+ * @example
1215
+ * ```ts
1216
+ * const target = {};
1217
+ * const proxy = new Proxy(target, {});
1218
+ *
1219
+ * console.log(preciseType.isProxy(target)); // false
1220
+ * console.log(preciseType.isProxy(proxy)); // false (transparent proxy)
1221
+ *
1222
+ * const proxyWithTrap = new Proxy(target, {
1223
+ * set() { throw new Error("trap!"); }
1224
+ * });
1225
+ *
1226
+ * console.log(preciseType.isProxy(proxyWithTrap)); // true
1227
+ * ```
1228
+ *
1229
+ * @note
1230
+ * - Skips built-in native types (like `Array`, `Date`, `Map`, etc.) to prevent false positives.
1231
+ * - This is an **internal heuristic**, not a guaranteed Proxy detector.
1232
+ *
1233
+ * @internal
1234
+ */
1235
+ isProxy(value) {
1236
+ if (isNull(value) || !isObjectOrArray(value)) return false;
1237
+ const tag = Object.prototype.toString.call(value);
1238
+ const skipTags = [
1239
+ "[object Array]",
1240
+ "[object Date]",
1241
+ "[object RegExp]",
1242
+ "[object Map]",
1243
+ "[object Set]",
1244
+ "[object WeakMap]",
1245
+ "[object WeakSet]",
1246
+ "[object Function]",
1247
+ "[object Error]",
1248
+ "[object Promise]",
1249
+ "[object Generator]",
1250
+ "[object GeneratorFunction]",
1251
+ "[object AsyncFunction]"
1252
+ ];
1253
+ if (skipTags.includes(tag)) return false;
1254
+ try {
1255
+ Reflect.defineProperty(value, "__proxy_detect__", {
1256
+ configurable: true,
1257
+ value: 1
1258
+ });
1259
+ Reflect.deleteProperty(value, "__proxy_detect__");
1260
+ return false;
1261
+ } catch {
1262
+ return true;
1263
+ }
1264
+ }
1265
+ /** ----------------------------------------------------------
1266
+ * * ***Helper function to convert an input string to a specific casing/format.***
1267
+ * ----------------------------------------------------------
1268
+ *
1269
+ * @description
1270
+ * - Chooses the conversion function based on the `formatCase` option.
1271
+ * - Supports multiple casing/formatting functions:
1272
+ * - `toPascalCaseSpace`.
1273
+ * - `toPascalCase`.
1274
+ * - `toCamelCase`.
1275
+ * - `toKebabCase`.
1276
+ * - `toSnakeCase`.
1277
+ * - `toDotCase`.
1278
+ * - `slugify`.
1279
+ * - Uses `ACRONYMS` as ignored words for certain conversion functions.
1280
+ *
1281
+ * @param {string} input - The string to convert.
1282
+ * @param {GetPreciseTypeOptions["formatCase"]} formatCase - The conversion method to apply.
1283
+ * @returns {string} The converted string according to the selected format.
1284
+ *
1285
+ * @example
1286
+ * converterHelper("hello world", "toCamelCase");
1287
+ * // ➔ "helloWorld"
1288
+ *
1289
+ * @example
1290
+ * converterHelper("my URL path", "slugify");
1291
+ * // ➔ "my-URL-path"
1292
+ *
1293
+ * @internal
1294
+ */
1295
+ converter(input, options) {
1296
+ const { formatCase, useAcronyms } = this.determineOptions(options);
1297
+ const ignoreWord = useAcronyms ? _PreciseType.ACRONYMS : [];
1298
+ switch (formatCase) {
1299
+ case "slugify":
1300
+ return slugify(input, ignoreWord);
1301
+ case "toDotCase":
1302
+ return toDotCase(input, ignoreWord);
1303
+ case "toCamelCase":
1304
+ return toCamelCase(input, ignoreWord);
1305
+ case "toSnakeCase":
1306
+ return toSnakeCase(input, ignoreWord);
1307
+ case "toLowerCase":
1308
+ return toLowerCase(input, ignoreWord);
1309
+ case "toPascalCase":
1310
+ return toPascalCase(input, ignoreWord);
1311
+ case "toPascalCaseSpace":
1312
+ return toPascalCaseSpace(input, ignoreWord);
1313
+ default:
1314
+ return toKebabCase(input, ignoreWord);
1315
+ }
1316
+ }
1317
+ /** ----------------------------------------------------------
1318
+ * * ***Normalizes a string key for consistent case-insensitive matching.***
1319
+ * ----------------------------------------------------------
1320
+ *
1321
+ * - **Description:**
1322
+ * - This method removes all **spaces**, **underscores**, and **hyphens** from the given string,
1323
+ * then converts the result to **lowercase**.
1324
+ * - Used internally to ensure uniformity in key lookups and matching logic across
1325
+ * type mapping tables like {@link PreciseType.fixesRaw | `fixesRaw`} and
1326
+ * {@link PreciseType.castableTable | `castableTable`}.
1327
+ *
1328
+ * - **Example:**
1329
+ * ```ts
1330
+ * PreciseType.normalizeKeyForCase("Map.Type"); // ➔ "maptype"
1331
+ * PreciseType.normalizeKeyForCase("Map-Type"); // ➔ "maptype"
1332
+ * PreciseType.normalizeKeyForCase("Set Type"); // ➔ "settype"
1333
+ * PreciseType.normalizeKeyForCase("Array_Type"); // ➔ "arraytype"
1334
+ * ```
1335
+ *
1336
+ * - **⚠️ Internal:**
1337
+ * - Helper method used by {@link getPreciseType | `getPreciseType`} and internal mapping constants.
1338
+ * - Not intended for direct use in user code.
1339
+ *
1340
+ * @param k - The input string key to normalize.
1341
+ * @returns The normalized lowercase key with all separators removed.
1342
+ *
1343
+ * @internal
1344
+ */
1345
+ static normalizeKeyForCase(k) {
1346
+ return k.replace(/[\s_\-\.]+/g, "").toLowerCase();
1347
+ }
1348
+ /** ----------------------------------------------------------
1349
+ * * ***Getting the internal map of type castable relationships used by {@link getPreciseType | `getPreciseType`}.***
1350
+ * ----------------------------------------------------------
1351
+ *
1352
+ * - **Description:**
1353
+ * - Returns an internal static mapping table that defines which primitive or structural types
1354
+ * can be cast or interpreted as another related type within the internal logic of
1355
+ * {@link getPreciseType | `getPreciseType`}.
1356
+ *
1357
+ * - **⚠️ Internal:**
1358
+ * - This is an internal helper of {@link getPreciseType | `getPreciseType`}.
1359
+ * - Do not modify or rely on this table directly — it is **readonly** and may change without notice.
1360
+ *
1361
+ * @readonly
1362
+ */
1363
+ static get castableTable() {
1364
+ return _PreciseType.FIXES_CASTABLE_TABLE;
1365
+ }
1366
+ /** ----------------------------------------------------------
1367
+ * * ***Retrieves the internal list of special type cases handled by {@link getPreciseType | `getPreciseType`}.***
1368
+ * ----------------------------------------------------------
1369
+ *
1370
+ * - **Description:**
1371
+ * - Returns an internal readonly list of specific type identifiers that require
1372
+ * *custom handling* during type detection.
1373
+ * - These are **exceptional values** or **edge cases** that don’t follow the normal
1374
+ * JavaScript type resolution flow.
1375
+ *
1376
+ * - **Example Values:**
1377
+ * - `"Infinity"`, `"-Infinity"`, `"NaN"`, `"undefined"`, etc.
1378
+ *
1379
+ * - **⚠️ Internal:**
1380
+ * - Used internally by {@link getPreciseType | `getPreciseType`}.
1381
+ * - This property is **readonly** and should not be modified directly.
1382
+ *
1383
+ * @readonly
1384
+ */
1385
+ static get specialType() {
1386
+ return this.SPECIAL_TYPE;
1387
+ }
1388
+ /** ----------------------------------------------------------
1389
+ * * ***Retrieves the internal mapping of JavaScript built-in and environment-specific
1390
+ * type identifiers to their canonical PascalCase names.***
1391
+ * ----------------------------------------------------------
1392
+ *
1393
+ * - **Description:**
1394
+ * - Provides a mapping table where **keys** represent normalized raw type names
1395
+ * (as obtained from `Object.prototype.toString.call(value)` or environment checks),
1396
+ * and **values** represent their **canonical PascalCase equivalents**.
1397
+ * - This table ensures consistent, human-readable type strings across different environments.
1398
+ *
1399
+ * - **Example Mapping:**
1400
+ * ```ts
1401
+ * {
1402
+ * "[object Map]": "Map",
1403
+ * "[object WeakMap]": "WeakMap",
1404
+ * "[object AsyncFunction]": "AsyncFunction",
1405
+ * "[object GeneratorFunction]": "GeneratorFunction",
1406
+ * "[object BigInt]": "BigInt",
1407
+ * }
1408
+ * ```
1409
+ *
1410
+ * - **⚠️ Internal:**
1411
+ * - Used internally by {@link getPreciseType | `getPreciseType`}.
1412
+ * - This property is **readonly** and should not be modified directly.
1413
+ *
1414
+ * @readonly
1415
+ */
1416
+ static get fixesRaw() {
1417
+ return this.FIXES_RAW;
1418
+ }
1419
+ /** ----------------------------------------------------------
1420
+ * * ***Retrieves the internal list of common acronyms that should remain fully uppercase during string formatting.***
1421
+ * ----------------------------------------------------------
1422
+ *
1423
+ * - **Description:**
1424
+ * - This list defines acronyms (e.g., `"URL"`, `"HTTP"`, `"HTML"`, `"SVG"`, `"XML"`, `"DOM"`)
1425
+ * that will be **preserved in uppercase** when applying case transformations through
1426
+ * {@link getPreciseType | `getPreciseType`} or any formatting utility using it.
1427
+ * - Ensures consistency in output for technical identifiers that are conventionally capitalized.
1428
+ *
1429
+ * - **Example:**
1430
+ * ```ts
1431
+ * ["URL", "HTTP", "HTML", "SVG", "XML", "DOM"]
1432
+ * ```
1433
+ *
1434
+ * - **⚠️ Internal:**
1435
+ * - Used internally by {@link getPreciseType | `getPreciseType`}.
1436
+ * - This property is **readonly** and not intended for modification.
1437
+ *
1438
+ * @readonly
1439
+ */
1440
+ static get acronymsList() {
1441
+ return this.ACRONYMS;
1442
+ }
1443
+ };
1444
+
1445
+ var getPreciseType = /* @__PURE__ */ (() => {
1446
+ const cache = /* @__PURE__ */ new Map();
1447
+ const MAX_CACHE_SIZE = 25;
1448
+ return (value, options = {}) => {
1449
+ if (!isPlainObject(options)) options = {};
1450
+ const key = JSON.stringify({
1451
+ formatCase: options.formatCase || "toKebabCase",
1452
+ useAcronyms: options.useAcronyms ?? false
1453
+ });
1454
+ let ClassPrecise = cache.get(key);
1455
+ if (!ClassPrecise) {
1456
+ if (cache.size >= MAX_CACHE_SIZE) cache.clear();
1457
+ ClassPrecise = new PreciseType(options);
1458
+ cache.set(key, ClassPrecise);
1459
+ }
1460
+ if (isNull(value)) {
1461
+ return ClassPrecise.converter(
1462
+ PreciseType.castableTable[PreciseType.normalizeKeyForCase("null")] ?? "Null"
1463
+ );
1464
+ }
1465
+ if (isNaN(value)) return "NaN";
1466
+ if (isInfinityNumber(value)) return String(value);
1467
+ if (typeof BigInt !== "undefined" && value === BigInt) {
1468
+ return ClassPrecise.converter(
1469
+ PreciseType.castableTable[PreciseType.normalizeKeyForCase("bigint constructor")]
1470
+ );
1471
+ }
1472
+ if (isNumberObject(value) || value === Number) {
1473
+ return ClassPrecise.converter(
1474
+ PreciseType.castableTable[PreciseType.normalizeKeyForCase("number constructor")]
1475
+ );
1476
+ }
1477
+ if (isStringObject(value) || value === String) {
1478
+ return ClassPrecise.converter(
1479
+ PreciseType.castableTable[PreciseType.normalizeKeyForCase("string constructor")]
1480
+ );
1481
+ }
1482
+ if (isBooleanObject(value) || value === Boolean) {
1483
+ return ClassPrecise.converter(
1484
+ PreciseType.castableTable[PreciseType.normalizeKeyForCase("boolean constructor")]
1485
+ );
1486
+ }
1487
+ const prim = typeof value;
1488
+ if (!isObjectOrArray(value) && !isFunction(value) && prim !== "symbol") {
1489
+ return ClassPrecise.converter(
1490
+ PreciseType.castableTable[PreciseType.normalizeKeyForCase(prim)] ?? prim
1491
+ );
1492
+ }
1493
+ if (prim === "symbol") {
1494
+ return ClassPrecise.getSymbolName(value);
1495
+ }
1496
+ if (isObjectOrArray(value) && value.constructor?.name === "EventEmitter") {
1497
+ return ClassPrecise.converter(
1498
+ PreciseType.castableTable[PreciseType.normalizeKeyForCase("event emitter")] ?? "Event Emitter"
1499
+ );
1500
+ }
1501
+ const domType = ClassPrecise.detectDomNodeType(value);
1502
+ if (domType) return domType;
1503
+ if (isBuffer(value)) {
1504
+ return ClassPrecise.converter(
1505
+ PreciseType.castableTable[PreciseType.normalizeKeyForCase("buffer")] ?? "Buffer"
1506
+ );
1507
+ }
1508
+ if (ClassPrecise.isProxy(value)) {
1509
+ return ClassPrecise.converter(
1510
+ PreciseType.castableTable[PreciseType.normalizeKeyForCase("proxy")] ?? "Proxy"
1511
+ );
1512
+ }
1513
+ if (isObject(value) && isFunction(value?.next) && isFunction(value?.throw)) {
1514
+ return ClassPrecise.converter(
1515
+ PreciseType.castableTable[PreciseType.normalizeKeyForCase("generator")] ?? "Generator"
1516
+ );
1517
+ }
1518
+ if (isError(value)) {
1519
+ const ctorName2 = value.constructor?.name ?? "Error";
1520
+ return ClassPrecise.converter(
1521
+ PreciseType.castableTable[PreciseType.normalizeKeyForCase(ctorName2)] ?? PreciseType.castableTable[PreciseType.normalizeKeyForCase(ctorName2.replace(/\s+/g, ""))] ?? ctorName2
1522
+ );
1523
+ }
1524
+ if (isObjectOrArray(value) && "done" in value && "value" in value && Object.keys(value).length === 2) {
1525
+ return ClassPrecise.converter(
1526
+ PreciseType.castableTable[PreciseType.normalizeKeyForCase("iterator result")]
1527
+ );
1528
+ }
1529
+ if (isNull(Object.getPrototypeOf(value))) {
1530
+ return ClassPrecise.converter(
1531
+ PreciseType.castableTable[PreciseType.normalizeKeyForCase("object")] ?? "Object"
1532
+ );
1533
+ }
1534
+ const tag = Object.prototype.toString.call(value).slice(8, -1) || "Object";
1535
+ const mapped = PreciseType.castableTable[PreciseType.normalizeKeyForCase(tag)];
1536
+ if (mapped) return ClassPrecise.converter(mapped);
1537
+ const ctorName = value?.constructor?.name;
1538
+ if (ctorName && ctorName !== "Object") {
1539
+ return ClassPrecise.converter(
1540
+ PreciseType.castableTable[PreciseType.normalizeKeyForCase(ctorName)] ?? ctorName
1541
+ );
1542
+ }
1543
+ return ClassPrecise.converter(tag);
1544
+ };
1545
+ })();
1546
+
1547
+ var determineErrorTypeAssertion = (type, message) => {
1548
+ switch (type) {
1549
+ case "Error":
1550
+ throw new Error(message);
1551
+ case "EvalError":
1552
+ throw new EvalError(message);
1553
+ case "RangeError":
1554
+ throw new RangeError(message);
1555
+ case "ReferenceError":
1556
+ throw new ReferenceError(message);
1557
+ case "SyntaxError":
1558
+ throw new SyntaxError(message);
1559
+ case "URIError":
1560
+ throw new URIError(message);
1561
+ case "TypeError":
1562
+ throw new TypeError(message);
1563
+ default:
1564
+ throw new TypeError(message);
1565
+ }
1566
+ };
1567
+ function resolveErrorMessageAssertions(params) {
1568
+ const { requiredValidType, value, options } = params || {};
1569
+ const {
1570
+ message,
1571
+ formatCase,
1572
+ useAcronyms,
1573
+ errorType = "TypeError"
1574
+ } = isPlainObject(options) ? options : {};
1575
+ const validType = toKebabCase(requiredValidType);
1576
+ const currentType = getPreciseType(value, { formatCase, useAcronyms });
1577
+ const messageFnOptions = { currentType, validType };
1578
+ const defaultMessage = `Parameter input (\`value\`) must be of type \`${validType}\`, but received: \`${currentType}\`.`;
1579
+ const errorMessage = isFunction(message) ? isNonEmptyString(message(messageFnOptions)) ? message(messageFnOptions).trim() : defaultMessage : isNonEmptyString(message) ? message.trim() : defaultMessage;
1580
+ return determineErrorTypeAssertion(errorType, errorMessage);
1581
+ }
1582
+
1583
+ function assertIsPlainObject(value, options = {}) {
1584
+ if (isPlainObject(value)) return;
1585
+ resolveErrorMessageAssertions({
1586
+ value,
1587
+ options,
1588
+ requiredValidType: "plain object"
1589
+ });
1590
+ }
1591
+
1592
+ exports.assertIsBoolean = assertIsBoolean;
1593
+ exports.assertIsPlainObject = assertIsPlainObject;
1594
+ exports.getPreciseType = getPreciseType;
1595
+ exports.hasOwnProp = hasOwnProp;
1596
+ exports.isArray = isArray;
1597
+ exports.isBoolean = isBoolean;
1598
+ exports.isBooleanObject = isBooleanObject;
1599
+ exports.isBuffer = isBuffer;
1600
+ exports.isError = isError;
1601
+ exports.isFunction = isFunction;
1602
+ exports.isInfinityNumber = isInfinityNumber;
1603
+ exports.isNaN = isNaN;
1604
+ exports.isNil = isNil;
1605
+ exports.isNonEmptyArray = isNonEmptyArray;
1606
+ exports.isNonEmptyString = isNonEmptyString;
1607
+ exports.isNull = isNull;
1608
+ exports.isNumber = isNumber;
1609
+ exports.isNumberObject = isNumberObject;
1610
+ exports.isObject = isObject;
1611
+ exports.isObjectOrArray = isObjectOrArray;
1612
+ exports.isPlainObject = isPlainObject;
1613
+ exports.isSet = isSet;
1614
+ exports.isString = isString;
1615
+ exports.isStringObject = isStringObject;
1616
+ exports.isSymbol = isSymbol;
1617
+ exports.isUndefined = isUndefined;
1618
+ exports.resolveErrorMessageAssertions = resolveErrorMessageAssertions;
1619
+ exports.slugify = slugify;
1620
+ exports.toCamelCase = toCamelCase;
1621
+ exports.toDotCase = toDotCase;
1622
+ exports.toKebabCase = toKebabCase;
1623
+ exports.toLowerCase = toLowerCase;
1624
+ exports.toPascalCase = toPascalCase;
1625
+ exports.toPascalCaseSpace = toPascalCaseSpace;
1626
+ exports.toSnakeCase = toSnakeCase;