@rzl-zone/utils-js 3.12.0 → 3.12.1-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/{LICENSE.md → LICENSE} +3 -3
- package/README.md +69 -96
- package/dist/.references/index.d.cts +25 -0
- package/dist/.references/index.d.ts +25 -0
- package/dist/assertIsArray-DJXkjHZs.cjs +26 -0
- package/dist/assertIsArray-DJXkjHZs.cjs.map +1 -0
- package/dist/assertIsArray-bTA3XLjq.js +20 -0
- package/dist/assertIsArray-bTA3XLjq.js.map +1 -0
- package/dist/assertIsBoolean-C8WEXVr2.cjs +1283 -0
- package/dist/assertIsBoolean-C8WEXVr2.cjs.map +1 -0
- package/dist/assertIsBoolean-DR1SaXPD.js +1073 -0
- package/dist/assertIsBoolean-DR1SaXPD.js.map +1 -0
- package/dist/assertIsString-BiHQSrB2.cjs +26 -0
- package/dist/assertIsString-BiHQSrB2.cjs.map +1 -0
- package/dist/assertIsString-CEB07_83.js +20 -0
- package/dist/assertIsString-CEB07_83.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-BNIh_tCH.js +380 -0
- package/dist/conversions-BNIh_tCH.js.map +1 -0
- package/dist/conversions-D_Kh0a_C.cjs +446 -0
- package/dist/conversions-D_Kh0a_C.cjs.map +1 -0
- package/dist/events/index.cjs +55 -31
- package/dist/events/index.cjs.map +1 -0
- package/dist/events/index.d.cts +176 -0
- package/dist/events/index.d.ts +164 -166
- package/dist/events/index.js +50 -12
- package/dist/events/index.js.map +1 -0
- package/dist/formatEnvPort-B3OLxQk9.cjs +171 -0
- package/dist/formatEnvPort-B3OLxQk9.cjs.map +1 -0
- package/dist/formatEnvPort-ByFVLjSV.js +159 -0
- package/dist/formatEnvPort-ByFVLjSV.js.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--1m_vpE8.js +369 -0
- package/dist/formatters--1m_vpE8.js.map +1 -0
- package/dist/formatters-Cbij0XLU.cjs +429 -0
- package/dist/formatters-Cbij0XLU.cjs.map +1 -0
- package/dist/generators/index.cjs +165 -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 +158 -14
- package/dist/generators/index.js.map +1 -0
- package/dist/index-59zbLcPr.d.ts +340 -0
- package/dist/index-B6tawc8L.d.cts +1716 -0
- package/dist/index-C267akkJ.d.ts +2158 -0
- package/dist/index-CeBC2Vvl.d.cts +2361 -0
- package/dist/index-CgRDTI6f.d.ts +822 -0
- package/dist/index-CoiUBVmr.d.ts +720 -0
- package/dist/index-D4fcasfZ.d.cts +720 -0
- package/dist/index-DDrSQKIc.d.ts +1716 -0
- package/dist/index-DsGxO31H.d.cts +765 -0
- package/dist/index-Hg1qJkjl.d.ts +765 -0
- package/dist/index-Qm3iFwd0.d.cts +2158 -0
- package/dist/index-UPp94Agr.d.ts +2361 -0
- package/dist/index-gBA_8SuF.d.cts +340 -0
- package/dist/index-jyDqzicx.d.cts +822 -0
- package/dist/isBigInt-C4krUeAw.cjs +20 -0
- package/dist/isBigInt-C4krUeAw.cjs.map +1 -0
- package/dist/isBigInt-DKe0M6hp.js +14 -0
- package/dist/isBigInt-DKe0M6hp.js.map +1 -0
- package/dist/isEmptyObject-DCipFwxJ.js +25 -0
- package/dist/isEmptyObject-DCipFwxJ.js.map +1 -0
- package/dist/isEmptyObject-ZkSwRC_D.cjs +37 -0
- package/dist/isEmptyObject-ZkSwRC_D.cjs.map +1 -0
- package/dist/isEmptyString-BXzKAC2j.js +15 -0
- package/dist/isEmptyString-BXzKAC2j.js.map +1 -0
- package/dist/isEmptyString-UiiUsSQj.cjs +21 -0
- package/dist/isEmptyString-UiiUsSQj.cjs.map +1 -0
- package/dist/isEmptyValue-BQzcjVaL.cjs +30 -0
- package/dist/isEmptyValue-BQzcjVaL.cjs.map +1 -0
- package/dist/isEmptyValue-jqOr7OHD.js +24 -0
- package/dist/isEmptyValue-jqOr7OHD.js.map +1 -0
- package/dist/isEqual-BX49cF9m.js +87 -0
- package/dist/isEqual-BX49cF9m.js.map +1 -0
- package/dist/isEqual-BvumA3RA.cjs +111 -0
- package/dist/isEqual-BvumA3RA.cjs.map +1 -0
- package/dist/isFinite-BCnaDpod.js +15 -0
- package/dist/isFinite-BCnaDpod.js.map +1 -0
- package/dist/isFinite-D24ZaE6c.cjs +21 -0
- package/dist/isFinite-D24ZaE6c.cjs.map +1 -0
- package/dist/isInteger-Caeuz0rB.cjs +20 -0
- package/dist/isInteger-Caeuz0rB.cjs.map +1 -0
- package/dist/isInteger-naMbJsxJ.js +14 -0
- package/dist/isInteger-naMbJsxJ.js.map +1 -0
- package/dist/isPlainObject-BF-2-phb.d.cts +339 -0
- package/dist/isPlainObject-DxNDL8XU.d.ts +339 -0
- package/dist/isServer-BJHVnixd.cjs +20 -0
- package/dist/isServer-BJHVnixd.cjs.map +1 -0
- package/dist/isServer-Da3o3XSs.js +14 -0
- package/dist/isServer-Da3o3XSs.js.map +1 -0
- package/dist/isTypedArray-DuNA8tK6.js +31 -0
- package/dist/isTypedArray-DuNA8tK6.js.map +1 -0
- package/dist/isTypedArray-TJptiw2b.cjs +43 -0
- package/dist/isTypedArray-TJptiw2b.cjs.map +1 -0
- package/dist/isURL-C-kSk6KJ.js +14 -0
- package/dist/isURL-C-kSk6KJ.js.map +1 -0
- package/dist/isURL-DeUPO_oR.cjs +20 -0
- package/dist/isURL-DeUPO_oR.cjs.map +1 -0
- package/dist/isValidDomain-BB9IGhJs.cjs +1845 -0
- package/dist/isValidDomain-BB9IGhJs.cjs.map +1 -0
- package/dist/isValidDomain-DoE98yhJ.js +1827 -0
- package/dist/isValidDomain-DoE98yhJ.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 +220 -0
- package/dist/next/index.d.ts +203 -214
- 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 +34 -35
- package/dist/next/server/index.js +23 -38
- package/dist/next/server/index.js.map +1 -0
- package/dist/noop-B13_ii35.cjs +18 -0
- package/dist/noop-B13_ii35.cjs.map +1 -0
- package/dist/noop-ubqAIbHD.js +12 -0
- package/dist/noop-ubqAIbHD.js.map +1 -0
- package/dist/normalizeSpaces-Bg2IZW7W.js +23 -0
- package/dist/normalizeSpaces-Bg2IZW7W.js.map +1 -0
- package/dist/normalizeSpaces-ZXnR4Qzp.cjs +29 -0
- package/dist/normalizeSpaces-ZXnR4Qzp.cjs.map +1 -0
- package/dist/normalizeString-BDdkaXui.js +15 -0
- package/dist/normalizeString-BDdkaXui.js.map +1 -0
- package/dist/normalizeString-BE6ELqEb.cjs +21 -0
- package/dist/normalizeString-BE6ELqEb.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 +129 -134
- 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 +234 -235
- package/dist/parsers/index.js +10 -12
- package/dist/parsers-BSBPgvsq.js +643 -0
- package/dist/parsers-BSBPgvsq.js.map +1 -0
- package/dist/parsers-OqDeffqc.cjs +649 -0
- package/dist/parsers-OqDeffqc.cjs.map +1 -0
- package/dist/parsing-Cao8b358.js +50 -0
- package/dist/parsing-Cao8b358.js.map +1 -0
- package/dist/parsing-DOGSCH6N.cjs +56 -0
- package/dist/parsing-DOGSCH6N.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-Bj6meyXV.js +256 -0
- package/dist/predicates-Bj6meyXV.js.map +1 -0
- package/dist/predicates-D0ubqgqy.cjs +412 -0
- package/dist/predicates-D0ubqgqy.cjs.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 +116 -119
- package/dist/promises/index.js +73 -13
- package/dist/promises/index.js.map +1 -0
- package/dist/punyCode-8SrbMWfM.js +179 -0
- package/dist/punyCode-8SrbMWfM.js.map +1 -0
- package/dist/punyCode-D-Qu6nj6.cjs +185 -0
- package/dist/punyCode-D-Qu6nj6.cjs.map +1 -0
- package/dist/removeSpaces-Bmc5DX4F.js +19 -0
- package/dist/removeSpaces-Bmc5DX4F.js.map +1 -0
- package/dist/removeSpaces-CWIvhZHg.cjs +25 -0
- package/dist/removeSpaces-CWIvhZHg.cjs.map +1 -0
- package/dist/rzl-utils.global.js +20 -9
- package/dist/safeJsonParse-BP38mwlj.js +184 -0
- package/dist/safeJsonParse-BP38mwlj.js.map +1 -0
- package/dist/safeJsonParse-Sms2CJf4.cjs +208 -0
- package/dist/safeJsonParse-Sms2CJf4.cjs.map +1 -0
- package/dist/safeStableStringify-CJtP89qn.cjs +106 -0
- package/dist/safeStableStringify-CJtP89qn.cjs.map +1 -0
- package/dist/safeStableStringify-CXOZ9Ub8.js +88 -0
- package/dist/safeStableStringify-CXOZ9Ub8.js.map +1 -0
- package/dist/strings/index.cjs +79 -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 +62 -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-B2ssevxq.js +199 -0
- package/dist/tailwind-B2ssevxq.js.map +1 -0
- package/dist/tailwind-CHIx9uxu.cjs +247 -0
- package/dist/tailwind-CHIx9uxu.cjs.map +1 -0
- package/dist/toStringArrayUnRecursive-C4zYCja7.cjs +51 -0
- package/dist/toStringArrayUnRecursive-C4zYCja7.cjs.map +1 -0
- package/dist/toStringArrayUnRecursive-DJGtPsFb.js +39 -0
- package/dist/toStringArrayUnRecursive-DJGtPsFb.js.map +1 -0
- package/dist/urls/index.cjs +130 -57
- package/dist/urls/index.cjs.map +1 -0
- package/dist/urls/index.d.cts +737 -0
- package/dist/urls/index.d.ts +699 -708
- package/dist/urls/index.js +122 -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
|
@@ -0,0 +1,339 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* ========================================================================
|
|
3
|
+
* @rzl-zone/utils-js
|
|
4
|
+
* ------------------------------------------------------------------------
|
|
5
|
+
* Version: `3.12.1-beta.1`
|
|
6
|
+
* Author: `Rizalvin Dwiky <rizalvindwiky@gmail.com>`
|
|
7
|
+
* Repository: `https://github.com/rzl-zone/rzl-zone/tree/main/packages/utils-js`
|
|
8
|
+
* ========================================================================
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import { IsNever, NonPlainObject } from "@rzl-zone/ts-types-plus";
|
|
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(): typeof PreciseType.FIXES_CASTABLE_TABLE;
|
|
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(): typeof this.SPECIAL_TYPE;
|
|
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(): typeof this.FIXES_RAW;
|
|
79
|
+
/** ----------------------------------------------------------
|
|
80
|
+
* * ***Retrieves the internal list of common acronyms that should remain fully uppercase during string formatting.***
|
|
81
|
+
* ----------------------------------------------------------
|
|
82
|
+
*
|
|
83
|
+
* - **Description:**
|
|
84
|
+
* - This list defines acronyms (e.g., `"URL"`, `"HTTP"`, `"HTML"`, `"SVG"`, `"XML"`, `"DOM"`)
|
|
85
|
+
* that will be **preserved in uppercase** when applying case transformations through
|
|
86
|
+
* {@link getPreciseType | `getPreciseType`} or any formatting utility using it.
|
|
87
|
+
* - Ensures consistency in output for technical identifiers that are conventionally capitalized.
|
|
88
|
+
*
|
|
89
|
+
* - **Example:**
|
|
90
|
+
* ```ts
|
|
91
|
+
* ["URL", "HTTP", "HTML", "SVG", "XML", "DOM"]
|
|
92
|
+
* ```
|
|
93
|
+
*
|
|
94
|
+
* - **⚠️ Internal:**
|
|
95
|
+
* - Used internally by {@link getPreciseType | `getPreciseType`}.
|
|
96
|
+
* - This property is **readonly** and not intended for modification.
|
|
97
|
+
*
|
|
98
|
+
* @readonly
|
|
99
|
+
*/
|
|
100
|
+
static get acronymsList(): typeof this.ACRONYMS;
|
|
101
|
+
}
|
|
102
|
+
/** ---------------------------------------------------------------------------
|
|
103
|
+
* * ***Options for controlling how {@link getPreciseType | `getPreciseType`} formats and normalizes detected types.***
|
|
104
|
+
* ---------------------------------------------------------------------------
|
|
105
|
+
* These options customize the string transformation behavior and acronym handling
|
|
106
|
+
* when converting JavaScript type names to human-readable strings.
|
|
107
|
+
*/
|
|
108
|
+
type GetPreciseTypeOptions = {
|
|
109
|
+
/** -------------------------------------------------------
|
|
110
|
+
* * ***Specifies the format in which the returned string type should be transformed.***
|
|
111
|
+
* -------------------------------------------------------
|
|
112
|
+
* **ℹ️ For special string literals in `SPECIAL_CASES` (`"-Infinity" | "Infinity" | "NaN"`), which will remain unchanged.**
|
|
113
|
+
* @default "toKebabCase"
|
|
114
|
+
* @description
|
|
115
|
+
* Supported formats:
|
|
116
|
+
* - `"toKebabCase"` (default) — words separated by hyphens.
|
|
117
|
+
* - ➔ `"result-example-type"`
|
|
118
|
+
* - `"toLowerCase"` - converts all letters to lowercase.
|
|
119
|
+
* - ➔ `"result example type"`
|
|
120
|
+
* - `"toDotCase"` — words separated by dots.
|
|
121
|
+
* - ➔ `"result.example.type"`
|
|
122
|
+
* - `"toCamelCase"` — first word lowercase, subsequent words capitalized.
|
|
123
|
+
* - ➔ `"resultExampleType"`
|
|
124
|
+
* - `"toSnakeCase"` — words separated by underscores.
|
|
125
|
+
* - ➔ `"result_example_type"`
|
|
126
|
+
* - `"toPascalCase"` — all words capitalized, no spaces.
|
|
127
|
+
* - ➔ `"ResultExampleType"`
|
|
128
|
+
* - `"toPascalCaseSpace"` — all words capitalized with spaces between words.
|
|
129
|
+
* - ➔ `"Result Example Type"`
|
|
130
|
+
* - `"slugify"` — URL-friendly slug (lowercase with hyphens).
|
|
131
|
+
* - ➔ `"result-example-type"`
|
|
132
|
+
* @note
|
|
133
|
+
* ⚠️ If an invalid value is provided, the function will automatically fallback to the default `"toKebabCase"`.
|
|
134
|
+
*/
|
|
135
|
+
formatCase?: "toPascalCaseSpace" | "toPascalCase" | "toCamelCase" | "toKebabCase" | "toSnakeCase" | "toDotCase" | "slugify" | "toLowerCase";
|
|
136
|
+
/** -------------------------------------------------------
|
|
137
|
+
* * ***Control uppercase preservation of recognized acronyms during formatting.***
|
|
138
|
+
* -------------------------------------------------------
|
|
139
|
+
* When enabled (`true`), common technical acronyms (e.g., `"URL"`, `"HTTP"`, `"HTML"`, `"SVG"`, `"XML"`, `"DOM"`)
|
|
140
|
+
* are preserved in their original uppercase form instead of being lowercased or altered by case-formatting utilities.
|
|
141
|
+
*
|
|
142
|
+
*
|
|
143
|
+
* - **When `false` (default):**
|
|
144
|
+
* - Acronyms are treated as normal words and formatted according to the selected `formatCase`.
|
|
145
|
+
* - Example:
|
|
146
|
+
* - `HTMLDivElement` ➔ `"html-div-element"` (with `"toKebabCase"`)
|
|
147
|
+
* - `DOMParser` ➔ `"dom-parser"`
|
|
148
|
+
* - **When `true`:**
|
|
149
|
+
* - Acronyms remain uppercase.
|
|
150
|
+
* - Example:
|
|
151
|
+
* - `HTMLDivElement` ➔ `"HTML-div-element"` (with `"toKebabCase"`)
|
|
152
|
+
* - `DOMParser` ➔ `"DOM-parser"`
|
|
153
|
+
*
|
|
154
|
+
* @default false
|
|
155
|
+
* @description
|
|
156
|
+
* The list of recognized acronyms is defined in {@link AcronymsList | **`AcronymsList`**},
|
|
157
|
+
* including entries like `"URL"`, `"HTTP"`, `"HTML"`, `"SVG"`, `"XML"`, `"DOM"`, and others.
|
|
158
|
+
*
|
|
159
|
+
* ⚠️ This option affects **formatting output only**, not the underlying type detection, acronym preservation is applied **after** detecting and formatting the base type name.
|
|
160
|
+
*/
|
|
161
|
+
useAcronyms?: boolean;
|
|
162
|
+
};
|
|
163
|
+
/** ---------------------------------------------------------------------------
|
|
164
|
+
* * ***Type alias for the list of common acronyms preserved in uppercase.***
|
|
165
|
+
* ---------------------------------------------------------------------------
|
|
166
|
+
*
|
|
167
|
+
* Use this type to reference the full set of recognized acronyms
|
|
168
|
+
* used internally by the {@link getPreciseType | **`getPreciseType`**} function for formatting purposes.
|
|
169
|
+
*/
|
|
170
|
+
type AcronymsList = (typeof PreciseType)["acronymsList"];
|
|
171
|
+
/** ----------------------------------------------------------
|
|
172
|
+
* * ***Utility-Predicate: `getPreciseType`.***
|
|
173
|
+
* ----------------------------------------------------------
|
|
174
|
+
* **Returns a detailed and normalized type string for the given value.**
|
|
175
|
+
* @description
|
|
176
|
+
* The returned string is human-readable ***toKebabCase*** with spaces ***(by default)*** or formatted according to the `options.formatCase` setting.
|
|
177
|
+
* - **Handles:**
|
|
178
|
+
* - Primitives (`string`, `number`, `boolean`, `null`, `undefined`, `symbol`, `bigint`)
|
|
179
|
+
* - Built-in objects (`Array`, `Map`, `Set`, `Error subclasses`, `Typed Arrays`, `etc`)
|
|
180
|
+
* - Objects created with `Object.create(null)`
|
|
181
|
+
* - Objects wrapper (`new String`, `new Number`, `new Boolean`)
|
|
182
|
+
* - DOM Node type (may not be fully accurate outside the browser environment)
|
|
183
|
+
* - Generator instances
|
|
184
|
+
* - Node.js `Buffer` instances
|
|
185
|
+
* - Proxy detection (returns `"Proxy"` if detected; detection ***is not 100% accurate***)
|
|
186
|
+
* - Uses cached mapping table (`FIXES_CASTABLE_TABLE`) for known types to provide consistent naming
|
|
187
|
+
* - Falls back to constructor name or `Object.prototype.toString` tag
|
|
188
|
+
* @param {*} value - The value to detect the precise type of
|
|
189
|
+
* @param {GetPreciseTypeOptions} [options] - Optional configuration
|
|
190
|
+
* @param {GetPreciseTypeOptions["formatCase"]} [options.formatCase="toLowerCase"]
|
|
191
|
+
* Specifies how the returned type string should be formatted.
|
|
192
|
+
* - ⚠️ Special string literals in `SPECIAL_CASES`
|
|
193
|
+
* (`"-Infinity" | "Infinity" | "NaN"`) will remain
|
|
194
|
+
* unchanged even if a different `formatCase` is applied.
|
|
195
|
+
* @param {boolean} [options.useAcronyms=false]
|
|
196
|
+
* Control uppercase preservation of recognized acronyms during formatting.
|
|
197
|
+
* - When `true`, recognized acronyms such as `"URL"`, `"HTTP"`, `"HTML"`, `"SVG"`, `"XML"`, and `"DOM"`
|
|
198
|
+
* are preserved in uppercase instead of being lowercased or otherwise transformed.
|
|
199
|
+
* - When `false` (default), acronyms are formatted like regular words according to `formatCase`.
|
|
200
|
+
* - ⚠️ This option affects **formatting output only**, not type detection.
|
|
201
|
+
*
|
|
202
|
+
* @returns {string} The normalized and formatted type string
|
|
203
|
+
* @example
|
|
204
|
+
* getPreciseType(123); // ➔ "number"
|
|
205
|
+
* getPreciseType(null); // ➔ "null"
|
|
206
|
+
* getPreciseType(/regex/); // ➔ "reg-exp"
|
|
207
|
+
* getPreciseType(/regex/, { formatCase: "toPascalCase" });
|
|
208
|
+
* // ➔ "RegExp"
|
|
209
|
+
* getPreciseType(function* () {}, { formatCase: "toCamelCase" });
|
|
210
|
+
* // ➔ "generatorFunction"
|
|
211
|
+
* getPreciseType(async function () {}, { formatCase: "toPascalCaseSpace" });
|
|
212
|
+
* // ➔ "Async Function"
|
|
213
|
+
*
|
|
214
|
+
* // (SPECIAL_CASES remain)
|
|
215
|
+
* getPreciseType(NaN, { formatCase: "toLowerCase" });
|
|
216
|
+
* // ➔ "NaN"
|
|
217
|
+
* getPreciseType(Infinity, { formatCase: "toLowerCase" });
|
|
218
|
+
* // ➔ "Infinity"
|
|
219
|
+
* getPreciseType(-Infinity, { formatCase: "toLowerCase" });
|
|
220
|
+
* // ➔ "-Infinity"
|
|
221
|
+
*
|
|
222
|
+
* // Acronym usage examples:
|
|
223
|
+
* getPreciseType(new URL("https://example.com"));
|
|
224
|
+
* // ➔ "url"
|
|
225
|
+
* getPreciseType(new URL("https://example.com"), { useAcronyms: true });
|
|
226
|
+
* // ➔ "URL"
|
|
227
|
+
*
|
|
228
|
+
* getPreciseType(new URLSearchParams, { formatCase: "toPascalCase" });
|
|
229
|
+
* // ➔ "UrlSearchParams"
|
|
230
|
+
* getPreciseType(new URLSearchParams, { formatCase: "toPascalCase", useAcronyms: true });
|
|
231
|
+
* // ➔ "URLSearchParams"
|
|
232
|
+
*/
|
|
233
|
+
declare const getPreciseType: (value: unknown, options?: GetPreciseTypeOptions) => string;
|
|
234
|
+
type IsNumberOptions = {
|
|
235
|
+
/** If set to `true`, `NaN` will be considered a valid number, defaultValue: `false`.
|
|
236
|
+
*
|
|
237
|
+
* @default false
|
|
238
|
+
*/
|
|
239
|
+
includeNaN?: boolean;
|
|
240
|
+
};
|
|
241
|
+
/** ---------------------------------------------------------
|
|
242
|
+
* * ***Type guard: `isNumber`.***
|
|
243
|
+
* ----------------------------------------------------------
|
|
244
|
+
* **Checks if a value is of type **`number`**.**
|
|
245
|
+
* - **Behavior:**
|
|
246
|
+
* - Uses `typeof value === "number"`.
|
|
247
|
+
* - By default, excludes **`NaN`**.
|
|
248
|
+
* - If `options.includeNaN` is `true`, then **`NaN`** is also considered valid.
|
|
249
|
+
* - Still considers `Infinity` and `-Infinity` as **numbers** (consistent with JavaScript).
|
|
250
|
+
* - **ℹ️ Note:**
|
|
251
|
+
* - To exclude `Infinity` and `-Infinity`, use **{@link isFinite | `isFinite`}** instead.
|
|
252
|
+
* @param {*} value - The value to check.
|
|
253
|
+
* @param {IsNumberOptions} [options] - Optional settings.
|
|
254
|
+
* @param {boolean} [options.includeNaN=false] If `true`, `NaN` will be considered a valid number, defaults to `false`, which excludes `NaN`.
|
|
255
|
+
* @returns {boolean} Returns `true` if the value is a number (and depending on `includeNaN`, `NaN` is included or excluded).
|
|
256
|
+
* @example
|
|
257
|
+
* isNumber(42);
|
|
258
|
+
* // ➔ true
|
|
259
|
+
* isNumber(Infinity);
|
|
260
|
+
* // ➔ true
|
|
261
|
+
* isNumber(-Infinity);
|
|
262
|
+
* // ➔ true
|
|
263
|
+
* isNumber(NaN);
|
|
264
|
+
* // ➔ false (default)
|
|
265
|
+
* isNumber(NaN, { includeNaN: true });
|
|
266
|
+
* // ➔ true
|
|
267
|
+
* isNumber("42");
|
|
268
|
+
* // ➔ false
|
|
269
|
+
*/
|
|
270
|
+
declare const isNumber: (value: unknown, options?: IsNumberOptions) => value is number;
|
|
271
|
+
type ArrayFallback<T> = IsNever<Extract<T, unknown[] | readonly unknown[]>> extends true ? T & unknown[] : Extract<T, unknown[] | readonly unknown[]>;
|
|
272
|
+
type IsHasKeysObject<T> = keyof T extends never ? false : true;
|
|
273
|
+
/** ----------------------------------------------------------
|
|
274
|
+
* * ***Utility type: `IsPlainObjectResult`.***
|
|
275
|
+
* ----------------------------------------------------------
|
|
276
|
+
* **Represents the inferred type after asserting a value is a **plain object**.**
|
|
277
|
+
* - **Behavior:**
|
|
278
|
+
* - If `T` is `unknown`, the resulting type is `Record<PropertyKey, unknown> & T`.
|
|
279
|
+
* - If `T` is an object:
|
|
280
|
+
* - If it is a non-plain object (class instance, built-in object, etc.), the result is `never`.
|
|
281
|
+
* - If it has no keys (`IsHasKeysObject<T>` checked by **{@link IsHasKeysObject|`IsHasKeysObject`}** is false), the result is `Record<PropertyKey, unknown> & T`.
|
|
282
|
+
* - Otherwise, the result is `T` itself.
|
|
283
|
+
* - For any other types, the result is `never`.
|
|
284
|
+
* @template T - The input type to be asserted as a plain object.
|
|
285
|
+
* @example
|
|
286
|
+
* ```ts
|
|
287
|
+
* type A = IsPlainObjectResult<unknown>;
|
|
288
|
+
* // ➔ Record<PropertyKey, unknown> & unknown
|
|
289
|
+
* type B = IsPlainObjectResult<{}>;
|
|
290
|
+
* // ➔ Record<PropertyKey, unknown> & {}
|
|
291
|
+
* type C = IsPlainObjectResult<{ foo: string }>;
|
|
292
|
+
* // ➔ { foo: string }
|
|
293
|
+
* type D = IsPlainObjectResult<Date>;
|
|
294
|
+
* // ➔ never
|
|
295
|
+
* ```
|
|
296
|
+
*/
|
|
297
|
+
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>>;
|
|
298
|
+
/** ----------------------------------------------------------
|
|
299
|
+
* * ***Type guard: `isPlainObject`.***
|
|
300
|
+
* ----------------------------------------------------------
|
|
301
|
+
* **Checks if a value is a **plain-object**.**
|
|
302
|
+
* - **A plain object is:**
|
|
303
|
+
* - Created by the `Object` constructor, or
|
|
304
|
+
* - Has a `[[Prototype]]` of `null` (e.g. `Object.create(null)`).
|
|
305
|
+
* - **✅ Returns `true` for:**
|
|
306
|
+
* - Empty object literals: `{}`
|
|
307
|
+
* - Objects with null prototype: `Object.create(null)`
|
|
308
|
+
* - **❌ Returns `false` for:**
|
|
309
|
+
* - Arrays (`[]`, `new Array()`)
|
|
310
|
+
* - Functions (regular, arrow, or class constructors)
|
|
311
|
+
* - Built-in objects: `Date`, `RegExp`, `Error`, `Map`, `Set`, `WeakMap`, `WeakSet`
|
|
312
|
+
* - Boxed primitives: `new String()`, `new Number()`, `new Boolean()`
|
|
313
|
+
* - `null` or `undefined`
|
|
314
|
+
* - Symbols
|
|
315
|
+
* - Class instances
|
|
316
|
+
* @template T - The type of the value being checked.
|
|
317
|
+
* @param {*} value - The value to check.
|
|
318
|
+
* @returns {boolean} Return `true` if `value` is a `plain-object`, otherwise `false`.
|
|
319
|
+
* @example
|
|
320
|
+
* isPlainObject({});
|
|
321
|
+
* // ➔ true
|
|
322
|
+
* isPlainObject(Object.create(null));
|
|
323
|
+
* // ➔ true
|
|
324
|
+
* isPlainObject(null);
|
|
325
|
+
* // ➔ false
|
|
326
|
+
* isPlainObject(() => {});
|
|
327
|
+
* // ➔ false
|
|
328
|
+
* isPlainObject([1, 2, 3]);
|
|
329
|
+
* // ➔ false
|
|
330
|
+
* isPlainObject(new Date());
|
|
331
|
+
* // ➔ false
|
|
332
|
+
* isPlainObject(new MyClass());
|
|
333
|
+
* // ➔ false
|
|
334
|
+
* isPlainObject(new String("x"));
|
|
335
|
+
* // ➔ false
|
|
336
|
+
*/
|
|
337
|
+
declare function isPlainObject<T>(value: T): value is IsPlainObjectResult<T>;
|
|
338
|
+
declare function isPlainObject<T>(value: T): value is NonNullable<Extract<T, Record<PropertyKey, unknown>>>;
|
|
339
|
+
export { IsNumberOptions as a, GetPreciseTypeOptions as c, ArrayFallback as i, getPreciseType as l, isPlainObject as n, isNumber as o, IsHasKeysObject as r, AcronymsList as s, IsPlainObjectResult as t };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* ========================================================================
|
|
3
|
+
* @rzl-zone/utils-js
|
|
4
|
+
* ------------------------------------------------------------------------
|
|
5
|
+
* Version: `3.12.1-beta.1`
|
|
6
|
+
* Author: `Rizalvin Dwiky <rizalvindwiky@gmail.com>`
|
|
7
|
+
* Repository: `https://github.com/rzl-zone/rzl-zone/tree/main/packages/utils-js`
|
|
8
|
+
* ========================================================================
|
|
9
|
+
*/
|
|
10
|
+
"use strict";
|
|
11
|
+
const isServer = () => {
|
|
12
|
+
return typeof window === "undefined" || typeof document === "undefined";
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, 'isServer', {
|
|
15
|
+
enumerable: true,
|
|
16
|
+
get: function () {
|
|
17
|
+
return isServer;
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
//# sourceMappingURL=isServer-BJHVnixd.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isServer-BJHVnixd.cjs","names":[],"sources":["../src/predicates/is/isServer.ts"],"sourcesContent":["/** ---------------------------------------------------------\n * * ***Environment Predicate: `isServer`.***\n * ---------------------------------------------------------\n * **Detects whether the current code is executing in a\n * **non-browser JavaScript runtime** (server-side) rather\n * than in a web browser.**\n * @description\n * It simply checks for the absence of key browser globals like\n * [**`window`**](https://developer.mozilla.org/docs/Web/API/Window/window) and\n * [**`document`**](https://developer.mozilla.org/docs/Web/API/Window/document).\n * - *If those globals aren’t present, we treat the runtime as a server environment.*\n * @returns {boolean}\n * * ***true** – Code is executing on the `server`.*\n * * ***false** – Code is executing in a `browser`.*\n * @example\n * if (isServer()) {\n * console.log(\"Running on a server-side runtime\");\n * } else {\n * console.log(\"Running in a browser\");\n * }\n */\nexport const isServer = (): boolean => {\n return typeof window === \"undefined\" || typeof document === \"undefined\";\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqBA,MAAa,iBAA0B;CACrC,OAAO,OAAO,WAAW,eAAe,OAAO,aAAa"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* ========================================================================
|
|
3
|
+
* @rzl-zone/utils-js
|
|
4
|
+
* ------------------------------------------------------------------------
|
|
5
|
+
* Version: `3.12.1-beta.1`
|
|
6
|
+
* Author: `Rizalvin Dwiky <rizalvindwiky@gmail.com>`
|
|
7
|
+
* Repository: `https://github.com/rzl-zone/rzl-zone/tree/main/packages/utils-js`
|
|
8
|
+
* ========================================================================
|
|
9
|
+
*/
|
|
10
|
+
const isServer = () => {
|
|
11
|
+
return typeof window === "undefined" || typeof document === "undefined";
|
|
12
|
+
};
|
|
13
|
+
export { isServer as t };
|
|
14
|
+
//# sourceMappingURL=isServer-Da3o3XSs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isServer-Da3o3XSs.js","names":[],"sources":["../src/predicates/is/isServer.ts"],"sourcesContent":["/** ---------------------------------------------------------\n * * ***Environment Predicate: `isServer`.***\n * ---------------------------------------------------------\n * **Detects whether the current code is executing in a\n * **non-browser JavaScript runtime** (server-side) rather\n * than in a web browser.**\n * @description\n * It simply checks for the absence of key browser globals like\n * [**`window`**](https://developer.mozilla.org/docs/Web/API/Window/window) and\n * [**`document`**](https://developer.mozilla.org/docs/Web/API/Window/document).\n * - *If those globals aren’t present, we treat the runtime as a server environment.*\n * @returns {boolean}\n * * ***true** – Code is executing on the `server`.*\n * * ***false** – Code is executing in a `browser`.*\n * @example\n * if (isServer()) {\n * console.log(\"Running on a server-side runtime\");\n * } else {\n * console.log(\"Running in a browser\");\n * }\n */\nexport const isServer = (): boolean => {\n return typeof window === \"undefined\" || typeof document === \"undefined\";\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqBA,MAAa,iBAA0B;CACrC,OAAO,OAAO,WAAW,eAAe,OAAO,aAAa"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* ========================================================================
|
|
3
|
+
* @rzl-zone/utils-js
|
|
4
|
+
* ------------------------------------------------------------------------
|
|
5
|
+
* Version: `3.12.1-beta.1`
|
|
6
|
+
* Author: `Rizalvin Dwiky <rizalvindwiky@gmail.com>`
|
|
7
|
+
* Repository: `https://github.com/rzl-zone/rzl-zone/tree/main/packages/utils-js`
|
|
8
|
+
* ========================================================================
|
|
9
|
+
*/
|
|
10
|
+
import { t as isEmptyValue } from "./isEmptyValue-jqOr7OHD.js";
|
|
11
|
+
const isNonEmptyValue = (value, options = {}) => {
|
|
12
|
+
return !isEmptyValue(value, options);
|
|
13
|
+
};
|
|
14
|
+
const typedArrayTags = new Set([
|
|
15
|
+
"[object Int8Array]",
|
|
16
|
+
"[object Uint8Array]",
|
|
17
|
+
"[object Uint8ClampedArray]",
|
|
18
|
+
"[object Int16Array]",
|
|
19
|
+
"[object Uint16Array]",
|
|
20
|
+
"[object Int32Array]",
|
|
21
|
+
"[object Uint32Array]",
|
|
22
|
+
"[object Float32Array]",
|
|
23
|
+
"[object Float64Array]",
|
|
24
|
+
"[object BigInt64Array]",
|
|
25
|
+
"[object BigUint64Array]"
|
|
26
|
+
]);
|
|
27
|
+
function isTypedArray(value) {
|
|
28
|
+
return value != null && typeof value === "object" && typedArrayTags.has(Object.prototype.toString.call(value));
|
|
29
|
+
}
|
|
30
|
+
export { isNonEmptyValue as n, isTypedArray as t };
|
|
31
|
+
//# sourceMappingURL=isTypedArray-DuNA8tK6.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isTypedArray-DuNA8tK6.js","names":[],"sources":["../src/predicates/is/isNonEmptyValue.ts","../src/predicates/is/isTypedArray.ts"],"sourcesContent":["import { isEmptyValue } from \"./isEmptyValue\";\n\ntype IsNonEmptyValueOptions = {\n /** Whether to check symbol properties when checking empty objects, default: `false`.\n *\n * @default false\n */\n checkSymbols?: boolean;\n};\n\n/** ----------------------------------------------------------\n * * ***Predicated: `isNonEmptyValue`.***\n * ----------------------------------------------------------\n * **Determines if a value is a **non-empty** object (`{}` with props), **non-empty** array (`[]` with items) or generally truthy.**\n * - **Behavior:**\n * - Returns `true` for:\n * - Objects **with properties**\n * - Arrays **with items**\n * - Non-empty, non-whitespace strings\n * - Numbers (except `NaN`, includes `0`)\n * - Functions\n * - `true`\n * - Returns `false` for:\n * - Empty objects (`{}`)\n * - Empty arrays (`[]`)\n * - `null` or `undefined`\n * - Empty strings (`\"\"`) or whitespace-only strings (`\" \"`)\n * - `false`\n * - `NaN`\n * - Safely handles `null`, `undefined`, and non-object types without throwing.\n * @param {*} value - The value to evaluate.\n * @param {IsNonEmptyValueOptions} [options] - Optional settings.\n * @returns {boolean} Return `true` if the value is considered non-empty/truthy, otherwise `false`.\n * @example\n * isNonEmptyValue({});\n * // ➔ false\n * isNonEmptyValue([]);\n * // ➔ false\n * isNonEmptyValue({ key: \"value\" });\n * // ➔ true\n * isNonEmptyValue({ [Symbol(\"foo\")]: 123 });\n * // ➔ false (default `checkSymbols` is `false`)\n * isNonEmptyValue({ [Symbol(\"foo\")]: 123 }, { checkSymbols: false });\n * // ➔ false (default `checkSymbols` is `false`)\n * isNonEmptyValue({ [Symbol(\"foo\")]: 123 }, { checkSymbols: true });\n * // ➔ true\n * isNonEmptyValue([1, 2, 3]);\n * // ➔ true\n * isNonEmptyValue(NaN);\n * // ➔ false\n * isNonEmptyValue(true);\n * // ➔ true\n * isNonEmptyValue(false);\n * // ➔ false\n * isNonEmptyValue(null);\n * // ➔ false\n * isNonEmptyValue(undefined);\n * // ➔ false\n * isNonEmptyValue(\"\");\n * // ➔ false\n * isNonEmptyValue(\" \");\n * // ➔ false\n * isNonEmptyValue(0);\n * // ➔ true\n * isNonEmptyValue(-1);\n * // ➔ true\n * isNonEmptyValue(2);\n * // ➔ true\n * isNonEmptyValue(() => {});\n * // ➔ true\n */\nexport const isNonEmptyValue = (\n value: unknown,\n options: IsNonEmptyValueOptions = {}\n): boolean => {\n return !isEmptyValue(value, options);\n};\n","import type { TypedArray } from \"@rzl-zone/ts-types-plus\";\n\nconst typedArrayTags = new Set([\n \"[object Int8Array]\",\n \"[object Uint8Array]\",\n \"[object Uint8ClampedArray]\",\n \"[object Int16Array]\",\n \"[object Uint16Array]\",\n \"[object Int32Array]\",\n \"[object Uint32Array]\",\n \"[object Float32Array]\",\n \"[object Float64Array]\",\n \"[object BigInt64Array]\",\n \"[object BigUint64Array]\"\n]);\n\n/** --------------------------------------------------\n * * ***Type guard: `isTypedArray`.***\n * ----------------------------------------------------------\n * **Checks if `value` is classified as a\n * **[`TypedArray`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray)**.**\n * - **Behavior:**\n * - Validates that `value` is a non-null object.\n * - Uses `Object.prototype.toString` tag matching against known typed array tags.\n * - Narrows type to **{@link TypedArray | `TypedArray`}** when true.\n * @param {*} value - The value to check.\n * @returns {boolean} Returns `true` if the value is a typed array, otherwise `false`.\n * @example\n * isTypedArray(new Uint8Array); // ➔ true\n * isTypedArray(new Uint8Array()); // ➔ true\n * isTypedArray(new Float32Array()); // ➔ true\n * isTypedArray(new Uint8ClampedArray()); // ➔ true\n * isTypedArray([]); // ➔ false\n * isTypedArray(Buffer.from(\"hi\")); // ➔ false\n */\nexport function isTypedArray(value: unknown): value is TypedArray {\n return (\n value != null &&\n typeof value === \"object\" &&\n typedArrayTags.has(Object.prototype.toString.call(value))\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuEA,MAAa,mBACX,OACA,UAAkC,EAAE,KACxB;CACZ,OAAO,CAAC,aAAa,OAAO,QAAQ;;;;;ACzEtC,MAAM,iBAAiB,IAAI,IAAI;CAC7B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD,CAAC;;;;;;;;;;;;;;;;;;;;AAqBF,SAAgB,aAAa,OAAqC;CAChE,OACE,SAAS,QACT,OAAO,UAAU,YACjB,eAAe,IAAI,OAAO,UAAU,SAAS,KAAK,MAAM,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* ========================================================================
|
|
3
|
+
* @rzl-zone/utils-js
|
|
4
|
+
* ------------------------------------------------------------------------
|
|
5
|
+
* Version: `3.12.1-beta.1`
|
|
6
|
+
* Author: `Rizalvin Dwiky <rizalvindwiky@gmail.com>`
|
|
7
|
+
* Repository: `https://github.com/rzl-zone/rzl-zone/tree/main/packages/utils-js`
|
|
8
|
+
* ========================================================================
|
|
9
|
+
*/
|
|
10
|
+
"use strict";
|
|
11
|
+
const require_isEmptyValue = require('./isEmptyValue-BQzcjVaL.cjs');
|
|
12
|
+
const isNonEmptyValue = (value, options = {}) => {
|
|
13
|
+
return !require_isEmptyValue.isEmptyValue(value, options);
|
|
14
|
+
};
|
|
15
|
+
const typedArrayTags = new Set([
|
|
16
|
+
"[object Int8Array]",
|
|
17
|
+
"[object Uint8Array]",
|
|
18
|
+
"[object Uint8ClampedArray]",
|
|
19
|
+
"[object Int16Array]",
|
|
20
|
+
"[object Uint16Array]",
|
|
21
|
+
"[object Int32Array]",
|
|
22
|
+
"[object Uint32Array]",
|
|
23
|
+
"[object Float32Array]",
|
|
24
|
+
"[object Float64Array]",
|
|
25
|
+
"[object BigInt64Array]",
|
|
26
|
+
"[object BigUint64Array]"
|
|
27
|
+
]);
|
|
28
|
+
function isTypedArray(value) {
|
|
29
|
+
return value != null && typeof value === "object" && typedArrayTags.has(Object.prototype.toString.call(value));
|
|
30
|
+
}
|
|
31
|
+
Object.defineProperty(exports, 'isNonEmptyValue', {
|
|
32
|
+
enumerable: true,
|
|
33
|
+
get: function () {
|
|
34
|
+
return isNonEmptyValue;
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
Object.defineProperty(exports, 'isTypedArray', {
|
|
38
|
+
enumerable: true,
|
|
39
|
+
get: function () {
|
|
40
|
+
return isTypedArray;
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
//# sourceMappingURL=isTypedArray-TJptiw2b.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isTypedArray-TJptiw2b.cjs","names":["isEmptyValue"],"sources":["../src/predicates/is/isNonEmptyValue.ts","../src/predicates/is/isTypedArray.ts"],"sourcesContent":["import { isEmptyValue } from \"./isEmptyValue\";\n\ntype IsNonEmptyValueOptions = {\n /** Whether to check symbol properties when checking empty objects, default: `false`.\n *\n * @default false\n */\n checkSymbols?: boolean;\n};\n\n/** ----------------------------------------------------------\n * * ***Predicated: `isNonEmptyValue`.***\n * ----------------------------------------------------------\n * **Determines if a value is a **non-empty** object (`{}` with props), **non-empty** array (`[]` with items) or generally truthy.**\n * - **Behavior:**\n * - Returns `true` for:\n * - Objects **with properties**\n * - Arrays **with items**\n * - Non-empty, non-whitespace strings\n * - Numbers (except `NaN`, includes `0`)\n * - Functions\n * - `true`\n * - Returns `false` for:\n * - Empty objects (`{}`)\n * - Empty arrays (`[]`)\n * - `null` or `undefined`\n * - Empty strings (`\"\"`) or whitespace-only strings (`\" \"`)\n * - `false`\n * - `NaN`\n * - Safely handles `null`, `undefined`, and non-object types without throwing.\n * @param {*} value - The value to evaluate.\n * @param {IsNonEmptyValueOptions} [options] - Optional settings.\n * @returns {boolean} Return `true` if the value is considered non-empty/truthy, otherwise `false`.\n * @example\n * isNonEmptyValue({});\n * // ➔ false\n * isNonEmptyValue([]);\n * // ➔ false\n * isNonEmptyValue({ key: \"value\" });\n * // ➔ true\n * isNonEmptyValue({ [Symbol(\"foo\")]: 123 });\n * // ➔ false (default `checkSymbols` is `false`)\n * isNonEmptyValue({ [Symbol(\"foo\")]: 123 }, { checkSymbols: false });\n * // ➔ false (default `checkSymbols` is `false`)\n * isNonEmptyValue({ [Symbol(\"foo\")]: 123 }, { checkSymbols: true });\n * // ➔ true\n * isNonEmptyValue([1, 2, 3]);\n * // ➔ true\n * isNonEmptyValue(NaN);\n * // ➔ false\n * isNonEmptyValue(true);\n * // ➔ true\n * isNonEmptyValue(false);\n * // ➔ false\n * isNonEmptyValue(null);\n * // ➔ false\n * isNonEmptyValue(undefined);\n * // ➔ false\n * isNonEmptyValue(\"\");\n * // ➔ false\n * isNonEmptyValue(\" \");\n * // ➔ false\n * isNonEmptyValue(0);\n * // ➔ true\n * isNonEmptyValue(-1);\n * // ➔ true\n * isNonEmptyValue(2);\n * // ➔ true\n * isNonEmptyValue(() => {});\n * // ➔ true\n */\nexport const isNonEmptyValue = (\n value: unknown,\n options: IsNonEmptyValueOptions = {}\n): boolean => {\n return !isEmptyValue(value, options);\n};\n","import type { TypedArray } from \"@rzl-zone/ts-types-plus\";\n\nconst typedArrayTags = new Set([\n \"[object Int8Array]\",\n \"[object Uint8Array]\",\n \"[object Uint8ClampedArray]\",\n \"[object Int16Array]\",\n \"[object Uint16Array]\",\n \"[object Int32Array]\",\n \"[object Uint32Array]\",\n \"[object Float32Array]\",\n \"[object Float64Array]\",\n \"[object BigInt64Array]\",\n \"[object BigUint64Array]\"\n]);\n\n/** --------------------------------------------------\n * * ***Type guard: `isTypedArray`.***\n * ----------------------------------------------------------\n * **Checks if `value` is classified as a\n * **[`TypedArray`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray)**.**\n * - **Behavior:**\n * - Validates that `value` is a non-null object.\n * - Uses `Object.prototype.toString` tag matching against known typed array tags.\n * - Narrows type to **{@link TypedArray | `TypedArray`}** when true.\n * @param {*} value - The value to check.\n * @returns {boolean} Returns `true` if the value is a typed array, otherwise `false`.\n * @example\n * isTypedArray(new Uint8Array); // ➔ true\n * isTypedArray(new Uint8Array()); // ➔ true\n * isTypedArray(new Float32Array()); // ➔ true\n * isTypedArray(new Uint8ClampedArray()); // ➔ true\n * isTypedArray([]); // ➔ false\n * isTypedArray(Buffer.from(\"hi\")); // ➔ false\n */\nexport function isTypedArray(value: unknown): value is TypedArray {\n return (\n value != null &&\n typeof value === \"object\" &&\n typedArrayTags.has(Object.prototype.toString.call(value))\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuEA,MAAa,mBACX,OACA,UAAkC,EAAE,KACxB;CACZ,OAAO,CAACA,kCAAa,OAAO,QAAQ;;;;;ACzEtC,MAAM,iBAAiB,IAAI,IAAI;CAC7B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD,CAAC;;;;;;;;;;;;;;;;;;;;AAqBF,SAAgB,aAAa,OAAqC;CAChE,OACE,SAAS,QACT,OAAO,UAAU,YACjB,eAAe,IAAI,OAAO,UAAU,SAAS,KAAK,MAAM,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* ========================================================================
|
|
3
|
+
* @rzl-zone/utils-js
|
|
4
|
+
* ------------------------------------------------------------------------
|
|
5
|
+
* Version: `3.12.1-beta.1`
|
|
6
|
+
* Author: `Rizalvin Dwiky <rizalvindwiky@gmail.com>`
|
|
7
|
+
* Repository: `https://github.com/rzl-zone/rzl-zone/tree/main/packages/utils-js`
|
|
8
|
+
* ========================================================================
|
|
9
|
+
*/
|
|
10
|
+
const isURL = (value) => {
|
|
11
|
+
return value instanceof URL;
|
|
12
|
+
};
|
|
13
|
+
export { isURL as t };
|
|
14
|
+
//# sourceMappingURL=isURL-C-kSk6KJ.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isURL-C-kSk6KJ.js","names":[],"sources":["../src/predicates/is/isURL.ts"],"sourcesContent":["/** ---------------------------------------------------------\n * * ***Type guard: `isURL`.***\n * ----------------------------------------------------------\n * **Checks if a value is an instance of the\n * **[`URL`](https://developer.mozilla.org/docs/Web/API/URL)** class.**\n * - **Behavior:**\n * - Narrows type to `URL` when true.\n * - Excludes `strings`, `plain-objects`, and `other non-URL values`.\n * @param {*} value - The value to check.\n * @returns {boolean} Returns `true` if the value is an instance of `URL`, otherwise `false`.\n * @example\n * isURL(new URL(\"https://example.com\"));\n * // ➔ true\n * isURL(\"https://example.com\");\n * // ➔ false\n */\nexport const isURL = (value: unknown): value is URL => {\n return value instanceof URL;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAgBA,MAAa,SAAS,UAAiC;CACrD,OAAO,iBAAiB"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* ========================================================================
|
|
3
|
+
* @rzl-zone/utils-js
|
|
4
|
+
* ------------------------------------------------------------------------
|
|
5
|
+
* Version: `3.12.1-beta.1`
|
|
6
|
+
* Author: `Rizalvin Dwiky <rizalvindwiky@gmail.com>`
|
|
7
|
+
* Repository: `https://github.com/rzl-zone/rzl-zone/tree/main/packages/utils-js`
|
|
8
|
+
* ========================================================================
|
|
9
|
+
*/
|
|
10
|
+
"use strict";
|
|
11
|
+
const isURL = (value) => {
|
|
12
|
+
return value instanceof URL;
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, 'isURL', {
|
|
15
|
+
enumerable: true,
|
|
16
|
+
get: function () {
|
|
17
|
+
return isURL;
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
//# sourceMappingURL=isURL-DeUPO_oR.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isURL-DeUPO_oR.cjs","names":[],"sources":["../src/predicates/is/isURL.ts"],"sourcesContent":["/** ---------------------------------------------------------\n * * ***Type guard: `isURL`.***\n * ----------------------------------------------------------\n * **Checks if a value is an instance of the\n * **[`URL`](https://developer.mozilla.org/docs/Web/API/URL)** class.**\n * - **Behavior:**\n * - Narrows type to `URL` when true.\n * - Excludes `strings`, `plain-objects`, and `other non-URL values`.\n * @param {*} value - The value to check.\n * @returns {boolean} Returns `true` if the value is an instance of `URL`, otherwise `false`.\n * @example\n * isURL(new URL(\"https://example.com\"));\n * // ➔ true\n * isURL(\"https://example.com\");\n * // ➔ false\n */\nexport const isURL = (value: unknown): value is URL => {\n return value instanceof URL;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgBA,MAAa,SAAS,UAAiC;CACrD,OAAO,iBAAiB"}
|