@rzl-zone/utils-js 3.12.0 → 3.12.1-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/{LICENSE.md → LICENSE} +3 -3
- package/README.md +62 -89
- package/dist/.references/index.d.cts +25 -0
- package/dist/.references/index.d.ts +25 -0
- package/dist/assertIsArray-BChqwPiP.cjs +26 -0
- package/dist/assertIsArray-BChqwPiP.cjs.map +1 -0
- package/dist/assertIsArray-BfAbIUfa.js +20 -0
- package/dist/assertIsArray-BfAbIUfa.js.map +1 -0
- package/dist/assertIsBoolean-BlBct0Fc.js +1073 -0
- package/dist/assertIsBoolean-BlBct0Fc.js.map +1 -0
- package/dist/assertIsBoolean-DozdtbNi.cjs +1283 -0
- package/dist/assertIsBoolean-DozdtbNi.cjs.map +1 -0
- package/dist/assertIsString-Bvk7bUL7.cjs +26 -0
- package/dist/assertIsString-Bvk7bUL7.cjs.map +1 -0
- package/dist/assertIsString-DqV9NwbI.js +20 -0
- package/dist/assertIsString-DqV9NwbI.js.map +1 -0
- package/dist/assertions/index.cjs +37 -40
- package/dist/assertions/index.cjs.map +1 -0
- package/dist/assertions/index.d.cts +12 -0
- package/dist/assertions/index.d.ts +10 -824
- package/dist/assertions/index.js +30 -13
- package/dist/assertions/index.js.map +1 -0
- package/dist/conversions/index.cjs +34 -103
- package/dist/conversions/index.d.cts +12 -0
- package/dist/conversions/index.d.ts +10 -1791
- package/dist/conversions/index.js +14 -24
- package/dist/conversions-CBs8-REq.cjs +448 -0
- package/dist/conversions-CBs8-REq.cjs.map +1 -0
- package/dist/conversions-EMJa3g-D.js +382 -0
- package/dist/conversions-EMJa3g-D.js.map +1 -0
- package/dist/events/index.cjs +55 -31
- package/dist/events/index.cjs.map +1 -0
- package/dist/events/index.d.cts +174 -0
- package/dist/events/index.d.ts +31 -35
- package/dist/events/index.js +50 -12
- package/dist/events/index.js.map +1 -0
- package/dist/formatEnvPort-DpIXzPAZ.js +159 -0
- package/dist/formatEnvPort-DpIXzPAZ.js.map +1 -0
- package/dist/formatEnvPort-hHNvOim-.cjs +171 -0
- package/dist/formatEnvPort-hHNvOim-.cjs.map +1 -0
- package/dist/formatters/index.cjs +21 -61
- package/dist/formatters/index.d.cts +12 -0
- package/dist/formatters/index.d.ts +10 -2152
- package/dist/formatters/index.js +10 -18
- package/dist/formatters-QcZO_Cpx.js +367 -0
- package/dist/formatters-QcZO_Cpx.js.map +1 -0
- package/dist/formatters-lAYgA11L.cjs +427 -0
- package/dist/formatters-lAYgA11L.cjs.map +1 -0
- package/dist/generators/index.cjs +161 -41
- package/dist/generators/index.cjs.map +1 -0
- package/dist/generators/index.d.cts +12 -0
- package/dist/generators/index.d.ts +10 -338
- package/dist/generators/index.js +154 -14
- package/dist/generators/index.js.map +1 -0
- package/dist/index-26W7ItWx.d.ts +760 -0
- package/dist/index-BPPQjAfs.d.cts +2359 -0
- package/dist/index-BXjlgBLz.d.cts +2139 -0
- package/dist/index-B_Wwo91H.d.ts +2359 -0
- package/dist/index-CpufydcI.d.cts +704 -0
- package/dist/index-Czc4O526.d.ts +333 -0
- package/dist/index-DPs1_p5G.d.cts +760 -0
- package/dist/index-DRpOyBSC.d.ts +1703 -0
- package/dist/index-DWWvtHUn.d.cts +822 -0
- package/dist/index-DnM0LD0n.d.cts +333 -0
- package/dist/index-GUZ9fK6T.d.ts +2139 -0
- package/dist/index-I4fAzwXV.d.ts +704 -0
- package/dist/index-JDrOl_19.d.ts +822 -0
- package/dist/index-b66P49Qe.d.cts +1703 -0
- package/dist/isBigInt-B1cijjqm.cjs +20 -0
- package/dist/isBigInt-B1cijjqm.cjs.map +1 -0
- package/dist/isBigInt-C0bN0Rhu.js +14 -0
- package/dist/isBigInt-C0bN0Rhu.js.map +1 -0
- package/dist/isEmptyObject-DI42NEo0.cjs +37 -0
- package/dist/isEmptyObject-DI42NEo0.cjs.map +1 -0
- package/dist/isEmptyObject-DeLVIJpl.js +25 -0
- package/dist/isEmptyObject-DeLVIJpl.js.map +1 -0
- package/dist/isEmptyString-BTUWYTbw.js +15 -0
- package/dist/isEmptyString-BTUWYTbw.js.map +1 -0
- package/dist/isEmptyString-CCK3bP74.cjs +21 -0
- package/dist/isEmptyString-CCK3bP74.cjs.map +1 -0
- package/dist/isEmptyValue-DMSMFTU8.cjs +30 -0
- package/dist/isEmptyValue-DMSMFTU8.cjs.map +1 -0
- package/dist/isEmptyValue-fjnfQnt5.js +24 -0
- package/dist/isEmptyValue-fjnfQnt5.js.map +1 -0
- package/dist/isEqual-B1fRgEuU.cjs +111 -0
- package/dist/isEqual-B1fRgEuU.cjs.map +1 -0
- package/dist/isEqual-DhyP8fB_.js +87 -0
- package/dist/isEqual-DhyP8fB_.js.map +1 -0
- package/dist/isFinite-BYMOo0os.js +15 -0
- package/dist/isFinite-BYMOo0os.js.map +1 -0
- package/dist/isFinite-sFkps2TY.cjs +21 -0
- package/dist/isFinite-sFkps2TY.cjs.map +1 -0
- package/dist/isInteger-DS9V7l_f.js +14 -0
- package/dist/isInteger-DS9V7l_f.js.map +1 -0
- package/dist/isInteger-FTCthMre.cjs +20 -0
- package/dist/isInteger-FTCthMre.cjs.map +1 -0
- package/dist/isPlainObject-DcFGh3_5.d.ts +530 -0
- package/dist/isPlainObject-doTI11Ib.d.cts +530 -0
- package/dist/isServer-D1TXfOs3.js +14 -0
- package/dist/isServer-D1TXfOs3.js.map +1 -0
- package/dist/isServer-q-QLFCqE.cjs +20 -0
- package/dist/isServer-q-QLFCqE.cjs.map +1 -0
- package/dist/isTypedArray-47R0wdrc.js +31 -0
- package/dist/isTypedArray-47R0wdrc.js.map +1 -0
- package/dist/isTypedArray-DiCoqffZ.cjs +43 -0
- package/dist/isTypedArray-DiCoqffZ.cjs.map +1 -0
- package/dist/isURL-CQiowFq2.js +14 -0
- package/dist/isURL-CQiowFq2.js.map +1 -0
- package/dist/isURL-WZypXsax.cjs +20 -0
- package/dist/isURL-WZypXsax.cjs.map +1 -0
- package/dist/isValidDomain-BSXshgkC.cjs +1788 -0
- package/dist/isValidDomain-BSXshgkC.cjs.map +1 -0
- package/dist/isValidDomain-DwA2EN79.js +1782 -0
- package/dist/isValidDomain-DwA2EN79.js.map +1 -0
- package/dist/next/index.cjs +119 -214
- package/dist/next/index.cjs.map +1 -0
- package/dist/next/index.d.cts +226 -0
- package/dist/next/index.d.ts +26 -31
- package/dist/next/index.js +117 -212
- package/dist/next/index.js.map +1 -0
- package/dist/next/server/index.cjs +25 -40
- package/dist/next/server/index.cjs.map +1 -0
- package/dist/next/server/index.d.cts +39 -0
- package/dist/next/server/index.d.ts +9 -10
- package/dist/next/server/index.js +23 -38
- package/dist/next/server/index.js.map +1 -0
- package/dist/noop-B2mTBhW-.cjs +18 -0
- package/dist/noop-B2mTBhW-.cjs.map +1 -0
- package/dist/noop-BzktGBVz.js +12 -0
- package/dist/noop-BzktGBVz.js.map +1 -0
- package/dist/normalizeSpaces-DQHR3Tlr.cjs +29 -0
- package/dist/normalizeSpaces-DQHR3Tlr.cjs.map +1 -0
- package/dist/normalizeSpaces-WS_iERJk.js +23 -0
- package/dist/normalizeSpaces-WS_iERJk.js.map +1 -0
- package/dist/normalizeString-2WLth_Gj.js +15 -0
- package/dist/normalizeString-2WLth_Gj.js.map +1 -0
- package/dist/normalizeString-D8euBcRD.cjs +21 -0
- package/dist/normalizeString-D8euBcRD.cjs.map +1 -0
- package/dist/operations/index.cjs +65 -32
- package/dist/operations/index.cjs.map +1 -0
- package/dist/operations/index.d.cts +139 -0
- package/dist/operations/index.d.ts +10 -15
- package/dist/operations/index.js +61 -17
- package/dist/operations/index.js.map +1 -0
- package/dist/parsers/index.cjs +12 -19
- package/dist/parsers/index.d.cts +239 -0
- package/dist/parsers/index.d.ts +71 -72
- package/dist/parsers/index.js +10 -12
- package/dist/parsers-DXtpsDyj.cjs +649 -0
- package/dist/parsers-DXtpsDyj.cjs.map +1 -0
- package/dist/parsers-Dpuq-V4u.js +643 -0
- package/dist/parsers-Dpuq-V4u.js.map +1 -0
- package/dist/parsing-B43x1sxn.js +50 -0
- package/dist/parsing-B43x1sxn.js.map +1 -0
- package/dist/parsing-lRoxn1Nz.cjs +56 -0
- package/dist/parsing-lRoxn1Nz.cjs.map +1 -0
- package/dist/predicates/index.cjs +91 -296
- package/dist/predicates/index.d.cts +13 -0
- package/dist/predicates/index.d.ts +12 -2482
- package/dist/predicates/index.js +23 -25
- package/dist/predicates-DiaYA7Ps.cjs +413 -0
- package/dist/predicates-DiaYA7Ps.cjs.map +1 -0
- package/dist/predicates-gNepszvo.js +257 -0
- package/dist/predicates-gNepszvo.js.map +1 -0
- package/dist/promises/index.cjs +76 -24
- package/dist/promises/index.cjs.map +1 -0
- package/dist/promises/index.d.cts +123 -0
- package/dist/promises/index.d.ts +28 -31
- package/dist/promises/index.js +73 -13
- package/dist/promises/index.js.map +1 -0
- package/dist/punyCode-CTWXVVFo.cjs +185 -0
- package/dist/punyCode-CTWXVVFo.cjs.map +1 -0
- package/dist/punyCode-hmiFzLWT.js +179 -0
- package/dist/punyCode-hmiFzLWT.js.map +1 -0
- package/dist/removeSpaces-BE8lfh-4.js +19 -0
- package/dist/removeSpaces-BE8lfh-4.js.map +1 -0
- package/dist/removeSpaces-DRRxNWlb.cjs +25 -0
- package/dist/removeSpaces-DRRxNWlb.cjs.map +1 -0
- package/dist/safeJsonParse-BBnQElk8.cjs +208 -0
- package/dist/safeJsonParse-BBnQElk8.cjs.map +1 -0
- package/dist/safeJsonParse-CXruaP0p.js +184 -0
- package/dist/safeJsonParse-CXruaP0p.js.map +1 -0
- package/dist/safeStableStringify-BNh3D0K0.js +88 -0
- package/dist/safeStableStringify-BNh3D0K0.js.map +1 -0
- package/dist/safeStableStringify-Cc62pfRp.cjs +106 -0
- package/dist/safeStableStringify-Cc62pfRp.cjs.map +1 -0
- package/dist/strings/index.cjs +76 -81
- package/dist/strings/index.cjs.map +1 -0
- package/dist/strings/index.d.cts +12 -0
- package/dist/strings/index.d.ts +10 -775
- package/dist/strings/index.js +59 -14
- package/dist/strings/index.js.map +1 -0
- package/dist/tailwind/index.cjs +19 -47
- package/dist/tailwind/index.d.cts +12 -0
- package/dist/tailwind/index.d.ts +11 -712
- package/dist/tailwind/index.js +10 -12
- package/dist/tailwind-DJ4cmLUw.cjs +247 -0
- package/dist/tailwind-DJ4cmLUw.cjs.map +1 -0
- package/dist/tailwind-IJvOdkZp.js +199 -0
- package/dist/tailwind-IJvOdkZp.js.map +1 -0
- package/dist/toStringArrayUnRecursive-CFs0jTEg.js +39 -0
- package/dist/toStringArrayUnRecursive-CFs0jTEg.js.map +1 -0
- package/dist/toStringArrayUnRecursive-xUaU8Ot9.cjs +51 -0
- package/dist/toStringArrayUnRecursive-xUaU8Ot9.cjs.map +1 -0
- package/dist/urls/index.cjs +129 -57
- package/dist/urls/index.cjs.map +1 -0
- package/dist/urls/index.d.cts +740 -0
- package/dist/urls/index.d.ts +218 -224
- package/dist/urls/index.js +121 -26
- package/dist/urls/index.js.map +1 -0
- package/package.json +203 -194
- package/dist/chunk-2AFQ33D3.cjs +0 -64
- package/dist/chunk-2CYDJVGM.js +0 -246
- package/dist/chunk-2MW4JDQ2.cjs +0 -598
- package/dist/chunk-2VTDXC3N.cjs +0 -1825
- package/dist/chunk-44XX2P34.js +0 -209
- package/dist/chunk-4YLBKLGS.cjs +0 -18
- package/dist/chunk-566CXQW7.cjs +0 -560
- package/dist/chunk-57EPKYID.cjs +0 -397
- package/dist/chunk-5MGEC3YG.js +0 -63
- package/dist/chunk-6EF52423.cjs +0 -249
- package/dist/chunk-6SCOKU3S.js +0 -109
- package/dist/chunk-6VUXD3CF.js +0 -119
- package/dist/chunk-7B76BSNK.cjs +0 -118
- package/dist/chunk-7Y6I2DSU.cjs +0 -101
- package/dist/chunk-A7S7E2EE.cjs +0 -308
- package/dist/chunk-AJZ6PMMZ.js +0 -16
- package/dist/chunk-AXGBL2IO.cjs +0 -251
- package/dist/chunk-B4TC6FBV.cjs +0 -678
- package/dist/chunk-BAV5T2E3.cjs +0 -15
- package/dist/chunk-BKIJBNIE.js +0 -21
- package/dist/chunk-BNIMTFK5.js +0 -59
- package/dist/chunk-BXW7YXB7.js +0 -1823
- package/dist/chunk-CFYZC4S6.js +0 -53
- package/dist/chunk-CSG4SCL3.js +0 -1587
- package/dist/chunk-CWQW7AKK.js +0 -676
- package/dist/chunk-DVMHRLKP.cjs +0 -16
- package/dist/chunk-EN7LVZBZ.js +0 -548
- package/dist/chunk-EV4Y7HCY.cjs +0 -26
- package/dist/chunk-F66VDYIZ.cjs +0 -18
- package/dist/chunk-FLJX37EL.cjs +0 -30
- package/dist/chunk-GKC3UDMC.cjs +0 -1623
- package/dist/chunk-H65I3GRZ.cjs +0 -106
- package/dist/chunk-HHYWB7VZ.js +0 -24
- package/dist/chunk-HNGGISFL.cjs +0 -65
- package/dist/chunk-HNSQAVSZ.cjs +0 -35
- package/dist/chunk-HSP6IWZK.js +0 -17
- package/dist/chunk-IDZS7J6T.js +0 -242
- package/dist/chunk-JS6R55VL.js +0 -302
- package/dist/chunk-JZVT5FK7.js +0 -232
- package/dist/chunk-KHO2SBNA.cjs +0 -16
- package/dist/chunk-KIDJCMNJ.js +0 -33
- package/dist/chunk-KOLEURVT.cjs +0 -38
- package/dist/chunk-L4V53MQK.cjs +0 -269
- package/dist/chunk-L5RDAVVH.js +0 -14
- package/dist/chunk-NODTV4F3.js +0 -16
- package/dist/chunk-NYK5K3V2.cjs +0 -211
- package/dist/chunk-ODUO3RTL.cjs +0 -113
- package/dist/chunk-ONZFBJVW.js +0 -14
- package/dist/chunk-PFXCTE37.js +0 -28
- package/dist/chunk-PPST7QAQ.js +0 -587
- package/dist/chunk-Q5IMYDFL.cjs +0 -33
- package/dist/chunk-QFFBIOJ4.js +0 -31
- package/dist/chunk-QNKGP5DY.js +0 -14
- package/dist/chunk-RRQHMOPE.cjs +0 -19
- package/dist/chunk-RU5OSRBU.js +0 -95
- package/dist/chunk-SDMPEJ4F.js +0 -35
- package/dist/chunk-SYNL5IKP.js +0 -115
- package/dist/chunk-TCDOWZQE.js +0 -16
- package/dist/chunk-TQPGXGKB.cjs +0 -123
- package/dist/chunk-TULOI4GL.js +0 -370
- package/dist/chunk-UBHCP4N5.cjs +0 -36
- package/dist/chunk-UCHF3M34.cjs +0 -56
- package/dist/chunk-UDA26MCU.cjs +0 -16
- package/dist/chunk-V3C4FYZL.cjs +0 -18
- package/dist/chunk-VAAHZFBF.js +0 -32
- package/dist/chunk-VJDDGRIK.cjs +0 -16
- package/dist/chunk-WVSPXFTY.js +0 -14
- package/dist/chunk-WYP76WXB.js +0 -101
- package/dist/chunk-YDE4ZBB7.cjs +0 -237
- package/dist/chunk-YKQEOO7C.cjs +0 -23
- package/dist/chunk-YSZC56SZ.js +0 -264
- package/dist/chunk-YWHHVDT4.js +0 -13
- package/dist/index.d.ts +0 -24
- package/dist/isPlainObject-DTJVV2Kf.d.ts +0 -536
- package/dist/rzl-utils.global.js +0 -10
|
@@ -1,536 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* ====================================================
|
|
3
|
-
* Rzl Utils-JS.
|
|
4
|
-
* ----------------------------------------------------
|
|
5
|
-
* Version: 3.12.0.
|
|
6
|
-
* Author: Rizalvin Dwiky.
|
|
7
|
-
* Repository: https://github.com/rzl-zone/utils-js.
|
|
8
|
-
* ====================================================
|
|
9
|
-
*/
|
|
10
|
-
import { IsNever, NonPlainObject } from '@rzl-zone/ts-types-plus';
|
|
11
|
-
|
|
12
|
-
declare class PreciseType {
|
|
13
|
-
constructor(params?: GetPreciseTypeOptions);
|
|
14
|
-
/** ----------------------------------------------------------
|
|
15
|
-
* * ***Getting the internal map of type castable relationships used by {@link getPreciseType | `getPreciseType`}.***
|
|
16
|
-
* ----------------------------------------------------------
|
|
17
|
-
*
|
|
18
|
-
* - **Description:**
|
|
19
|
-
* - Returns an internal static mapping table that defines which primitive or structural types
|
|
20
|
-
* can be cast or interpreted as another related type within the internal logic of
|
|
21
|
-
* {@link getPreciseType | `getPreciseType`}.
|
|
22
|
-
*
|
|
23
|
-
* - **⚠️ Internal:**
|
|
24
|
-
* - This is an internal helper of {@link getPreciseType | `getPreciseType`}.
|
|
25
|
-
* - Do not modify or rely on this table directly — it is **readonly** and may change without notice.
|
|
26
|
-
*
|
|
27
|
-
* @readonly
|
|
28
|
-
*/
|
|
29
|
-
static get castableTable(): Readonly<Record<string, string>>;
|
|
30
|
-
/** ----------------------------------------------------------
|
|
31
|
-
* * ***Retrieves the internal list of special type cases handled by {@link getPreciseType | `getPreciseType`}.***
|
|
32
|
-
* ----------------------------------------------------------
|
|
33
|
-
*
|
|
34
|
-
* - **Description:**
|
|
35
|
-
* - Returns an internal readonly list of specific type identifiers that require
|
|
36
|
-
* *custom handling* during type detection.
|
|
37
|
-
* - These are **exceptional values** or **edge cases** that don’t follow the normal
|
|
38
|
-
* JavaScript type resolution flow.
|
|
39
|
-
*
|
|
40
|
-
* - **Example Values:**
|
|
41
|
-
* - `"Infinity"`, `"-Infinity"`, `"NaN"`, `"undefined"`, etc.
|
|
42
|
-
*
|
|
43
|
-
* - **⚠️ Internal:**
|
|
44
|
-
* - Used internally by {@link getPreciseType | `getPreciseType`}.
|
|
45
|
-
* - This property is **readonly** and should not be modified directly.
|
|
46
|
-
*
|
|
47
|
-
* @readonly
|
|
48
|
-
*/
|
|
49
|
-
static get specialType(): readonly ["-Infinity", "Infinity", "NaN"];
|
|
50
|
-
/** ----------------------------------------------------------
|
|
51
|
-
* * ***Retrieves the internal mapping of JavaScript built-in and environment-specific
|
|
52
|
-
* type identifiers to their canonical PascalCase names.***
|
|
53
|
-
* ----------------------------------------------------------
|
|
54
|
-
*
|
|
55
|
-
* - **Description:**
|
|
56
|
-
* - Provides a mapping table where **keys** represent normalized raw type names
|
|
57
|
-
* (as obtained from `Object.prototype.toString.call(value)` or environment checks),
|
|
58
|
-
* and **values** represent their **canonical PascalCase equivalents**.
|
|
59
|
-
* - This table ensures consistent, human-readable type strings across different environments.
|
|
60
|
-
*
|
|
61
|
-
* - **Example Mapping:**
|
|
62
|
-
* ```ts
|
|
63
|
-
* {
|
|
64
|
-
* "[object Map]": "Map",
|
|
65
|
-
* "[object WeakMap]": "WeakMap",
|
|
66
|
-
* "[object AsyncFunction]": "AsyncFunction",
|
|
67
|
-
* "[object GeneratorFunction]": "GeneratorFunction",
|
|
68
|
-
* "[object BigInt]": "BigInt",
|
|
69
|
-
* }
|
|
70
|
-
* ```
|
|
71
|
-
*
|
|
72
|
-
* - **⚠️ Internal:**
|
|
73
|
-
* - Used internally by {@link getPreciseType | `getPreciseType`}.
|
|
74
|
-
* - This property is **readonly** and should not be modified directly.
|
|
75
|
-
*
|
|
76
|
-
* @readonly
|
|
77
|
-
*/
|
|
78
|
-
static get fixesRaw(): Readonly<{
|
|
79
|
-
readonly string: "String";
|
|
80
|
-
readonly number: "Number";
|
|
81
|
-
readonly boolean: "Boolean";
|
|
82
|
-
readonly bigint: "Bigint";
|
|
83
|
-
readonly symbol: "Symbol";
|
|
84
|
-
readonly undefined: "Undefined";
|
|
85
|
-
readonly null: "Null";
|
|
86
|
-
readonly regexp: "Reg Exp";
|
|
87
|
-
readonly reflect: "Reflect";
|
|
88
|
-
readonly proxy: "Proxy";
|
|
89
|
-
readonly atomics: "Atomics";
|
|
90
|
-
readonly array: "Array";
|
|
91
|
-
readonly object: "Object";
|
|
92
|
-
readonly function: "Function";
|
|
93
|
-
readonly arguments: "Arguments";
|
|
94
|
-
readonly asyncfunction: "Async Function";
|
|
95
|
-
readonly generatorfunction: "Generator Function";
|
|
96
|
-
readonly asyncgeneratorfunction: "Async Generator Function";
|
|
97
|
-
readonly generator: "Generator";
|
|
98
|
-
readonly promise: "Promise";
|
|
99
|
-
readonly evalerror: "Eval Error";
|
|
100
|
-
readonly rangeerror: "Range Error";
|
|
101
|
-
readonly referenceerror: "Reference Error";
|
|
102
|
-
readonly syntaxerror: "Syntax Error";
|
|
103
|
-
readonly typeerror: "Type Error";
|
|
104
|
-
readonly urierror: "URI Error";
|
|
105
|
-
readonly aggregateerror: "Aggregate Error";
|
|
106
|
-
readonly error: "Error";
|
|
107
|
-
readonly int8array: "Int 8 Array";
|
|
108
|
-
readonly uint8array: "Uint 8 Array";
|
|
109
|
-
readonly uint8clampedarray: "Uint 8 Clamped Array";
|
|
110
|
-
readonly int16array: "Int 16 Array";
|
|
111
|
-
readonly uint16array: "Uint 16 Array";
|
|
112
|
-
readonly int32array: "Int 32 Array";
|
|
113
|
-
readonly uint32array: "Uint 32 Array";
|
|
114
|
-
readonly float32array: "Float 32 Array";
|
|
115
|
-
readonly float64array: "Float 64 Array";
|
|
116
|
-
readonly bigint64array: "Big Int 64 Array";
|
|
117
|
-
readonly biguint64array: "Big Uint 64 Array";
|
|
118
|
-
readonly arraybuffer: "Array Buffer";
|
|
119
|
-
readonly sharedarraybuffer: "Shared Array Buffer";
|
|
120
|
-
readonly dataview: "Data View";
|
|
121
|
-
readonly arraybufferview: "Array Buffer View";
|
|
122
|
-
readonly map: "Map";
|
|
123
|
-
readonly set: "Set";
|
|
124
|
-
readonly weakmap: "Weak Map";
|
|
125
|
-
readonly weakset: "Weak Set";
|
|
126
|
-
readonly mapiterator: "Map Iterator";
|
|
127
|
-
readonly weakmapiterator: "Weak Map Iterator";
|
|
128
|
-
readonly setiterator: "Set Iterator";
|
|
129
|
-
readonly weaksetiterator: "Weak Set Iterator";
|
|
130
|
-
readonly arrayiterator: "Array Iterator";
|
|
131
|
-
readonly stringiterator: "String Iterator";
|
|
132
|
-
readonly asynciterator: "Async Iterator";
|
|
133
|
-
readonly iteratorresult: "Iterator Result";
|
|
134
|
-
readonly arrayiteratorresult: "Array Iterator Result";
|
|
135
|
-
readonly readablestream: "Readable Stream";
|
|
136
|
-
readonly writablestream: "Writable Stream";
|
|
137
|
-
readonly transformstream: "Transform Stream";
|
|
138
|
-
readonly readablestreamdefaultreader: "Readable Stream Default Reader";
|
|
139
|
-
readonly writablestreamdefaultwriter: "Writable Stream Default Writer";
|
|
140
|
-
readonly readablestreamdefaultcontroller: "Readable Stream Default Controller";
|
|
141
|
-
readonly transformstreamdefaultcontroller: "Transform Stream Default Controller";
|
|
142
|
-
readonly abortcontroller: "Abort Controller";
|
|
143
|
-
readonly abortsignal: "Abort Signal";
|
|
144
|
-
readonly fetch: "fetch";
|
|
145
|
-
readonly request: "Request";
|
|
146
|
-
readonly response: "Response";
|
|
147
|
-
readonly headers: "Headers";
|
|
148
|
-
readonly formdata: "FormData";
|
|
149
|
-
readonly blob: "Blob";
|
|
150
|
-
readonly file: "File";
|
|
151
|
-
readonly filelist: "FileList";
|
|
152
|
-
readonly filereader: "FileReader";
|
|
153
|
-
readonly intl: "Intl";
|
|
154
|
-
readonly collator: "Intl. Collator";
|
|
155
|
-
readonly datetimeformat: "Intl. Date Time Format";
|
|
156
|
-
readonly displaynames: "Intl. Display Names";
|
|
157
|
-
readonly listformat: "Intl. List Format";
|
|
158
|
-
readonly locale: "Intl. Locale";
|
|
159
|
-
readonly numberformat: "Intl. Number Format";
|
|
160
|
-
readonly pluralrules: "Intl. Plural Rules";
|
|
161
|
-
readonly relativetimeformat: "Intl. Relative Time Format";
|
|
162
|
-
readonly segmenter: "Intl. Segmenter";
|
|
163
|
-
readonly weakref: "Weak Ref";
|
|
164
|
-
readonly urlpattern: "URLPattern";
|
|
165
|
-
readonly structuredclone: "structured Clone";
|
|
166
|
-
readonly finalizationregistry: "Finalization Registry";
|
|
167
|
-
readonly performance: "Performance";
|
|
168
|
-
readonly performanceobserver: "Performance Observer";
|
|
169
|
-
readonly performanceentry: "Performance Entry";
|
|
170
|
-
readonly performancemark: "Performance Mark";
|
|
171
|
-
readonly performancemeasure: "Performance Measure";
|
|
172
|
-
readonly webassembly: "Web Assembly";
|
|
173
|
-
readonly wasmmodule: "WebAssembly. Module";
|
|
174
|
-
readonly wasminstance: "WebAssembly. Instance";
|
|
175
|
-
readonly wasmmemory: "WebAssembly. Memory";
|
|
176
|
-
readonly wasmtable: "WebAssembly. Table";
|
|
177
|
-
readonly buffer: "Buffer";
|
|
178
|
-
readonly process: "Process";
|
|
179
|
-
readonly eventemitter: "Event Emitter";
|
|
180
|
-
readonly stream: "Stream";
|
|
181
|
-
readonly fs: "fs";
|
|
182
|
-
readonly path: "path";
|
|
183
|
-
readonly url: "URL";
|
|
184
|
-
readonly urlsearchparams: "URL Search Params";
|
|
185
|
-
readonly node: "Node";
|
|
186
|
-
readonly element: "Element";
|
|
187
|
-
readonly htmlelement: "HTML Element";
|
|
188
|
-
readonly svgelement: "SVG Element";
|
|
189
|
-
readonly document: "Document";
|
|
190
|
-
readonly documentfragment: "Document Fragment";
|
|
191
|
-
readonly shadowroot: "Shadow Root";
|
|
192
|
-
readonly nodelist: "Node List";
|
|
193
|
-
readonly htmlcollection: "HTML Collection";
|
|
194
|
-
readonly resizeobserver: "Resize Observer";
|
|
195
|
-
readonly mutationobserver: "Mutation Observer";
|
|
196
|
-
readonly intersectionobserver: "Intersection Observer";
|
|
197
|
-
readonly symboliterator: "Symbol. Iterator";
|
|
198
|
-
readonly symbolasynciterator: "Symbol. Async Iterator";
|
|
199
|
-
readonly symboltostringtag: "Symbol. To String Tag";
|
|
200
|
-
readonly symbolspecies: "Symbol. Species";
|
|
201
|
-
readonly symbolhasinstance: "Symbol. Has Instance";
|
|
202
|
-
readonly symbolisconcatspreadable: "Symbol. Is Concat Spreadable";
|
|
203
|
-
readonly symbolunscopables: "Symbol. Unscopables";
|
|
204
|
-
readonly symbolmatch: "Symbol. Match";
|
|
205
|
-
readonly symbolreplace: "Symbol. Replace";
|
|
206
|
-
readonly symbolsearch: "Symbol. Search";
|
|
207
|
-
readonly symbolsplit: "Symbol. Split";
|
|
208
|
-
readonly symboltoprimitive: "Symbol. To Primitive";
|
|
209
|
-
readonly symbolmatchall: "Symbol. Match All";
|
|
210
|
-
readonly symbolarguments: "Symbol. Arguments";
|
|
211
|
-
readonly math: "Math";
|
|
212
|
-
readonly bigintconstructor: "Bigint Constructor";
|
|
213
|
-
readonly numberconstructor: "Number Constructor";
|
|
214
|
-
readonly stringconstructor: "String Constructor";
|
|
215
|
-
readonly booleanconstructor: "Boolean Constructor";
|
|
216
|
-
readonly formdataevent: "Form Data Event";
|
|
217
|
-
readonly customevent: "Custom Event";
|
|
218
|
-
readonly messagechannel: "Message Channel";
|
|
219
|
-
readonly messageport: "Message Port";
|
|
220
|
-
readonly messageevent: "Message Event";
|
|
221
|
-
readonly websocket: "Web Socket";
|
|
222
|
-
readonly eventsource: "Event Source";
|
|
223
|
-
readonly indexeddb: "IndexedDB";
|
|
224
|
-
readonly idbrequest: "IDB Request";
|
|
225
|
-
readonly idbtransaction: "IDB Transaction";
|
|
226
|
-
readonly idbobjectstore: "IDB Object Store";
|
|
227
|
-
readonly idbcursor: "IDB Cursor";
|
|
228
|
-
readonly localstorage: "Local Storage";
|
|
229
|
-
readonly sessionstorage: "Session Storage";
|
|
230
|
-
readonly navigator: "Navigator";
|
|
231
|
-
readonly geolocation: "Geolocation";
|
|
232
|
-
readonly clipboard: "Clipboard";
|
|
233
|
-
readonly notification: "Notification";
|
|
234
|
-
readonly canvas: "Canvas";
|
|
235
|
-
readonly canvasrenderingcontext2d: "Canvas Rendering Context 2D";
|
|
236
|
-
readonly offscreencanvas: "Offscreen Canvas";
|
|
237
|
-
readonly webglrenderingcontext: "WebGL Rendering Context";
|
|
238
|
-
readonly imagedata: "Image Data";
|
|
239
|
-
readonly imagebitmap: "Image Bitmap";
|
|
240
|
-
readonly mediastream: "Media Stream";
|
|
241
|
-
readonly mediarecorder: "Media Recorder";
|
|
242
|
-
readonly mediastreamtrack: "Media Stream Track";
|
|
243
|
-
readonly audiocontext: "Audio Context";
|
|
244
|
-
readonly audiobuffer: "Audio Buffer";
|
|
245
|
-
readonly audioworklet: "Audio Worklet";
|
|
246
|
-
readonly worker: "Worker";
|
|
247
|
-
readonly sharedworker: "Shared Worker";
|
|
248
|
-
readonly serviceworker: "Service Worker";
|
|
249
|
-
readonly workerglobalscope: "Worker Global Scope";
|
|
250
|
-
readonly structuredcloneerror: "Structured Clone Error";
|
|
251
|
-
readonly transferable: "Transferable";
|
|
252
|
-
readonly report: "Report";
|
|
253
|
-
readonly console: "Console";
|
|
254
|
-
readonly diagnosticreport: "Diagnostic Report";
|
|
255
|
-
readonly domrect: "DOM Rect";
|
|
256
|
-
readonly dompoint: "DOM Point";
|
|
257
|
-
readonly dommatrix: "DOM Matrix";
|
|
258
|
-
readonly domparser: "DOM Parser";
|
|
259
|
-
readonly xmlhttprequest: "XML HTTP Request";
|
|
260
|
-
readonly customelementregistry: "Custom Element Registry";
|
|
261
|
-
readonly text: "Text";
|
|
262
|
-
readonly comment: "Comment";
|
|
263
|
-
readonly animation: "Animation";
|
|
264
|
-
readonly documenttype: "Document Type";
|
|
265
|
-
readonly characterdata: "Character Data";
|
|
266
|
-
readonly animationevent: "Animation Event";
|
|
267
|
-
readonly customemmetregistry: "Custom Emmet Registry";
|
|
268
|
-
readonly websocketmessageevent: "WebSocket Message Event";
|
|
269
|
-
}>;
|
|
270
|
-
/** ----------------------------------------------------------
|
|
271
|
-
* * ***Retrieves the internal list of common acronyms that should remain fully uppercase during string formatting.***
|
|
272
|
-
* ----------------------------------------------------------
|
|
273
|
-
*
|
|
274
|
-
* - **Description:**
|
|
275
|
-
* - This list defines acronyms (e.g., `"URL"`, `"HTTP"`, `"HTML"`, `"SVG"`, `"XML"`, `"DOM"`)
|
|
276
|
-
* that will be **preserved in uppercase** when applying case transformations through
|
|
277
|
-
* {@link getPreciseType | `getPreciseType`} or any formatting utility using it.
|
|
278
|
-
* - Ensures consistency in output for technical identifiers that are conventionally capitalized.
|
|
279
|
-
*
|
|
280
|
-
* - **Example:**
|
|
281
|
-
* ```ts
|
|
282
|
-
* ["URL", "HTTP", "HTML", "SVG", "XML", "DOM"]
|
|
283
|
-
* ```
|
|
284
|
-
*
|
|
285
|
-
* - **⚠️ Internal:**
|
|
286
|
-
* - Used internally by {@link getPreciseType | `getPreciseType`}.
|
|
287
|
-
* - This property is **readonly** and not intended for modification.
|
|
288
|
-
*
|
|
289
|
-
* @readonly
|
|
290
|
-
*/
|
|
291
|
-
static get acronymsList(): readonly ["URI", "URL", "URN", "HTTP", "HTTPS", "FTP", "FTPS", "SFTP", "SSH", "SMTP", "POP3", "IMAP", "WS", "WSS", "TCP", "UDP", "IP", "ICMP", "ARP", "RTP", "RTSP", "SIP", "HTML", "XHTML", "XML", "WBR", "CSS", "SVG", "JSON", "JSONP", "DOM", "IDB", "DB", "RTC", "ICE", "TLS", "SSL", "CORS", "WASM", "CSR", "SSR", "PWA", "DPI", "CDN", "JS", "TS", "JSX", "TSX", "CLI", "API", "SDK", "UI", "UX", "OS", "ID", "UUID", "PID", "NPM", "YARN", "ESM", "CJS", "BOM", "MVC", "MVVM", "ORM", "DAO", "CRUD", "FIFO", "LIFO", "OOP", "FP", "REPL", "CSV", "TSV", "SQL", "YAML", "JSON", "MD", "INI", "PDF", "XLS", "XLSX", "RTF", "XML", "BMP", "GIF", "PNG", "JPEG", "WEBP", "MP3", "MP4", "AVI", "MOV", "FLAC", "MKV", "WAV", "URLSearchParams", "XHR", "2D", "3D", "GL", "WebGL", "TTL", "UID", "GID", "MAC", "IP", "DNS", "DHCP", "VPN", "LAN", "WAN", "SSID", "IoT", "API", "SDK", "CLI", "LTS", "EOL", "CPU", "GPU", "RAM", "ROM", "SSD", "HDD", "BIOS", "USB", "PCI", "SATA", "DIMM", "DDR", "VGA", "HDMI", "KVM", "ASIC", "FPGA", "SoC", "NAS", "SAN", "TCP", "UDP", "IP", "MAC", "DNS", "DHCP", "VPN", "LAN", "WAN", "SSID", "NAT", "QoS", "MPLS", "BGP", "OSPF", "ICMP", "IGMP", "LLDP", "ARP", "RARP", "AES", "RSA", "OTP", "MFA", "PKI", "VPN", "IAM", "ACL", "CSP", "XSS", "CSRF", "HSTS", "WAF", "DDoS", "IDS", "IPS", "SOC", "SIEM", "AWS", "GCP", "AZURE", "CI", "CD", "K8S", "IaC", "PaaS", "SaaS", "IaaS", "API", "CLI", "SDK", "REST", "SOAP", "JSON-RPC", "gRPC", "ELB", "EKS", "AKS", "FaaS", "CaaS", "GUI", "IDE", "FAQ", "UX", "UI", "CLI", "API", "SDK", "LTS", "EOL", "WYSIWYG", "CMS", "CRM", "GPS", "LED", "OLED", "LCD", "RFID", "NFC", "CPU", "GPU", "AI", "ML", "DL", "DB", "SQL", "NoSQL", "ORM", "JSON", "XML", "CSV", "HTTP", "HTTPS", "TDD", "BDD", "CI", "CD", "QA", "SLA", "SLO", "MTTR", "MTBF", "UAT", "RPA", "KPI", "OKR", "ROI", "RFP", "SLA", "CRM", "ERP", "PMO", "SCRUM", "KANBAN", "FPS", "HDR", "VR", "AR", "3D", "2D", "MP3", "MP4", "GIF", "PNG", "JPEG", "SVG", "BMP", "TIFF", "POSIX", "NTFS", "FAT", "EXT", "EXT4", "APFS", "HFS", "ISO", "HTML", "CSS", "JS", "TS", "PHP", "SQL", "JSON", "XML", "YAML", "BASH", "ZSH", "JSON", "YAML", "INI", "DOTENV", "VM", "VMM", "VPC", "OCI", "LXC", "Docker", "K8S", "CRI", "CNI"];
|
|
292
|
-
}
|
|
293
|
-
|
|
294
|
-
/** ---------------------------------------------------------------------------
|
|
295
|
-
* * ***Options for controlling how {@link getPreciseType | `getPreciseType`} formats and normalizes detected types.***
|
|
296
|
-
* ---------------------------------------------------------------------------
|
|
297
|
-
* These options customize the string transformation behavior and acronym handling
|
|
298
|
-
* when converting JavaScript type names to human-readable strings.
|
|
299
|
-
*/
|
|
300
|
-
type GetPreciseTypeOptions = {
|
|
301
|
-
/** -------------------------------------------------------
|
|
302
|
-
* * ***Specifies the format in which the returned string type should be transformed.***
|
|
303
|
-
* -------------------------------------------------------
|
|
304
|
-
* **ℹ️ For special string literals in `SPECIAL_CASES` (`"-Infinity" | "Infinity" | "NaN"`), which will remain unchanged.**
|
|
305
|
-
* @default "toKebabCase"
|
|
306
|
-
* @description
|
|
307
|
-
* Supported formats:
|
|
308
|
-
* - `"toKebabCase"` (default) — words separated by hyphens.
|
|
309
|
-
* - ➔ `"result-example-type"`
|
|
310
|
-
* - `"toLowerCase"` - converts all letters to lowercase.
|
|
311
|
-
* - ➔ `"result example type"`
|
|
312
|
-
* - `"toDotCase"` — words separated by dots.
|
|
313
|
-
* - ➔ `"result.example.type"`
|
|
314
|
-
* - `"toCamelCase"` — first word lowercase, subsequent words capitalized.
|
|
315
|
-
* - ➔ `"resultExampleType"`
|
|
316
|
-
* - `"toSnakeCase"` — words separated by underscores.
|
|
317
|
-
* - ➔ `"result_example_type"`
|
|
318
|
-
* - `"toPascalCase"` — all words capitalized, no spaces.
|
|
319
|
-
* - ➔ `"ResultExampleType"`
|
|
320
|
-
* - `"toPascalCaseSpace"` — all words capitalized with spaces between words.
|
|
321
|
-
* - ➔ `"Result Example Type"`
|
|
322
|
-
* - `"slugify"` — URL-friendly slug (lowercase with hyphens).
|
|
323
|
-
* - ➔ `"result-example-type"`
|
|
324
|
-
* @note
|
|
325
|
-
* ⚠️ If an invalid value is provided, the function will automatically fallback to the default `"toKebabCase"`.
|
|
326
|
-
*/
|
|
327
|
-
formatCase?: "toPascalCaseSpace" | "toPascalCase" | "toCamelCase" | "toKebabCase" | "toSnakeCase" | "toDotCase" | "slugify" | "toLowerCase";
|
|
328
|
-
/** -------------------------------------------------------
|
|
329
|
-
* * ***Control uppercase preservation of recognized acronyms during formatting.***
|
|
330
|
-
* -------------------------------------------------------
|
|
331
|
-
* When enabled (`true`), common technical acronyms (e.g., `"URL"`, `"HTTP"`, `"HTML"`, `"SVG"`, `"XML"`, `"DOM"`)
|
|
332
|
-
* are preserved in their original uppercase form instead of being lowercased or altered by case-formatting utilities.
|
|
333
|
-
*
|
|
334
|
-
*
|
|
335
|
-
* - **When `false` (default):**
|
|
336
|
-
* - Acronyms are treated as normal words and formatted according to the selected `formatCase`.
|
|
337
|
-
* - Example:
|
|
338
|
-
* - `HTMLDivElement` ➔ `"html-div-element"` (with `"toKebabCase"`)
|
|
339
|
-
* - `DOMParser` ➔ `"dom-parser"`
|
|
340
|
-
* - **When `true`:**
|
|
341
|
-
* - Acronyms remain uppercase.
|
|
342
|
-
* - Example:
|
|
343
|
-
* - `HTMLDivElement` ➔ `"HTML-div-element"` (with `"toKebabCase"`)
|
|
344
|
-
* - `DOMParser` ➔ `"DOM-parser"`
|
|
345
|
-
*
|
|
346
|
-
* @default false
|
|
347
|
-
* @description
|
|
348
|
-
* The list of recognized acronyms is defined in {@link AcronymsList | **`AcronymsList`**},
|
|
349
|
-
* including entries like `"URL"`, `"HTTP"`, `"HTML"`, `"SVG"`, `"XML"`, `"DOM"`, and others.
|
|
350
|
-
*
|
|
351
|
-
* ⚠️ This option affects **formatting output only**, not the underlying type detection, acronym preservation is applied **after** detecting and formatting the base type name.
|
|
352
|
-
*/
|
|
353
|
-
useAcronyms?: boolean;
|
|
354
|
-
};
|
|
355
|
-
/** ---------------------------------------------------------------------------
|
|
356
|
-
* * ***Type alias for the list of common acronyms preserved in uppercase.***
|
|
357
|
-
* ---------------------------------------------------------------------------
|
|
358
|
-
*
|
|
359
|
-
* Use this type to reference the full set of recognized acronyms
|
|
360
|
-
* used internally by the {@link getPreciseType | **`getPreciseType`**} function for formatting purposes.
|
|
361
|
-
*/
|
|
362
|
-
type AcronymsList = (typeof PreciseType)["acronymsList"];
|
|
363
|
-
/** ----------------------------------------------------------
|
|
364
|
-
* * ***Utility-Predicate: `getPreciseType`.***
|
|
365
|
-
* ----------------------------------------------------------
|
|
366
|
-
* **Returns a detailed and normalized type string for the given value.**
|
|
367
|
-
* @description
|
|
368
|
-
* The returned string is human-readable ***toKebabCase*** with spaces ***(by default)*** or formatted according to the `options.formatCase` setting.
|
|
369
|
-
* - **Handles:**
|
|
370
|
-
* - Primitives (`string`, `number`, `boolean`, `null`, `undefined`, `symbol`, `bigint`)
|
|
371
|
-
* - Built-in objects (`Array`, `Map`, `Set`, `Error subclasses`, `Typed Arrays`, `etc`)
|
|
372
|
-
* - Objects created with `Object.create(null)`
|
|
373
|
-
* - Objects wrapper (`new String`, `new Number`, `new Boolean`)
|
|
374
|
-
* - DOM Node type (may not be fully accurate outside the browser environment)
|
|
375
|
-
* - Generator instances
|
|
376
|
-
* - Node.js `Buffer` instances
|
|
377
|
-
* - Proxy detection (returns `"Proxy"` if detected; detection ***is not 100% accurate***)
|
|
378
|
-
* - Uses cached mapping table (`FIXES_CASTABLE_TABLE`) for known types to provide consistent naming
|
|
379
|
-
* - Falls back to constructor name or `Object.prototype.toString` tag
|
|
380
|
-
* @param {*} value - The value to detect the precise type of
|
|
381
|
-
* @param {GetPreciseTypeOptions} [options] - Optional configuration
|
|
382
|
-
* @param {GetPreciseTypeOptions["formatCase"]} [options.formatCase="toLowerCase"]
|
|
383
|
-
* Specifies how the returned type string should be formatted.
|
|
384
|
-
* - ⚠️ Special string literals in `SPECIAL_CASES`
|
|
385
|
-
* (`"-Infinity" | "Infinity" | "NaN"`) will remain
|
|
386
|
-
* unchanged even if a different `formatCase` is applied.
|
|
387
|
-
* @param {boolean} [options.useAcronyms=false]
|
|
388
|
-
* Control uppercase preservation of recognized acronyms during formatting.
|
|
389
|
-
* - When `true`, recognized acronyms such as `"URL"`, `"HTTP"`, `"HTML"`, `"SVG"`, `"XML"`, and `"DOM"`
|
|
390
|
-
* are preserved in uppercase instead of being lowercased or otherwise transformed.
|
|
391
|
-
* - When `false` (default), acronyms are formatted like regular words according to `formatCase`.
|
|
392
|
-
* - ⚠️ This option affects **formatting output only**, not type detection.
|
|
393
|
-
*
|
|
394
|
-
* @returns {string} The normalized and formatted type string
|
|
395
|
-
* @example
|
|
396
|
-
* getPreciseType(123); // ➔ "number"
|
|
397
|
-
* getPreciseType(null); // ➔ "null"
|
|
398
|
-
* getPreciseType(/regex/); // ➔ "reg-exp"
|
|
399
|
-
* getPreciseType(/regex/, { formatCase: "toPascalCase" });
|
|
400
|
-
* // ➔ "RegExp"
|
|
401
|
-
* getPreciseType(function* () {}, { formatCase: "toCamelCase" });
|
|
402
|
-
* // ➔ "generatorFunction"
|
|
403
|
-
* getPreciseType(async function () {}, { formatCase: "toPascalCaseSpace" });
|
|
404
|
-
* // ➔ "Async Function"
|
|
405
|
-
*
|
|
406
|
-
* // (SPECIAL_CASES remain)
|
|
407
|
-
* getPreciseType(NaN, { formatCase: "toLowerCase" });
|
|
408
|
-
* // ➔ "NaN"
|
|
409
|
-
* getPreciseType(Infinity, { formatCase: "toLowerCase" });
|
|
410
|
-
* // ➔ "Infinity"
|
|
411
|
-
* getPreciseType(-Infinity, { formatCase: "toLowerCase" });
|
|
412
|
-
* // ➔ "-Infinity"
|
|
413
|
-
*
|
|
414
|
-
* // Acronym usage examples:
|
|
415
|
-
* getPreciseType(new URL("https://example.com"));
|
|
416
|
-
* // ➔ "url"
|
|
417
|
-
* getPreciseType(new URL("https://example.com"), { useAcronyms: true });
|
|
418
|
-
* // ➔ "URL"
|
|
419
|
-
*
|
|
420
|
-
* getPreciseType(new URLSearchParams, { formatCase: "toPascalCase" });
|
|
421
|
-
* // ➔ "UrlSearchParams"
|
|
422
|
-
* getPreciseType(new URLSearchParams, { formatCase: "toPascalCase", useAcronyms: true });
|
|
423
|
-
* // ➔ "URLSearchParams"
|
|
424
|
-
*/
|
|
425
|
-
declare const getPreciseType: (value: unknown, options?: GetPreciseTypeOptions) => string;
|
|
426
|
-
|
|
427
|
-
type IsNumberOptions = {
|
|
428
|
-
/** If set to `true`, `NaN` will be considered a valid number, defaultValue: `false`.
|
|
429
|
-
*
|
|
430
|
-
* @default false
|
|
431
|
-
*/
|
|
432
|
-
includeNaN?: boolean;
|
|
433
|
-
};
|
|
434
|
-
/** ---------------------------------------------------------
|
|
435
|
-
* * ***Type guard: `isNumber`.***
|
|
436
|
-
* ----------------------------------------------------------
|
|
437
|
-
* **Checks if a value is of type **`number`**.**
|
|
438
|
-
* - **Behavior:**
|
|
439
|
-
* - Uses `typeof value === "number"`.
|
|
440
|
-
* - By default, excludes **`NaN`**.
|
|
441
|
-
* - If `options.includeNaN` is `true`, then **`NaN`** is also considered valid.
|
|
442
|
-
* - Still considers `Infinity` and `-Infinity` as **numbers** (consistent with JavaScript).
|
|
443
|
-
* - **ℹ️ Note:**
|
|
444
|
-
* - To exclude `Infinity` and `-Infinity`, use **{@link isFinite | `isFinite`}** instead.
|
|
445
|
-
* @param {*} value - The value to check.
|
|
446
|
-
* @param {IsNumberOptions} [options] - Optional settings.
|
|
447
|
-
* @param {boolean} [options.includeNaN=false] If `true`, `NaN` will be considered a valid number, defaults to `false`, which excludes `NaN`.
|
|
448
|
-
* @returns {boolean} Returns `true` if the value is a number (and depending on `includeNaN`, `NaN` is included or excluded).
|
|
449
|
-
* @example
|
|
450
|
-
* isNumber(42);
|
|
451
|
-
* // ➔ true
|
|
452
|
-
* isNumber(Infinity);
|
|
453
|
-
* // ➔ true
|
|
454
|
-
* isNumber(-Infinity);
|
|
455
|
-
* // ➔ true
|
|
456
|
-
* isNumber(NaN);
|
|
457
|
-
* // ➔ false (default)
|
|
458
|
-
* isNumber(NaN, { includeNaN: true });
|
|
459
|
-
* // ➔ true
|
|
460
|
-
* isNumber("42");
|
|
461
|
-
* // ➔ false
|
|
462
|
-
*/
|
|
463
|
-
declare const isNumber: (value: unknown, options?: IsNumberOptions) => value is number;
|
|
464
|
-
|
|
465
|
-
type ArrayFallback<T> = IsNever<Extract<T, unknown[] | readonly unknown[]>> extends true ? T & unknown[] : Extract<T, unknown[] | readonly unknown[]>;
|
|
466
|
-
|
|
467
|
-
type IsHasKeysObject<T> = keyof T extends never ? false : true;
|
|
468
|
-
|
|
469
|
-
/** ----------------------------------------------------------
|
|
470
|
-
* * ***Utility type: `IsPlainObjectResult`.***
|
|
471
|
-
* ----------------------------------------------------------
|
|
472
|
-
* **Represents the inferred type after asserting a value is a **plain object**.**
|
|
473
|
-
* - **Behavior:**
|
|
474
|
-
* - If `T` is `unknown`, the resulting type is `Record<PropertyKey, unknown> & T`.
|
|
475
|
-
* - If `T` is an object:
|
|
476
|
-
* - If it is a non-plain object (class instance, built-in object, etc.), the result is `never`.
|
|
477
|
-
* - If it has no keys (`IsHasKeysObject<T>` checked by **{@link IsHasKeysObject|`IsHasKeysObject`}** is false), the result is `Record<PropertyKey, unknown> & T`.
|
|
478
|
-
* - Otherwise, the result is `T` itself.
|
|
479
|
-
* - For any other types, the result is `never`.
|
|
480
|
-
* @template T - The input type to be asserted as a plain object.
|
|
481
|
-
* @example
|
|
482
|
-
* ```ts
|
|
483
|
-
* type A = IsPlainObjectResult<unknown>;
|
|
484
|
-
* // ➔ Record<PropertyKey, unknown> & unknown
|
|
485
|
-
* type B = IsPlainObjectResult<{}>;
|
|
486
|
-
* // ➔ Record<PropertyKey, unknown> & {}
|
|
487
|
-
* type C = IsPlainObjectResult<{ foo: string }>;
|
|
488
|
-
* // ➔ { foo: string }
|
|
489
|
-
* type D = IsPlainObjectResult<Date>;
|
|
490
|
-
* // ➔ never
|
|
491
|
-
* ```
|
|
492
|
-
*/
|
|
493
|
-
type IsPlainObjectResult<T> = unknown extends T ? Record<PropertyKey, unknown> & T : T extends object ? T extends NonPlainObject ? never : IsHasKeysObject<T> extends false ? Record<PropertyKey, unknown> & T : T : Extract<T, Record<PropertyKey, unknown>>;
|
|
494
|
-
/** ----------------------------------------------------------
|
|
495
|
-
* * ***Type guard: `isPlainObject`.***
|
|
496
|
-
* ----------------------------------------------------------
|
|
497
|
-
* **Checks if a value is a **plain-object**.**
|
|
498
|
-
* - **A plain object is:**
|
|
499
|
-
* - Created by the `Object` constructor, or
|
|
500
|
-
* - Has a `[[Prototype]]` of `null` (e.g. `Object.create(null)`).
|
|
501
|
-
* - **✅ Returns `true` for:**
|
|
502
|
-
* - Empty object literals: `{}`
|
|
503
|
-
* - Objects with null prototype: `Object.create(null)`
|
|
504
|
-
* - **❌ Returns `false` for:**
|
|
505
|
-
* - Arrays (`[]`, `new Array()`)
|
|
506
|
-
* - Functions (regular, arrow, or class constructors)
|
|
507
|
-
* - Built-in objects: `Date`, `RegExp`, `Error`, `Map`, `Set`, `WeakMap`, `WeakSet`
|
|
508
|
-
* - Boxed primitives: `new String()`, `new Number()`, `new Boolean()`
|
|
509
|
-
* - `null` or `undefined`
|
|
510
|
-
* - Symbols
|
|
511
|
-
* - Class instances
|
|
512
|
-
* @template T - The type of the value being checked.
|
|
513
|
-
* @param {*} value - The value to check.
|
|
514
|
-
* @returns {boolean} Return `true` if `value` is a `plain-object`, otherwise `false`.
|
|
515
|
-
* @example
|
|
516
|
-
* isPlainObject({});
|
|
517
|
-
* // ➔ true
|
|
518
|
-
* isPlainObject(Object.create(null));
|
|
519
|
-
* // ➔ true
|
|
520
|
-
* isPlainObject(null);
|
|
521
|
-
* // ➔ false
|
|
522
|
-
* isPlainObject(() => {});
|
|
523
|
-
* // ➔ false
|
|
524
|
-
* isPlainObject([1, 2, 3]);
|
|
525
|
-
* // ➔ false
|
|
526
|
-
* isPlainObject(new Date());
|
|
527
|
-
* // ➔ false
|
|
528
|
-
* isPlainObject(new MyClass());
|
|
529
|
-
* // ➔ false
|
|
530
|
-
* isPlainObject(new String("x"));
|
|
531
|
-
* // ➔ false
|
|
532
|
-
*/
|
|
533
|
-
declare function isPlainObject<T>(value: T): value is IsPlainObjectResult<T>;
|
|
534
|
-
declare function isPlainObject<T>(value: T): value is NonNullable<Extract<T, Record<PropertyKey, unknown>>>;
|
|
535
|
-
|
|
536
|
-
export { type AcronymsList as A, type GetPreciseTypeOptions as G, type IsNumberOptions as I, type IsPlainObjectResult as a, isPlainObject as b, type ArrayFallback as c, type IsHasKeysObject as d, getPreciseType as g, isNumber as i };
|