@rzl-zone/utils-js 3.13.1 → 3.14.0-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/README.md +7 -6
- package/dist/.references/index.d.cts +2 -1
- package/dist/.references/index.d.ts +2 -1
- package/dist/AbortError-DK6kpzbu.cjs +26 -0
- package/dist/AbortError-DK6kpzbu.cjs.map +1 -0
- package/dist/AbortError-DVT8lAKn.js +20 -0
- package/dist/AbortError-DVT8lAKn.js.map +1 -0
- package/dist/{assertIsArray-HgzPQIAM.js → assertIsArray-CG7L7vlt.js} +3 -3
- package/dist/assertIsArray-CG7L7vlt.js.map +1 -0
- package/dist/{assertIsArray-CeXL4xv5.cjs → assertIsArray-CtCRD-_G.cjs} +5 -5
- package/dist/assertIsArray-CtCRD-_G.cjs.map +1 -0
- package/dist/assertIsPlainObject-DPZLj-Ho.cjs +26 -0
- package/dist/assertIsPlainObject-DPZLj-Ho.cjs.map +1 -0
- package/dist/assertIsPlainObject-j9bDqNLo.js +20 -0
- package/dist/assertIsPlainObject-j9bDqNLo.js.map +1 -0
- package/dist/{assertIsString-CY_WkCLr.js → assertIsString-CHIwE12y.js} +4 -4
- package/dist/assertIsString-CHIwE12y.js.map +1 -0
- package/dist/{assertIsString-DUrVt82d.cjs → assertIsString-CjE9kbQ_.cjs} +6 -6
- package/dist/assertIsString-CjE9kbQ_.cjs.map +1 -0
- package/dist/assertions/index.cjs +14 -12
- package/dist/assertions/index.cjs.map +1 -1
- package/dist/assertions/index.d.cts +2 -2
- package/dist/assertions/index.d.ts +2 -2
- package/dist/assertions/index.js +10 -8
- package/dist/assertions/index.js.map +1 -1
- package/dist/conversions/index.cjs +6 -6
- package/dist/conversions/index.d.cts +2 -2
- package/dist/conversions/index.d.ts +2 -2
- package/dist/conversions/index.js +6 -6
- package/dist/conversions-BFz6MKaV.cjs +449 -0
- package/dist/conversions-BFz6MKaV.cjs.map +1 -0
- package/dist/{conversions-1s7xMBe_.js → conversions-Ben5p5Ts.js} +43 -40
- package/dist/conversions-Ben5p5Ts.js.map +1 -0
- package/dist/errors/index.cjs +13 -0
- package/dist/errors/index.d.cts +180 -0
- package/dist/errors/index.d.ts +180 -0
- package/dist/errors/index.js +11 -0
- package/dist/events/index.cjs +10 -9
- package/dist/events/index.cjs.map +1 -1
- package/dist/events/index.d.cts +185 -100
- package/dist/events/index.d.ts +185 -100
- package/dist/events/index.js +9 -8
- package/dist/events/index.js.map +1 -1
- package/dist/formatter-ekJQF_bA-BepnCBkQ.cjs +67 -0
- package/dist/formatter-ekJQF_bA-BepnCBkQ.cjs.map +1 -0
- package/dist/formatter-ekJQF_bA-xLD9mGk4.js +55 -0
- package/dist/formatter-ekJQF_bA-xLD9mGk4.js.map +1 -0
- package/dist/formatters/index.cjs +2 -2
- package/dist/formatters/index.d.cts +2 -2
- package/dist/formatters/index.d.ts +2 -2
- package/dist/formatters/index.js +2 -2
- package/dist/{formatters-C6cVZBbG.js → formatters-BAbGsnYA.js} +78 -71
- package/dist/formatters-BAbGsnYA.js.map +1 -0
- package/dist/formatters-zd0Gs4Cs.cjs +436 -0
- package/dist/formatters-zd0Gs4Cs.cjs.map +1 -0
- package/dist/generators/index.cjs +37 -31
- package/dist/generators/index.cjs.map +1 -1
- package/dist/generators/index.d.cts +2 -2
- package/dist/generators/index.d.ts +2 -2
- package/dist/generators/index.js +29 -23
- package/dist/generators/index.js.map +1 -1
- package/dist/hasOwnProp-CVIhlD1i.js +47 -0
- package/dist/hasOwnProp-CVIhlD1i.js.map +1 -0
- package/dist/hasOwnProp-D9Tpgokd.cjs +53 -0
- package/dist/hasOwnProp-D9Tpgokd.cjs.map +1 -0
- package/dist/{index-RNQBTK8A.d.cts → index-9JsU_wMu.d.ts} +1375 -937
- package/dist/{index-ORbo-7zA.d.cts → index-BP3sUrAx.d.ts} +242 -133
- package/dist/{index-BG8wdusZ.d.cts → index-BVovC-yK.d.cts} +229 -200
- package/dist/index-C1X6ha9s.d.cts +1041 -0
- package/dist/index-CcPQZ41G.d.cts +1103 -0
- package/dist/index-CjpbuJF4.d.ts +2424 -0
- package/dist/index-CssrQyHh.d.cts +2424 -0
- package/dist/index-DZHiYYR7.d.cts +2179 -0
- package/dist/index-DZHiYYR7.d.ts +2179 -0
- package/dist/index-DlyDmXUo.d.ts +1103 -0
- package/dist/index-Dm4a___O.d.ts +1041 -0
- package/dist/{index-CRz9rSZL.d.ts → index-Dwduk7ez.d.cts} +1375 -937
- package/dist/{index-DPJ-e2JZ.d.ts → index-I5V6RbZM.d.cts} +1592 -790
- package/dist/{index-B5EBAgmC.d.cts → index-hOqBIL7F.d.ts} +1592 -790
- package/dist/{index-B1VQ6USF.d.ts → index-jyuOZMX7.d.ts} +229 -200
- package/dist/{index-ORbo-7zA.d.ts → index-lI0b7iUz.d.cts} +242 -133
- package/dist/{isBigInt-y7s3rsKc.js → isBigInt-Cez32M69.js} +2 -2
- package/dist/isBigInt-Cez32M69.js.map +1 -0
- package/dist/{isBigInt-BVj0M5pq.cjs → isBigInt-YgpNKTbA.cjs} +2 -2
- package/dist/isBigInt-YgpNKTbA.cjs.map +1 -0
- package/dist/{isEmptyString-BYMz_wt9.js → isEmptyString-C9QLWjx2.js} +4 -4
- package/dist/isEmptyString-C9QLWjx2.js.map +1 -0
- package/dist/{isEmptyString-C8PYNPgw.cjs → isEmptyString-O4TFe1Ao.cjs} +5 -5
- package/dist/isEmptyString-O4TFe1Ao.cjs.map +1 -0
- package/dist/isEmptyValue-CFExALXZ.cjs +54 -0
- package/dist/isEmptyValue-CFExALXZ.cjs.map +1 -0
- package/dist/isEmptyValue-kCjnLjbN.js +36 -0
- package/dist/isEmptyValue-kCjnLjbN.js.map +1 -0
- package/dist/{isFinite-DeDaBDr2.cjs → isFinite-B_hHbDpa.cjs} +6 -6
- package/dist/isFinite-B_hHbDpa.cjs.map +1 -0
- package/dist/{isFinite-BEJFOv6B.js → isFinite-ZvNhyHlF.js} +5 -5
- package/dist/isFinite-ZvNhyHlF.js.map +1 -0
- package/dist/{isInteger-DEDbBGez.js → isInteger-aZgzTTZG.js} +4 -4
- package/dist/isInteger-aZgzTTZG.js.map +1 -0
- package/dist/{isInteger-CQLThJOR.cjs → isInteger-dnc6W63Z.cjs} +4 -4
- package/dist/isInteger-dnc6W63Z.cjs.map +1 -0
- package/dist/isNumber-BCWD4dW0.js +20 -0
- package/dist/isNumber-BCWD4dW0.js.map +1 -0
- package/dist/isNumber-BkzwAe50.cjs +26 -0
- package/dist/isNumber-BkzwAe50.cjs.map +1 -0
- package/dist/isPlainObject-CAe_ElKO.d.cts +331 -0
- package/dist/isPlainObject-CJvRG4Je.d.ts +331 -0
- package/dist/{isServer-q3o6cSwD.js → isServer-CQzrX5e0.js} +2 -2
- package/dist/isServer-CQzrX5e0.js.map +1 -0
- package/dist/{isServer-DmycqWsF.cjs → isServer-DhFaedeT.cjs} +2 -2
- package/dist/isServer-DhFaedeT.cjs.map +1 -0
- package/dist/{isEqual-DaPDxMyw.cjs → isTypedArray-DjADSu8q.cjs} +45 -13
- package/dist/isTypedArray-DjADSu8q.cjs.map +1 -0
- package/dist/{isEqual-DM4S_kWh.js → isTypedArray-DxsPKrLh.js} +29 -9
- package/dist/isTypedArray-DxsPKrLh.js.map +1 -0
- package/dist/{isValidDomain-B8Nukgw0.js → isValidDomain-CDtNOhMc.js} +13 -54
- package/dist/isValidDomain-CDtNOhMc.js.map +1 -0
- package/dist/{isValidDomain-ZbyeGOO9.cjs → isValidDomain-D_x7uNIu.cjs} +16 -69
- package/dist/isValidDomain-D_x7uNIu.cjs.map +1 -0
- package/dist/{assertIsBoolean-CWUs-I5l.js → logger-CLWnKRKE.js} +657 -587
- package/dist/logger-CLWnKRKE.js.map +1 -0
- package/dist/{assertIsBoolean-D41HrTB_.cjs → logger-CUacYy3D.cjs} +658 -612
- package/dist/logger-CUacYy3D.cjs.map +1 -0
- package/dist/{noop-BY43WaoU.cjs → noop-CjEbNsJL.cjs} +2 -2
- package/dist/noop-CjEbNsJL.cjs.map +1 -0
- package/dist/{noop-CjY8xVHv.js → noop-qxrcogt5.js} +2 -2
- package/dist/noop-qxrcogt5.js.map +1 -0
- package/dist/{normalizeSpaces-BhZp0U_6.cjs → normalizeSpaces-D0_Z4qnO.cjs} +6 -9
- package/dist/normalizeSpaces-D0_Z4qnO.cjs.map +1 -0
- package/dist/{normalizeSpaces-BoUDtq5P.js → normalizeSpaces-DAsxzBEQ.js} +4 -7
- package/dist/normalizeSpaces-DAsxzBEQ.js.map +1 -0
- package/dist/operations/index.cjs +152 -22
- package/dist/operations/index.cjs.map +1 -1
- package/dist/operations/index.d.cts +257 -35
- package/dist/operations/index.d.ts +257 -35
- package/dist/operations/index.js +142 -13
- package/dist/operations/index.js.map +1 -1
- package/dist/parsers/index.cjs +2 -2
- package/dist/parsers/index.d.cts +238 -180
- package/dist/parsers/index.d.ts +238 -180
- package/dist/parsers/index.js +2 -2
- package/dist/{parsers-B8KYXIjE.js → parsers-BBAE_xVM.js} +9 -8
- package/dist/parsers-BBAE_xVM.js.map +1 -0
- package/dist/{parsers-B_FPX35n.cjs → parsers-i8WEeMJl.cjs} +10 -9
- package/dist/parsers-i8WEeMJl.cjs.map +1 -0
- package/dist/{parsing-Bfaw85Hd.js → parsing-D9tbKQ0v.js} +3 -3
- package/dist/parsing-D9tbKQ0v.js.map +1 -0
- package/dist/{parsing-BCZGco7n.cjs → parsing-DGjB8cwr.cjs} +4 -4
- package/dist/parsing-DGjB8cwr.cjs.map +1 -0
- package/dist/predicates/index.cjs +43 -43
- package/dist/predicates/index.d.cts +3 -3
- package/dist/predicates/index.d.ts +3 -3
- package/dist/predicates/index.js +14 -14
- package/dist/{predicates-KlyOvBSC.js → predicates-C0dova7l.js} +45 -40
- package/dist/predicates-C0dova7l.js.map +1 -0
- package/dist/{predicates-8y28VrbT.cjs → predicates-Dd7To7B4.cjs} +89 -84
- package/dist/predicates-Dd7To7B4.cjs.map +1 -0
- package/dist/promises/index.cjs +27 -26
- package/dist/promises/index.cjs.map +1 -1
- package/dist/promises/index.d.cts +227 -75
- package/dist/promises/index.d.ts +227 -75
- package/dist/promises/index.js +27 -26
- package/dist/promises/index.js.map +1 -1
- package/dist/{punyCode-DnKi0qjS.cjs → punyCode-DHTLhGdD.cjs} +12 -12
- package/dist/punyCode-DHTLhGdD.cjs.map +1 -0
- package/dist/{punyCode-Dwto1RpA.js → punyCode-Deb1Mrkc.js} +12 -12
- package/dist/punyCode-Deb1Mrkc.js.map +1 -0
- package/dist/{removeSpaces--8NW-HSx.js → removeSpaces-BPnsdRN0.js} +4 -4
- package/dist/removeSpaces-BPnsdRN0.js.map +1 -0
- package/dist/{removeSpaces-CmrrkeXz.cjs → removeSpaces-CN3pxBz_.cjs} +7 -7
- package/dist/removeSpaces-CN3pxBz_.cjs.map +1 -0
- package/dist/rzl-utils.global.js +13 -13
- package/dist/safeJsonParse-D1FLVTEM.cjs +209 -0
- package/dist/safeJsonParse-D1FLVTEM.cjs.map +1 -0
- package/dist/{safeJsonParse-OnUwG2El.js → safeJsonParse-DEVKNDSn.js} +29 -28
- package/dist/safeJsonParse-DEVKNDSn.js.map +1 -0
- package/dist/safeStableStringify-C5HHKUdn.cjs +125 -0
- package/dist/safeStableStringify-C5HHKUdn.cjs.map +1 -0
- package/dist/{safeStableStringify-B2KTTS3r.js → safeStableStringify-DfwxmiWn.js} +20 -13
- package/dist/safeStableStringify-DfwxmiWn.js.map +1 -0
- package/dist/strings/index.cjs +26 -30
- package/dist/strings/index.cjs.map +1 -1
- package/dist/strings/index.d.cts +2 -2
- package/dist/strings/index.d.ts +2 -2
- package/dist/strings/index.js +13 -17
- package/dist/strings/index.js.map +1 -1
- package/dist/tailwind/index.cjs +3 -3
- package/dist/tailwind/index.d.cts +3 -3
- package/dist/tailwind/index.d.ts +3 -3
- package/dist/tailwind/index.js +3 -3
- package/dist/{tailwind-DUuboq52.cjs → tailwind-BG7B0cDs.cjs} +59 -53
- package/dist/tailwind-BG7B0cDs.cjs.map +1 -0
- package/dist/{tailwind-CUdmv-oO.js → tailwind-tJNnFPsF.js} +38 -32
- package/dist/tailwind-tJNnFPsF.js.map +1 -0
- package/dist/{toStringArrayUnRecursive-OOHGazks.js → toStringArrayUnRecursive-D0WbLIRz.js} +9 -9
- package/dist/toStringArrayUnRecursive-D0WbLIRz.js.map +1 -0
- package/dist/toStringArrayUnRecursive-QLoaNX_-.cjs +51 -0
- package/dist/toStringArrayUnRecursive-QLoaNX_-.cjs.map +1 -0
- package/dist/urls/index.cjs +3 -3
- package/dist/urls/index.d.cts +635 -443
- package/dist/urls/index.d.ts +635 -443
- package/dist/urls/index.js +3 -3
- package/dist/{urls-BXT4Krsq.js → urls-EoWslGgg.js} +50 -41
- package/dist/urls-EoWslGgg.js.map +1 -0
- package/dist/urls-NCzPepe2.cjs +308 -0
- package/dist/urls-NCzPepe2.cjs.map +1 -0
- package/package.json +6 -6
- package/dist/assertIsArray-CeXL4xv5.cjs.map +0 -1
- package/dist/assertIsArray-HgzPQIAM.js.map +0 -1
- package/dist/assertIsBoolean-CWUs-I5l.js.map +0 -1
- package/dist/assertIsBoolean-D41HrTB_.cjs.map +0 -1
- package/dist/assertIsString-CY_WkCLr.js.map +0 -1
- package/dist/assertIsString-DUrVt82d.cjs.map +0 -1
- package/dist/conversions-1s7xMBe_.js.map +0 -1
- package/dist/conversions-B3Rf8uId.cjs +0 -446
- package/dist/conversions-B3Rf8uId.cjs.map +0 -1
- package/dist/formatters-C6cVZBbG.js.map +0 -1
- package/dist/formatters-aEAAuzjx.cjs +0 -429
- package/dist/formatters-aEAAuzjx.cjs.map +0 -1
- package/dist/index-CPCt6_Wq.d.cts +0 -765
- package/dist/index-CPCt6_Wq.d.ts +0 -765
- package/dist/index-DBwNa1iO.d.ts +0 -947
- package/dist/index-DPTYOQkn.d.cts +0 -947
- package/dist/index-Dig1fIhZ.d.cts +0 -1716
- package/dist/index-Dig1fIhZ.d.ts +0 -1716
- package/dist/isBigInt-BVj0M5pq.cjs.map +0 -1
- package/dist/isBigInt-y7s3rsKc.js.map +0 -1
- package/dist/isEmptyObject-BsHngDz4.cjs +0 -37
- package/dist/isEmptyObject-BsHngDz4.cjs.map +0 -1
- package/dist/isEmptyObject-DPGR9iPj.js +0 -25
- package/dist/isEmptyObject-DPGR9iPj.js.map +0 -1
- package/dist/isEmptyString-BYMz_wt9.js.map +0 -1
- package/dist/isEmptyString-C8PYNPgw.cjs.map +0 -1
- package/dist/isEmptyValue-BXf7f1jz.cjs +0 -30
- package/dist/isEmptyValue-BXf7f1jz.cjs.map +0 -1
- package/dist/isEmptyValue-D4OHTB3u.js +0 -24
- package/dist/isEmptyValue-D4OHTB3u.js.map +0 -1
- package/dist/isEqual-DM4S_kWh.js.map +0 -1
- package/dist/isEqual-DaPDxMyw.cjs.map +0 -1
- package/dist/isFinite-BEJFOv6B.js.map +0 -1
- package/dist/isFinite-DeDaBDr2.cjs.map +0 -1
- package/dist/isInteger-CQLThJOR.cjs.map +0 -1
- package/dist/isInteger-DEDbBGez.js.map +0 -1
- package/dist/isPlainObject-BwTkj3G0.d.cts +0 -339
- package/dist/isPlainObject-BwTkj3G0.d.ts +0 -339
- package/dist/isServer-DmycqWsF.cjs.map +0 -1
- package/dist/isServer-q3o6cSwD.js.map +0 -1
- package/dist/isTypedArray-BQLbLXsU.cjs +0 -43
- package/dist/isTypedArray-BQLbLXsU.cjs.map +0 -1
- package/dist/isTypedArray-XiBnifLN.js +0 -31
- package/dist/isTypedArray-XiBnifLN.js.map +0 -1
- package/dist/isValidDomain-B8Nukgw0.js.map +0 -1
- package/dist/isValidDomain-ZbyeGOO9.cjs.map +0 -1
- package/dist/noop-BY43WaoU.cjs.map +0 -1
- package/dist/noop-CjY8xVHv.js.map +0 -1
- package/dist/normalizeSpaces-BhZp0U_6.cjs.map +0 -1
- package/dist/normalizeSpaces-BoUDtq5P.js.map +0 -1
- package/dist/parsers-B8KYXIjE.js.map +0 -1
- package/dist/parsers-B_FPX35n.cjs.map +0 -1
- package/dist/parsing-BCZGco7n.cjs.map +0 -1
- package/dist/parsing-Bfaw85Hd.js.map +0 -1
- package/dist/predicates-8y28VrbT.cjs.map +0 -1
- package/dist/predicates-KlyOvBSC.js.map +0 -1
- package/dist/punyCode-DnKi0qjS.cjs.map +0 -1
- package/dist/punyCode-Dwto1RpA.js.map +0 -1
- package/dist/removeSpaces--8NW-HSx.js.map +0 -1
- package/dist/removeSpaces-CmrrkeXz.cjs.map +0 -1
- package/dist/safeJsonParse-OnUwG2El.js.map +0 -1
- package/dist/safeJsonParse-sFqVXf-e.cjs +0 -208
- package/dist/safeJsonParse-sFqVXf-e.cjs.map +0 -1
- package/dist/safeStableStringify-B2KTTS3r.js.map +0 -1
- package/dist/safeStableStringify-Cmi6GyWj.cjs +0 -106
- package/dist/safeStableStringify-Cmi6GyWj.cjs.map +0 -1
- package/dist/tailwind-CUdmv-oO.js.map +0 -1
- package/dist/tailwind-DUuboq52.cjs.map +0 -1
- package/dist/toStringArrayUnRecursive-OOHGazks.js.map +0 -1
- package/dist/toStringArrayUnRecursive-pfk2oP8C.cjs +0 -51
- package/dist/toStringArrayUnRecursive-pfk2oP8C.cjs.map +0 -1
- package/dist/urls-BL9C_yU3.cjs +0 -299
- package/dist/urls-BL9C_yU3.cjs.map +0 -1
- package/dist/urls-BXT4Krsq.js.map +0 -1
|
@@ -0,0 +1,331 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* ========================================================================
|
|
3
|
+
* @rzl-zone/utils-js
|
|
4
|
+
* ------------------------------------------------------------------------
|
|
5
|
+
* Version: `3.14.0-beta.0`
|
|
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 { C as NonPlainObject, _ as IsNever } from "./index-DZHiYYR7.cjs";
|
|
12
|
+
declare const ACRONYMS: 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"];
|
|
13
|
+
/** ----------------------------------------------------------
|
|
14
|
+
* * ***List of acronyms to keep uppercase in formatted output.***
|
|
15
|
+
* -----------------------------------------------------------
|
|
16
|
+
*
|
|
17
|
+
* - **Behavior:**
|
|
18
|
+
* - Prevents transformations (like camelCase or kebab-case) from altering
|
|
19
|
+
* known acronyms such as `HTML`, `URL`, `API`, etc.
|
|
20
|
+
* - Extend this list if you want more acronyms to remain uppercase.
|
|
21
|
+
*
|
|
22
|
+
* ---
|
|
23
|
+
* - **⚠️ Internal:**
|
|
24
|
+
* - Used internally by {@link getPreciseType | `getPreciseType`} and related formatters.
|
|
25
|
+
*/
|
|
26
|
+
declare const ACRONYMS_DATA: Readonly<typeof ACRONYMS>;
|
|
27
|
+
/** ---------------------------------------------------------------------------
|
|
28
|
+
* * ***Options for controlling how {@link getPreciseType | `getPreciseType`} formats and normalizes detected types.***
|
|
29
|
+
* ----------------------------------------------------------------------------
|
|
30
|
+
* These options customize the string transformation behavior and acronym handling
|
|
31
|
+
* when converting JavaScript type names to human-readable strings.
|
|
32
|
+
*/
|
|
33
|
+
type GetPreciseTypeOptions = {
|
|
34
|
+
/** -------------------------------------------------------
|
|
35
|
+
* * ***Specifies the format in which the returned string type should be transformed.***
|
|
36
|
+
* --------------------------------------------------------
|
|
37
|
+
* **ℹ️ For special string literals in `SPECIAL_CASES` (`"-Infinity" | "Infinity" | "NaN"`), which will remain unchanged.**
|
|
38
|
+
*
|
|
39
|
+
* ---
|
|
40
|
+
* - #### Supported formats:
|
|
41
|
+
* - `"toKebabCase"` (default) — words separated by hyphens.
|
|
42
|
+
* - ➔ `"result-example-type"`.
|
|
43
|
+
* - `"toLowerCase"` - converts all letters to lowercase.
|
|
44
|
+
* - ➔ `"result example type"`.
|
|
45
|
+
* - `"toDotCase"` — words separated by dots.
|
|
46
|
+
* - ➔ `"result.example.type"`.
|
|
47
|
+
* - `"toCamelCase"` — first word lowercase, subsequent words capitalized.
|
|
48
|
+
* - ➔ `"resultExampleType"`.
|
|
49
|
+
* - `"toSnakeCase"` — words separated by underscores.
|
|
50
|
+
* - ➔ `"result_example_type"`.
|
|
51
|
+
* - `"toPascalCase"` — all words capitalized, no spaces.
|
|
52
|
+
* - ➔ `"ResultExampleType"`.
|
|
53
|
+
* - `"toPascalCaseSpace"` — all words capitalized with spaces between words.
|
|
54
|
+
* - ➔ `"Result Example Type"`.
|
|
55
|
+
* - `"slugify"` — URL-friendly slug (lowercase with hyphens).
|
|
56
|
+
* - ➔ `"result-example-type"`.
|
|
57
|
+
*
|
|
58
|
+
* ---
|
|
59
|
+
* @default
|
|
60
|
+
* ```ts
|
|
61
|
+
* "toKebabCase"
|
|
62
|
+
* ```
|
|
63
|
+
*
|
|
64
|
+
* ---
|
|
65
|
+
* @note
|
|
66
|
+
* ⚠️ If an invalid value is provided, the function will automatically fallback to the default `"toKebabCase"`.
|
|
67
|
+
*/
|
|
68
|
+
formatCase?: "toPascalCaseSpace" | "toPascalCase" | "toCamelCase" | "toKebabCase" | "toSnakeCase" | "toDotCase" | "slugify" | "toLowerCase";
|
|
69
|
+
/** -------------------------------------------------------
|
|
70
|
+
* * ***Control uppercase preservation of recognized acronyms during formatting.***
|
|
71
|
+
* --------------------------------------------------------
|
|
72
|
+
* When enabled (`true`), common technical acronyms (e.g., `"URL"`, `"HTTP"`, `"HTML"`, `"SVG"`, `"XML"`, `"DOM"`)
|
|
73
|
+
* are preserved in their original uppercase form instead of being lowercased or altered by case-formatting utilities.
|
|
74
|
+
*
|
|
75
|
+
* ---
|
|
76
|
+
* ---
|
|
77
|
+
* @description
|
|
78
|
+
* The list of recognized acronyms is defined in {@link AcronymsList | **`AcronymsList`**},
|
|
79
|
+
* including entries like `"URL"`, `"HTTP"`, `"HTML"`, `"SVG"`, `"XML"`, `"DOM"`, and others.
|
|
80
|
+
*
|
|
81
|
+
* ---
|
|
82
|
+
* - ***Behavior:***
|
|
83
|
+
* - #### When `false` (default):
|
|
84
|
+
* - Acronyms are treated as normal words and formatted according to the selected `formatCase`.
|
|
85
|
+
* - Example:
|
|
86
|
+
* - `HTMLDivElement` ➔ `"html-div-element"` (with `"toKebabCase"`).
|
|
87
|
+
* - `DOMParser` ➔ `"dom-parser"`.
|
|
88
|
+
*
|
|
89
|
+
* ---
|
|
90
|
+
*
|
|
91
|
+
* - #### When `true`:
|
|
92
|
+
* - Acronyms remain uppercase.
|
|
93
|
+
* - Example:
|
|
94
|
+
* - `HTMLDivElement` ➔ `"HTML-div-element"` (with `"toKebabCase"`).
|
|
95
|
+
* - `DOMParser` ➔ `"DOM-parser"`.
|
|
96
|
+
*
|
|
97
|
+
* ---
|
|
98
|
+
* @default
|
|
99
|
+
* ```ts
|
|
100
|
+
* false
|
|
101
|
+
* ```
|
|
102
|
+
*
|
|
103
|
+
* ---
|
|
104
|
+
* @note
|
|
105
|
+
* ⚠️ This option affects **formatting output only**, not the underlying type detection, acronym preservation is applied **after** detecting and formatting the base type name.
|
|
106
|
+
*/
|
|
107
|
+
useAcronyms?: boolean;
|
|
108
|
+
};
|
|
109
|
+
/** ---------------------------------------------------------------------------
|
|
110
|
+
* * ***Type alias for the list of common acronyms preserved in uppercase.***
|
|
111
|
+
* ----------------------------------------------------------------------------
|
|
112
|
+
*
|
|
113
|
+
* Use this type to reference the full set of recognized acronyms
|
|
114
|
+
* used internally by the {@link getPreciseType | **`getPreciseType`**} function for formatting purposes.
|
|
115
|
+
*/
|
|
116
|
+
type AcronymsList = typeof ACRONYMS_DATA;
|
|
117
|
+
/** ----------------------------------------------------------
|
|
118
|
+
* * ***Utility-Predicate: `getPreciseType`.***
|
|
119
|
+
* -----------------------------------------------------------
|
|
120
|
+
* **Returns a detailed and normalized type string for the given value.**
|
|
121
|
+
*
|
|
122
|
+
* ---
|
|
123
|
+
* @description
|
|
124
|
+
* The returned string is human-readable ***toKebabCase*** with spaces ***(by default)*** or formatted according to the `options.formatCase` setting.
|
|
125
|
+
* - **Handles:**
|
|
126
|
+
* - Primitives (`string`, `number`, `boolean`, `null`, `undefined`, `symbol`, `bigint`).
|
|
127
|
+
* - Built-in objects (`Array`, `Map`, `Set`, `Error subclasses`, `Typed Arrays`, `etc`).
|
|
128
|
+
* - Objects created with `Object.create(null)`.
|
|
129
|
+
* - Objects wrapper (`new String`, `new Number`, `new Boolean`).
|
|
130
|
+
* - DOM Node type (may not be fully accurate outside the browser environment).
|
|
131
|
+
* - Generator instances.
|
|
132
|
+
* - Node.js `Buffer` instances.
|
|
133
|
+
* - Proxy detection (returns `"Proxy"` if detected; detection ***is not 100% accurate***).
|
|
134
|
+
* - Uses cached mapping table (`FIXES_CASTABLE_TABLE`) for known types to provide consistent naming.
|
|
135
|
+
* - Falls back to constructor name or `Object.prototype.toString` tag.
|
|
136
|
+
*
|
|
137
|
+
* ---
|
|
138
|
+
* @param {*} value - The value to detect the precise type of.
|
|
139
|
+
* @param {GetPreciseTypeOptions} [options] - Optional configuration.
|
|
140
|
+
* @param {GetPreciseTypeOptions["formatCase"]} [options.formatCase="toLowerCase"]
|
|
141
|
+
* Specifies how the returned type string should be formatted.
|
|
142
|
+
* - ⚠️ Special string literals in `SPECIAL_CASES`
|
|
143
|
+
* (`"-Infinity" | "Infinity" | "NaN"`) will remain
|
|
144
|
+
* unchanged even if a different `formatCase` is applied.
|
|
145
|
+
* @param {boolean} [options.useAcronyms=false]
|
|
146
|
+
* Control uppercase preservation of recognized acronyms during formatting.
|
|
147
|
+
* - When `true`, recognized acronyms such as `"URL"`, `"HTTP"`, `"HTML"`, `"SVG"`, `"XML"`, and `"DOM"`
|
|
148
|
+
* are preserved in uppercase instead of being lowercased or otherwise transformed.
|
|
149
|
+
* - When `false` (default), acronyms are formatted like regular words according to `formatCase`.
|
|
150
|
+
* - ⚠️ This option affects **formatting output only**, not type detection.
|
|
151
|
+
*
|
|
152
|
+
* ---
|
|
153
|
+
* @returns {string} The normalized and formatted type string.
|
|
154
|
+
*
|
|
155
|
+
* ---
|
|
156
|
+
* @example
|
|
157
|
+
* 1. #### Basic Usage:
|
|
158
|
+
* ```ts
|
|
159
|
+
* getPreciseType(123);
|
|
160
|
+
* // ➔ "number"
|
|
161
|
+
* getPreciseType(null);
|
|
162
|
+
* // ➔ "null"
|
|
163
|
+
* getPreciseType(/regex/);
|
|
164
|
+
* // ➔ "reg-exp"
|
|
165
|
+
* getPreciseType(/regex/, { formatCase: "toPascalCase" });
|
|
166
|
+
* // ➔ "RegExp"
|
|
167
|
+
* getPreciseType(function* () {}, { formatCase: "toCamelCase" });
|
|
168
|
+
* // ➔ "generatorFunction"
|
|
169
|
+
* getPreciseType(async function () {}, { formatCase: "toPascalCaseSpace" });
|
|
170
|
+
* // ➔ "Async Function"
|
|
171
|
+
* ```
|
|
172
|
+
* ---
|
|
173
|
+
* 2. #### `SPECIAL_CASES` remain:
|
|
174
|
+
* ```ts
|
|
175
|
+
* getPreciseType(NaN, { formatCase: "toLowerCase" });
|
|
176
|
+
* // ➔ "NaN"
|
|
177
|
+
* getPreciseType(Infinity, { formatCase: "toLowerCase" });
|
|
178
|
+
* // ➔ "Infinity"
|
|
179
|
+
* getPreciseType(-Infinity, { formatCase: "toLowerCase" });
|
|
180
|
+
* // ➔ "-Infinity"
|
|
181
|
+
* ```
|
|
182
|
+
* ---
|
|
183
|
+
* 3. #### `Acronym` usage examples:
|
|
184
|
+
* ```ts
|
|
185
|
+
* getPreciseType(new URL("https://example.com"));
|
|
186
|
+
* // ➔ "url"
|
|
187
|
+
* getPreciseType(new URL("https://example.com"), { useAcronyms: true });
|
|
188
|
+
* // ➔ "URL"
|
|
189
|
+
* getPreciseType(new URLSearchParams, { formatCase: "toPascalCase" });
|
|
190
|
+
* // ➔ "UrlSearchParams"
|
|
191
|
+
* getPreciseType(new URLSearchParams, { formatCase: "toPascalCase", useAcronyms: true });
|
|
192
|
+
* // ➔ "URLSearchParams"
|
|
193
|
+
* ```
|
|
194
|
+
*/
|
|
195
|
+
declare const getPreciseType: (value: unknown, options?: GetPreciseTypeOptions) => string;
|
|
196
|
+
type IsNumberOptions = {
|
|
197
|
+
/** ---------------------------------------------------------
|
|
198
|
+
* * ***If set to `true`, `NaN` will be considered a valid number, defaultValue: `false`.***
|
|
199
|
+
* ----------------------------------------------------------
|
|
200
|
+
*
|
|
201
|
+
* @default false
|
|
202
|
+
*/
|
|
203
|
+
includeNaN?: boolean;
|
|
204
|
+
};
|
|
205
|
+
/** ---------------------------------------------------------
|
|
206
|
+
* * ***Type guard: `isNumber`.***
|
|
207
|
+
* ----------------------------------------------------------
|
|
208
|
+
* **Checks if a value is of type **`number`**.**
|
|
209
|
+
*
|
|
210
|
+
* ---
|
|
211
|
+
* - #### *Behavior:*
|
|
212
|
+
* - Uses `typeof value === "number"`.
|
|
213
|
+
* - By default, excludes **`NaN`**.
|
|
214
|
+
* - If `options.includeNaN` is `true`, then **`NaN`** is also considered valid.
|
|
215
|
+
* - Still considers `Infinity` and `-Infinity` as **numbers** (consistent with JavaScript).
|
|
216
|
+
*
|
|
217
|
+
* ---
|
|
218
|
+
* - #### *Note:*
|
|
219
|
+
* - To exclude `Infinity` and `-Infinity`, use **{@link isFinite | `isFinite`}** instead.
|
|
220
|
+
*
|
|
221
|
+
* ---
|
|
222
|
+
* @param {*} value - The value to check.
|
|
223
|
+
* @param {IsNumberOptions} [options] - Optional settings.
|
|
224
|
+
* @param {boolean} [options.includeNaN=false] If `true`, `NaN` will be considered a valid number, defaults to `false`, which excludes `NaN`.
|
|
225
|
+
*
|
|
226
|
+
* ---
|
|
227
|
+
* @returns {boolean} Returns `true` if the value is a number (and depending on `includeNaN`, `NaN` is included or excluded).
|
|
228
|
+
*
|
|
229
|
+
* ---
|
|
230
|
+
* @example
|
|
231
|
+
* isNumber(42);
|
|
232
|
+
* // ➔ true
|
|
233
|
+
* isNumber(Infinity);
|
|
234
|
+
* // ➔ true
|
|
235
|
+
* isNumber(-Infinity);
|
|
236
|
+
* // ➔ true
|
|
237
|
+
* isNumber(NaN);
|
|
238
|
+
* // ➔ false (default)
|
|
239
|
+
* isNumber(NaN, { includeNaN: true });
|
|
240
|
+
* // ➔ true
|
|
241
|
+
* isNumber("42");
|
|
242
|
+
* // ➔ false
|
|
243
|
+
*/
|
|
244
|
+
declare const isNumber: (value: unknown, options?: IsNumberOptions) => value is number;
|
|
245
|
+
type ArrayFallback<T> = IsNever<Extract<T, unknown[] | readonly unknown[]>> extends true ? T & unknown[] : Extract<T, unknown[] | readonly unknown[]>;
|
|
246
|
+
type IsHasKeysObject<T> = keyof T extends never ? false : true;
|
|
247
|
+
/** ----------------------------------------------------------
|
|
248
|
+
* * ***Utility type: `IsPlainObjectResult`.***
|
|
249
|
+
* -----------------------------------------------------------
|
|
250
|
+
* **Represents the inferred type after asserting a value is a **plain object**.**
|
|
251
|
+
*
|
|
252
|
+
* ---
|
|
253
|
+
* - **Behavior:**
|
|
254
|
+
* - If `T` is `unknown`, the resulting type is `Record<PropertyKey, unknown> & T`.
|
|
255
|
+
* - If `T` is an object:
|
|
256
|
+
* - If it is a non-plain object (class instance, built-in object, etc.), the result is `never`.
|
|
257
|
+
* - If it has no keys (`IsHasKeysObject<T>` checked by **{@link IsHasKeysObject|`IsHasKeysObject`}** is false), the result is `Record<PropertyKey, unknown> & T`.
|
|
258
|
+
* - Otherwise, the result is `T` itself.
|
|
259
|
+
* - For any other types, the result is `never`.
|
|
260
|
+
*
|
|
261
|
+
* ---
|
|
262
|
+
* @template T - The input type to be asserted as a plain object.
|
|
263
|
+
*
|
|
264
|
+
* ---
|
|
265
|
+
* @example
|
|
266
|
+
* ```ts
|
|
267
|
+
* type A = IsPlainObjectResult<unknown>;
|
|
268
|
+
* // ➔ Record<PropertyKey, unknown> & unknown
|
|
269
|
+
* type B = IsPlainObjectResult<{}>;
|
|
270
|
+
* // ➔ Record<PropertyKey, unknown> & {}
|
|
271
|
+
* type C = IsPlainObjectResult<{ foo: string }>;
|
|
272
|
+
* // ➔ { foo: string }
|
|
273
|
+
* type D = IsPlainObjectResult<Date>;
|
|
274
|
+
* // ➔ never
|
|
275
|
+
* ```
|
|
276
|
+
*/
|
|
277
|
+
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>>;
|
|
278
|
+
/** ----------------------------------------------------------
|
|
279
|
+
* * ***Type guard: `isPlainObject`.***
|
|
280
|
+
* -----------------------------------------------------------
|
|
281
|
+
* **Checks if a value is a **plain-object**.**
|
|
282
|
+
*
|
|
283
|
+
* - #### A plain object is:
|
|
284
|
+
* - Created by the `Object` constructor, or.
|
|
285
|
+
* - Has a `[[Prototype]]` of `null` (e.g. `Object.create(null)`).
|
|
286
|
+
* ---
|
|
287
|
+
* - #### *Behavior:*
|
|
288
|
+
* - #### Returns `true` for:
|
|
289
|
+
* - Empty object literals: `{}`.
|
|
290
|
+
* - Objects with null prototype: `Object.create(null)`.
|
|
291
|
+
* ---
|
|
292
|
+
* - #### Returns `false` for:
|
|
293
|
+
* - Arrays (`[]`, `new Array()`).
|
|
294
|
+
* - Functions (regular, arrow, or class constructors).
|
|
295
|
+
* - Built-in objects: `Date`, `RegExp`, `Error`, `Map`, `Set`, `WeakMap`, `WeakSet`.
|
|
296
|
+
* - Boxed primitives: `new String()`, `new Number()`, `new Boolean()`.
|
|
297
|
+
* - `null` or `undefined`.
|
|
298
|
+
* - Symbols.
|
|
299
|
+
* - Class instances.
|
|
300
|
+
*
|
|
301
|
+
* ---
|
|
302
|
+
* @template T - The type of the value being checked.
|
|
303
|
+
*
|
|
304
|
+
* ---
|
|
305
|
+
* @param {*} value - The value to check.
|
|
306
|
+
*
|
|
307
|
+
* ---
|
|
308
|
+
* @returns {boolean} Return `true` if `value` is a `plain-object`, otherwise `false`.
|
|
309
|
+
*
|
|
310
|
+
* ---
|
|
311
|
+
* @example
|
|
312
|
+
* isPlainObject({});
|
|
313
|
+
* // ➔ true
|
|
314
|
+
* isPlainObject(Object.create(null));
|
|
315
|
+
* // ➔ true
|
|
316
|
+
* isPlainObject(null);
|
|
317
|
+
* // ➔ false
|
|
318
|
+
* isPlainObject(() => {});
|
|
319
|
+
* // ➔ false
|
|
320
|
+
* isPlainObject([1, 2, 3]);
|
|
321
|
+
* // ➔ false
|
|
322
|
+
* isPlainObject(new Date());
|
|
323
|
+
* // ➔ false
|
|
324
|
+
* isPlainObject(new MyClass());
|
|
325
|
+
* // ➔ false
|
|
326
|
+
* isPlainObject(new String("x"));
|
|
327
|
+
* // ➔ false
|
|
328
|
+
*/
|
|
329
|
+
declare function isPlainObject<T>(value: T): value is IsPlainObjectResult<T>;
|
|
330
|
+
declare function isPlainObject<T>(value: T): value is NonNullable<Extract<T, Record<PropertyKey, unknown>>>;
|
|
331
|
+
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,331 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* ========================================================================
|
|
3
|
+
* @rzl-zone/utils-js
|
|
4
|
+
* ------------------------------------------------------------------------
|
|
5
|
+
* Version: `3.14.0-beta.0`
|
|
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 { C as NonPlainObject, _ as IsNever } from "./index-DZHiYYR7.js";
|
|
12
|
+
declare const ACRONYMS: 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"];
|
|
13
|
+
/** ----------------------------------------------------------
|
|
14
|
+
* * ***List of acronyms to keep uppercase in formatted output.***
|
|
15
|
+
* -----------------------------------------------------------
|
|
16
|
+
*
|
|
17
|
+
* - **Behavior:**
|
|
18
|
+
* - Prevents transformations (like camelCase or kebab-case) from altering
|
|
19
|
+
* known acronyms such as `HTML`, `URL`, `API`, etc.
|
|
20
|
+
* - Extend this list if you want more acronyms to remain uppercase.
|
|
21
|
+
*
|
|
22
|
+
* ---
|
|
23
|
+
* - **⚠️ Internal:**
|
|
24
|
+
* - Used internally by {@link getPreciseType | `getPreciseType`} and related formatters.
|
|
25
|
+
*/
|
|
26
|
+
declare const ACRONYMS_DATA: Readonly<typeof ACRONYMS>;
|
|
27
|
+
/** ---------------------------------------------------------------------------
|
|
28
|
+
* * ***Options for controlling how {@link getPreciseType | `getPreciseType`} formats and normalizes detected types.***
|
|
29
|
+
* ----------------------------------------------------------------------------
|
|
30
|
+
* These options customize the string transformation behavior and acronym handling
|
|
31
|
+
* when converting JavaScript type names to human-readable strings.
|
|
32
|
+
*/
|
|
33
|
+
type GetPreciseTypeOptions = {
|
|
34
|
+
/** -------------------------------------------------------
|
|
35
|
+
* * ***Specifies the format in which the returned string type should be transformed.***
|
|
36
|
+
* --------------------------------------------------------
|
|
37
|
+
* **ℹ️ For special string literals in `SPECIAL_CASES` (`"-Infinity" | "Infinity" | "NaN"`), which will remain unchanged.**
|
|
38
|
+
*
|
|
39
|
+
* ---
|
|
40
|
+
* - #### Supported formats:
|
|
41
|
+
* - `"toKebabCase"` (default) — words separated by hyphens.
|
|
42
|
+
* - ➔ `"result-example-type"`.
|
|
43
|
+
* - `"toLowerCase"` - converts all letters to lowercase.
|
|
44
|
+
* - ➔ `"result example type"`.
|
|
45
|
+
* - `"toDotCase"` — words separated by dots.
|
|
46
|
+
* - ➔ `"result.example.type"`.
|
|
47
|
+
* - `"toCamelCase"` — first word lowercase, subsequent words capitalized.
|
|
48
|
+
* - ➔ `"resultExampleType"`.
|
|
49
|
+
* - `"toSnakeCase"` — words separated by underscores.
|
|
50
|
+
* - ➔ `"result_example_type"`.
|
|
51
|
+
* - `"toPascalCase"` — all words capitalized, no spaces.
|
|
52
|
+
* - ➔ `"ResultExampleType"`.
|
|
53
|
+
* - `"toPascalCaseSpace"` — all words capitalized with spaces between words.
|
|
54
|
+
* - ➔ `"Result Example Type"`.
|
|
55
|
+
* - `"slugify"` — URL-friendly slug (lowercase with hyphens).
|
|
56
|
+
* - ➔ `"result-example-type"`.
|
|
57
|
+
*
|
|
58
|
+
* ---
|
|
59
|
+
* @default
|
|
60
|
+
* ```ts
|
|
61
|
+
* "toKebabCase"
|
|
62
|
+
* ```
|
|
63
|
+
*
|
|
64
|
+
* ---
|
|
65
|
+
* @note
|
|
66
|
+
* ⚠️ If an invalid value is provided, the function will automatically fallback to the default `"toKebabCase"`.
|
|
67
|
+
*/
|
|
68
|
+
formatCase?: "toPascalCaseSpace" | "toPascalCase" | "toCamelCase" | "toKebabCase" | "toSnakeCase" | "toDotCase" | "slugify" | "toLowerCase";
|
|
69
|
+
/** -------------------------------------------------------
|
|
70
|
+
* * ***Control uppercase preservation of recognized acronyms during formatting.***
|
|
71
|
+
* --------------------------------------------------------
|
|
72
|
+
* When enabled (`true`), common technical acronyms (e.g., `"URL"`, `"HTTP"`, `"HTML"`, `"SVG"`, `"XML"`, `"DOM"`)
|
|
73
|
+
* are preserved in their original uppercase form instead of being lowercased or altered by case-formatting utilities.
|
|
74
|
+
*
|
|
75
|
+
* ---
|
|
76
|
+
* ---
|
|
77
|
+
* @description
|
|
78
|
+
* The list of recognized acronyms is defined in {@link AcronymsList | **`AcronymsList`**},
|
|
79
|
+
* including entries like `"URL"`, `"HTTP"`, `"HTML"`, `"SVG"`, `"XML"`, `"DOM"`, and others.
|
|
80
|
+
*
|
|
81
|
+
* ---
|
|
82
|
+
* - ***Behavior:***
|
|
83
|
+
* - #### When `false` (default):
|
|
84
|
+
* - Acronyms are treated as normal words and formatted according to the selected `formatCase`.
|
|
85
|
+
* - Example:
|
|
86
|
+
* - `HTMLDivElement` ➔ `"html-div-element"` (with `"toKebabCase"`).
|
|
87
|
+
* - `DOMParser` ➔ `"dom-parser"`.
|
|
88
|
+
*
|
|
89
|
+
* ---
|
|
90
|
+
*
|
|
91
|
+
* - #### When `true`:
|
|
92
|
+
* - Acronyms remain uppercase.
|
|
93
|
+
* - Example:
|
|
94
|
+
* - `HTMLDivElement` ➔ `"HTML-div-element"` (with `"toKebabCase"`).
|
|
95
|
+
* - `DOMParser` ➔ `"DOM-parser"`.
|
|
96
|
+
*
|
|
97
|
+
* ---
|
|
98
|
+
* @default
|
|
99
|
+
* ```ts
|
|
100
|
+
* false
|
|
101
|
+
* ```
|
|
102
|
+
*
|
|
103
|
+
* ---
|
|
104
|
+
* @note
|
|
105
|
+
* ⚠️ This option affects **formatting output only**, not the underlying type detection, acronym preservation is applied **after** detecting and formatting the base type name.
|
|
106
|
+
*/
|
|
107
|
+
useAcronyms?: boolean;
|
|
108
|
+
};
|
|
109
|
+
/** ---------------------------------------------------------------------------
|
|
110
|
+
* * ***Type alias for the list of common acronyms preserved in uppercase.***
|
|
111
|
+
* ----------------------------------------------------------------------------
|
|
112
|
+
*
|
|
113
|
+
* Use this type to reference the full set of recognized acronyms
|
|
114
|
+
* used internally by the {@link getPreciseType | **`getPreciseType`**} function for formatting purposes.
|
|
115
|
+
*/
|
|
116
|
+
type AcronymsList = typeof ACRONYMS_DATA;
|
|
117
|
+
/** ----------------------------------------------------------
|
|
118
|
+
* * ***Utility-Predicate: `getPreciseType`.***
|
|
119
|
+
* -----------------------------------------------------------
|
|
120
|
+
* **Returns a detailed and normalized type string for the given value.**
|
|
121
|
+
*
|
|
122
|
+
* ---
|
|
123
|
+
* @description
|
|
124
|
+
* The returned string is human-readable ***toKebabCase*** with spaces ***(by default)*** or formatted according to the `options.formatCase` setting.
|
|
125
|
+
* - **Handles:**
|
|
126
|
+
* - Primitives (`string`, `number`, `boolean`, `null`, `undefined`, `symbol`, `bigint`).
|
|
127
|
+
* - Built-in objects (`Array`, `Map`, `Set`, `Error subclasses`, `Typed Arrays`, `etc`).
|
|
128
|
+
* - Objects created with `Object.create(null)`.
|
|
129
|
+
* - Objects wrapper (`new String`, `new Number`, `new Boolean`).
|
|
130
|
+
* - DOM Node type (may not be fully accurate outside the browser environment).
|
|
131
|
+
* - Generator instances.
|
|
132
|
+
* - Node.js `Buffer` instances.
|
|
133
|
+
* - Proxy detection (returns `"Proxy"` if detected; detection ***is not 100% accurate***).
|
|
134
|
+
* - Uses cached mapping table (`FIXES_CASTABLE_TABLE`) for known types to provide consistent naming.
|
|
135
|
+
* - Falls back to constructor name or `Object.prototype.toString` tag.
|
|
136
|
+
*
|
|
137
|
+
* ---
|
|
138
|
+
* @param {*} value - The value to detect the precise type of.
|
|
139
|
+
* @param {GetPreciseTypeOptions} [options] - Optional configuration.
|
|
140
|
+
* @param {GetPreciseTypeOptions["formatCase"]} [options.formatCase="toLowerCase"]
|
|
141
|
+
* Specifies how the returned type string should be formatted.
|
|
142
|
+
* - ⚠️ Special string literals in `SPECIAL_CASES`
|
|
143
|
+
* (`"-Infinity" | "Infinity" | "NaN"`) will remain
|
|
144
|
+
* unchanged even if a different `formatCase` is applied.
|
|
145
|
+
* @param {boolean} [options.useAcronyms=false]
|
|
146
|
+
* Control uppercase preservation of recognized acronyms during formatting.
|
|
147
|
+
* - When `true`, recognized acronyms such as `"URL"`, `"HTTP"`, `"HTML"`, `"SVG"`, `"XML"`, and `"DOM"`
|
|
148
|
+
* are preserved in uppercase instead of being lowercased or otherwise transformed.
|
|
149
|
+
* - When `false` (default), acronyms are formatted like regular words according to `formatCase`.
|
|
150
|
+
* - ⚠️ This option affects **formatting output only**, not type detection.
|
|
151
|
+
*
|
|
152
|
+
* ---
|
|
153
|
+
* @returns {string} The normalized and formatted type string.
|
|
154
|
+
*
|
|
155
|
+
* ---
|
|
156
|
+
* @example
|
|
157
|
+
* 1. #### Basic Usage:
|
|
158
|
+
* ```ts
|
|
159
|
+
* getPreciseType(123);
|
|
160
|
+
* // ➔ "number"
|
|
161
|
+
* getPreciseType(null);
|
|
162
|
+
* // ➔ "null"
|
|
163
|
+
* getPreciseType(/regex/);
|
|
164
|
+
* // ➔ "reg-exp"
|
|
165
|
+
* getPreciseType(/regex/, { formatCase: "toPascalCase" });
|
|
166
|
+
* // ➔ "RegExp"
|
|
167
|
+
* getPreciseType(function* () {}, { formatCase: "toCamelCase" });
|
|
168
|
+
* // ➔ "generatorFunction"
|
|
169
|
+
* getPreciseType(async function () {}, { formatCase: "toPascalCaseSpace" });
|
|
170
|
+
* // ➔ "Async Function"
|
|
171
|
+
* ```
|
|
172
|
+
* ---
|
|
173
|
+
* 2. #### `SPECIAL_CASES` remain:
|
|
174
|
+
* ```ts
|
|
175
|
+
* getPreciseType(NaN, { formatCase: "toLowerCase" });
|
|
176
|
+
* // ➔ "NaN"
|
|
177
|
+
* getPreciseType(Infinity, { formatCase: "toLowerCase" });
|
|
178
|
+
* // ➔ "Infinity"
|
|
179
|
+
* getPreciseType(-Infinity, { formatCase: "toLowerCase" });
|
|
180
|
+
* // ➔ "-Infinity"
|
|
181
|
+
* ```
|
|
182
|
+
* ---
|
|
183
|
+
* 3. #### `Acronym` usage examples:
|
|
184
|
+
* ```ts
|
|
185
|
+
* getPreciseType(new URL("https://example.com"));
|
|
186
|
+
* // ➔ "url"
|
|
187
|
+
* getPreciseType(new URL("https://example.com"), { useAcronyms: true });
|
|
188
|
+
* // ➔ "URL"
|
|
189
|
+
* getPreciseType(new URLSearchParams, { formatCase: "toPascalCase" });
|
|
190
|
+
* // ➔ "UrlSearchParams"
|
|
191
|
+
* getPreciseType(new URLSearchParams, { formatCase: "toPascalCase", useAcronyms: true });
|
|
192
|
+
* // ➔ "URLSearchParams"
|
|
193
|
+
* ```
|
|
194
|
+
*/
|
|
195
|
+
declare const getPreciseType: (value: unknown, options?: GetPreciseTypeOptions) => string;
|
|
196
|
+
type IsNumberOptions = {
|
|
197
|
+
/** ---------------------------------------------------------
|
|
198
|
+
* * ***If set to `true`, `NaN` will be considered a valid number, defaultValue: `false`.***
|
|
199
|
+
* ----------------------------------------------------------
|
|
200
|
+
*
|
|
201
|
+
* @default false
|
|
202
|
+
*/
|
|
203
|
+
includeNaN?: boolean;
|
|
204
|
+
};
|
|
205
|
+
/** ---------------------------------------------------------
|
|
206
|
+
* * ***Type guard: `isNumber`.***
|
|
207
|
+
* ----------------------------------------------------------
|
|
208
|
+
* **Checks if a value is of type **`number`**.**
|
|
209
|
+
*
|
|
210
|
+
* ---
|
|
211
|
+
* - #### *Behavior:*
|
|
212
|
+
* - Uses `typeof value === "number"`.
|
|
213
|
+
* - By default, excludes **`NaN`**.
|
|
214
|
+
* - If `options.includeNaN` is `true`, then **`NaN`** is also considered valid.
|
|
215
|
+
* - Still considers `Infinity` and `-Infinity` as **numbers** (consistent with JavaScript).
|
|
216
|
+
*
|
|
217
|
+
* ---
|
|
218
|
+
* - #### *Note:*
|
|
219
|
+
* - To exclude `Infinity` and `-Infinity`, use **{@link isFinite | `isFinite`}** instead.
|
|
220
|
+
*
|
|
221
|
+
* ---
|
|
222
|
+
* @param {*} value - The value to check.
|
|
223
|
+
* @param {IsNumberOptions} [options] - Optional settings.
|
|
224
|
+
* @param {boolean} [options.includeNaN=false] If `true`, `NaN` will be considered a valid number, defaults to `false`, which excludes `NaN`.
|
|
225
|
+
*
|
|
226
|
+
* ---
|
|
227
|
+
* @returns {boolean} Returns `true` if the value is a number (and depending on `includeNaN`, `NaN` is included or excluded).
|
|
228
|
+
*
|
|
229
|
+
* ---
|
|
230
|
+
* @example
|
|
231
|
+
* isNumber(42);
|
|
232
|
+
* // ➔ true
|
|
233
|
+
* isNumber(Infinity);
|
|
234
|
+
* // ➔ true
|
|
235
|
+
* isNumber(-Infinity);
|
|
236
|
+
* // ➔ true
|
|
237
|
+
* isNumber(NaN);
|
|
238
|
+
* // ➔ false (default)
|
|
239
|
+
* isNumber(NaN, { includeNaN: true });
|
|
240
|
+
* // ➔ true
|
|
241
|
+
* isNumber("42");
|
|
242
|
+
* // ➔ false
|
|
243
|
+
*/
|
|
244
|
+
declare const isNumber: (value: unknown, options?: IsNumberOptions) => value is number;
|
|
245
|
+
type ArrayFallback<T> = IsNever<Extract<T, unknown[] | readonly unknown[]>> extends true ? T & unknown[] : Extract<T, unknown[] | readonly unknown[]>;
|
|
246
|
+
type IsHasKeysObject<T> = keyof T extends never ? false : true;
|
|
247
|
+
/** ----------------------------------------------------------
|
|
248
|
+
* * ***Utility type: `IsPlainObjectResult`.***
|
|
249
|
+
* -----------------------------------------------------------
|
|
250
|
+
* **Represents the inferred type after asserting a value is a **plain object**.**
|
|
251
|
+
*
|
|
252
|
+
* ---
|
|
253
|
+
* - **Behavior:**
|
|
254
|
+
* - If `T` is `unknown`, the resulting type is `Record<PropertyKey, unknown> & T`.
|
|
255
|
+
* - If `T` is an object:
|
|
256
|
+
* - If it is a non-plain object (class instance, built-in object, etc.), the result is `never`.
|
|
257
|
+
* - If it has no keys (`IsHasKeysObject<T>` checked by **{@link IsHasKeysObject|`IsHasKeysObject`}** is false), the result is `Record<PropertyKey, unknown> & T`.
|
|
258
|
+
* - Otherwise, the result is `T` itself.
|
|
259
|
+
* - For any other types, the result is `never`.
|
|
260
|
+
*
|
|
261
|
+
* ---
|
|
262
|
+
* @template T - The input type to be asserted as a plain object.
|
|
263
|
+
*
|
|
264
|
+
* ---
|
|
265
|
+
* @example
|
|
266
|
+
* ```ts
|
|
267
|
+
* type A = IsPlainObjectResult<unknown>;
|
|
268
|
+
* // ➔ Record<PropertyKey, unknown> & unknown
|
|
269
|
+
* type B = IsPlainObjectResult<{}>;
|
|
270
|
+
* // ➔ Record<PropertyKey, unknown> & {}
|
|
271
|
+
* type C = IsPlainObjectResult<{ foo: string }>;
|
|
272
|
+
* // ➔ { foo: string }
|
|
273
|
+
* type D = IsPlainObjectResult<Date>;
|
|
274
|
+
* // ➔ never
|
|
275
|
+
* ```
|
|
276
|
+
*/
|
|
277
|
+
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>>;
|
|
278
|
+
/** ----------------------------------------------------------
|
|
279
|
+
* * ***Type guard: `isPlainObject`.***
|
|
280
|
+
* -----------------------------------------------------------
|
|
281
|
+
* **Checks if a value is a **plain-object**.**
|
|
282
|
+
*
|
|
283
|
+
* - #### A plain object is:
|
|
284
|
+
* - Created by the `Object` constructor, or.
|
|
285
|
+
* - Has a `[[Prototype]]` of `null` (e.g. `Object.create(null)`).
|
|
286
|
+
* ---
|
|
287
|
+
* - #### *Behavior:*
|
|
288
|
+
* - #### Returns `true` for:
|
|
289
|
+
* - Empty object literals: `{}`.
|
|
290
|
+
* - Objects with null prototype: `Object.create(null)`.
|
|
291
|
+
* ---
|
|
292
|
+
* - #### Returns `false` for:
|
|
293
|
+
* - Arrays (`[]`, `new Array()`).
|
|
294
|
+
* - Functions (regular, arrow, or class constructors).
|
|
295
|
+
* - Built-in objects: `Date`, `RegExp`, `Error`, `Map`, `Set`, `WeakMap`, `WeakSet`.
|
|
296
|
+
* - Boxed primitives: `new String()`, `new Number()`, `new Boolean()`.
|
|
297
|
+
* - `null` or `undefined`.
|
|
298
|
+
* - Symbols.
|
|
299
|
+
* - Class instances.
|
|
300
|
+
*
|
|
301
|
+
* ---
|
|
302
|
+
* @template T - The type of the value being checked.
|
|
303
|
+
*
|
|
304
|
+
* ---
|
|
305
|
+
* @param {*} value - The value to check.
|
|
306
|
+
*
|
|
307
|
+
* ---
|
|
308
|
+
* @returns {boolean} Return `true` if `value` is a `plain-object`, otherwise `false`.
|
|
309
|
+
*
|
|
310
|
+
* ---
|
|
311
|
+
* @example
|
|
312
|
+
* isPlainObject({});
|
|
313
|
+
* // ➔ true
|
|
314
|
+
* isPlainObject(Object.create(null));
|
|
315
|
+
* // ➔ true
|
|
316
|
+
* isPlainObject(null);
|
|
317
|
+
* // ➔ false
|
|
318
|
+
* isPlainObject(() => {});
|
|
319
|
+
* // ➔ false
|
|
320
|
+
* isPlainObject([1, 2, 3]);
|
|
321
|
+
* // ➔ false
|
|
322
|
+
* isPlainObject(new Date());
|
|
323
|
+
* // ➔ false
|
|
324
|
+
* isPlainObject(new MyClass());
|
|
325
|
+
* // ➔ false
|
|
326
|
+
* isPlainObject(new String("x"));
|
|
327
|
+
* // ➔ false
|
|
328
|
+
*/
|
|
329
|
+
declare function isPlainObject<T>(value: T): value is IsPlainObjectResult<T>;
|
|
330
|
+
declare function isPlainObject<T>(value: T): value is NonNullable<Extract<T, Record<PropertyKey, unknown>>>;
|
|
331
|
+
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 };
|