@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
|
@@ -1,339 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* ========================================================================
|
|
3
|
-
* @rzl-zone/utils-js
|
|
4
|
-
* ------------------------------------------------------------------------
|
|
5
|
-
* Version: `3.13.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 };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"isServer-DmycqWsF.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;AAC9D"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"isServer-q3o6cSwD.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;AAC9D"}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* ========================================================================
|
|
3
|
-
* @rzl-zone/utils-js
|
|
4
|
-
* ------------------------------------------------------------------------
|
|
5
|
-
* Version: `3.13.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-BXf7f1jz.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-BQLbLXsU.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"isTypedArray-BQLbLXsU.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,CAAC,MACvB;CACZ,OAAO,CAACA,kCAAa,OAAO,OAAO;AACrC;;;;AC1EA,MAAM,iBAAiB,IAAI,IAAI;CAC7B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF,CAAC;;;;;;;;;;;;;;;;;;;;AAqBD,SAAgB,aAAa,OAAqC;CAChE,OACE,SAAS,QACT,OAAO,UAAU,YACjB,eAAe,IAAI,OAAO,UAAU,SAAS,KAAK,KAAK,CAAC;AAE5D"}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* ========================================================================
|
|
3
|
-
* @rzl-zone/utils-js
|
|
4
|
-
* ------------------------------------------------------------------------
|
|
5
|
-
* Version: `3.13.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-D4OHTB3u.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-XiBnifLN.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"isTypedArray-XiBnifLN.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,CAAC,MACvB;CACZ,OAAO,CAAC,aAAa,OAAO,OAAO;AACrC;;;;AC1EA,MAAM,iBAAiB,IAAI,IAAI;CAC7B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF,CAAC;;;;;;;;;;;;;;;;;;;;AAqBD,SAAgB,aAAa,OAAqC;CAChE,OACE,SAAS,QACT,OAAO,UAAU,YACjB,eAAe,IAAI,OAAO,UAAU,SAAS,KAAK,KAAK,CAAC;AAE5D"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"isValidDomain-B8Nukgw0.js","names":["ccTldMap","sldMap"],"sources":["../src/predicates/is/isURL.ts","../../build-tools/dist/formatter-BpNI5pAL.js","../src/predicates/is/_private/data/domain/sldMap.json","../src/predicates/is/_private/data/domain/ccTldMap.json","../src/predicates/is/isValidDomain.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","/*!\n* ========================================================================\n* @rzl-zone/build-tools\n* ------------------------------------------------------------------------\n* Version: `0.0.12`\n* Author: `Rizalvin Dwiky <rizalvindwiky1998@gmail.com>`\n* Repository: `https://github.com/rzl-zone/rzl-zone/tree/main/packages/build-tools`\n* ========================================================================\n*/\n\nimport pcr from \"picocolors\";\nfunction deepFreeze(value) {\n\tif (typeof value !== \"object\" || value === null) return value;\n\tconst seen = /* @__PURE__ */ new WeakSet();\n\tconst stack = [value];\n\twhile (stack.length) {\n\t\tconst obj = stack.pop();\n\t\tif (seen.has(obj) || Object.isFrozen(obj)) continue;\n\t\tseen.add(obj);\n\t\tif (isMap(obj)) for (const [k, v] of obj) {\n\t\t\tif (typeof k === \"object\" && k !== null) stack.push(k);\n\t\t\tif (typeof v === \"object\" && v !== null) stack.push(v);\n\t\t}\n\t\telse if (isSet(obj)) {\n\t\t\tfor (const v of obj) if (typeof v === \"object\" && v !== null) stack.push(v);\n\t\t} else if (isArray(obj)) {\n\t\t\tfor (const v of obj) if (typeof v === \"object\" && v !== null) stack.push(v);\n\t\t} else {\n\t\t\tconst record = obj;\n\t\t\tfor (const key of Reflect.ownKeys(record)) {\n\t\t\t\tconst v = record[key];\n\t\t\t\tif (typeof v === \"object\" && v !== null) stack.push(v);\n\t\t\t}\n\t\t}\n\t\tObject.freeze(obj);\n\t}\n\treturn value;\n}\nconst isRegExp = (value) => {\n\treturn value instanceof RegExp;\n};\nconst isString = (value) => {\n\treturn typeof value === \"string\";\n};\nfunction isSet(value) {\n\treturn Object.prototype.toString.call(value) === \"[object Set]\" || value instanceof Set;\n}\nfunction isMap(value) {\n\treturn Object.prototype.toString.call(value) === \"[object Map]\" || value instanceof Map;\n}\nfunction isArray(value) {\n\treturn Array.isArray(value);\n}\nconst isNull = (val) => val === null;\nfunction isPlainObject(value) {\n\tif (!isObject(value)) return false;\n\tconst proto = Object.getPrototypeOf(value);\n\treturn proto === Object.prototype || proto === null;\n}\nfunction isObject(value) {\n\treturn typeof value === \"object\" && !isNil(value) && !isArray(value);\n}\nfunction isObjectOrArray(value) {\n\treturn isArray(value) || isObject(value);\n}\nconst isNil = (value) => {\n\treturn value == null;\n};\nconst isBoolean = (value) => {\n\treturn typeof value === \"boolean\";\n};\nconst isUndefined = (value) => {\n\treturn typeof value === \"undefined\";\n};\nconst isFunction = (value) => {\n\treturn typeof value === \"function\";\n};\nconst isNumberObject = (value) => {\n\treturn isObject(value) && Object.prototype.toString.call(value) === \"[object Number]\";\n};\nconst isStringObject = (value) => {\n\treturn isObject(value) && Object.prototype.toString.call(value) === \"[object String]\";\n};\nconst isBooleanObject = (value) => {\n\treturn isObject(value) && Object.prototype.toString.call(value) === \"[object Boolean]\";\n};\nconst isInfinityNumber = (value) => {\n\tif (typeof value === \"number\" || isNumberObject(value)) {\n\t\tconst num = Number(value);\n\t\treturn num === Infinity || num === -Infinity;\n\t}\n\treturn false;\n};\nconst isSymbol = (value) => {\n\treturn typeof value === \"symbol\";\n};\nconst isBigInt = (value) => {\n\treturn typeof value === \"bigint\";\n};\nconst isNaN = (value) => {\n\treturn typeof value === \"number\" ? Number.isNaN(value) : isNumberObject(value) && Number.isNaN(value.valueOf());\n};\nconst isNonEmptyString = (value, options = {}) => {\n\tif (!isString(value)) return false;\n\treturn (options.trim ?? true ? value.trim() : value).length > 0;\n};\nconst isNumber = (value, options = {}) => {\n\tconst includeNaN = isPlainObject(options) && isBoolean(options.includeNaN) ? options.includeNaN : false;\n\tconst aNumber = typeof value === \"number\";\n\treturn includeNaN ? aNumber : aNumber && !Number.isNaN(value);\n};\nconst isError = (error) => {\n\treturn Object.prototype.toString.call(error) === \"[object Error]\" || error instanceof Error;\n};\nconst isDate = (value, options = {}) => {\n\tconst skipInvalidDate = isPlainObject(options) && isBoolean(options.skipInvalidDate) ? options.skipInvalidDate : false;\n\tconst instanceDate = value instanceof Date;\n\tif (skipInvalidDate) return instanceDate;\n\treturn instanceDate && !isNaN(value.getTime());\n};\nconst safeStableStringify = (value, options = {}) => {\n\tconst pretty = options.pretty ?? false;\n\tconst sortKeys = options.sortKeys ?? true;\n\tconst sortArray = options.sortArray ?? false;\n\tconst keepUndefined = options.keepUndefined ?? false;\n\tif (isUndefined(value)) return keepUndefined ? \"undefined\" : \"null\";\n\tconst seen = /* @__PURE__ */ new WeakSet();\n\tconst isPrimitive = (val) => isNull(val) || !isObjectOrArray(val) && !isFunction(val);\n\tconst deepProcess = (val) => {\n\t\tif (isNumberObject(val)) {\n\t\t\tconst valOf = val.valueOf();\n\t\t\treturn isNaN(valOf) || isInfinityNumber(valOf) ? null : valOf;\n\t\t}\n\t\tif (isStringObject(val)) return val.valueOf();\n\t\tif (isBooleanObject(val)) return val.valueOf();\n\t\tif (isFunction(val) || isSymbol(val)) return void 0;\n\t\tif (isBigInt(val)) return val.toString();\n\t\tif (isNaN(val) || isInfinityNumber(val)) return null;\n\t\tif (isUndefined(val)) return keepUndefined ? void 0 : null;\n\t\tif (isObjectOrArray(val)) {\n\t\t\tif (seen.has(val)) return \"[Circular]\";\n\t\t\tseen.add(val);\n\t\t\tif (isDate(val)) return val.toISOString();\n\t\t\tif (isMap(val)) return { map: Array.from(val.entries()).map(([k, v]) => [k, deepProcess(v)]) };\n\t\t\tif (isSet(val)) return { set: Array.from(val.values()).map(deepProcess) };\n\t\t\tif (isArray(val)) {\n\t\t\t\tconst processedArr = val.map(deepProcess);\n\t\t\t\tif (sortArray) {\n\t\t\t\t\tconst primitives = [];\n\t\t\t\t\tconst nonPrimitives = [];\n\t\t\t\t\tfor (const item of processedArr) if (isPrimitive(item)) primitives.push(item);\n\t\t\t\t\telse nonPrimitives.push(item);\n\t\t\t\t\tprimitives.sort((a, b) => {\n\t\t\t\t\t\tif (isNumber(a) && isNumber(b)) return a - b;\n\t\t\t\t\t\treturn String(a).localeCompare(String(b));\n\t\t\t\t\t});\n\t\t\t\t\treturn [...primitives, ...nonPrimitives];\n\t\t\t\t}\n\t\t\t\treturn processedArr;\n\t\t\t}\n\t\t\tconst keys = Object.keys(val);\n\t\t\tif (sortKeys) keys.sort((a, b) => {\n\t\t\t\tconst na = Number(a);\n\t\t\t\tconst nb = Number(b);\n\t\t\t\tif (!isNaN(na) && !isNaN(nb)) return na - nb;\n\t\t\t\treturn a.localeCompare(b);\n\t\t\t});\n\t\t\tconst result = {};\n\t\t\tif (isObject(val)) for (const k of keys) {\n\t\t\t\tconst v = deepProcess(val[k]);\n\t\t\t\tif (!isUndefined(v)) result[k] = v;\n\t\t\t}\n\t\t\treturn result;\n\t\t}\n\t\treturn val;\n\t};\n\ttry {\n\t\treturn JSON.stringify(deepProcess(value), null, pretty ? 2 : 0);\n\t} catch (err) {\n\t\tconsole.warn(\"Error in safeStableStringify:\", err);\n\t\treturn \"{}\";\n\t}\n};\nconst normalizeSpaces = (value, options = {\n\twithTrim: true,\n\ttrimOnly: false\n}) => {\n\tif (!isNonEmptyString(value)) return \"\";\n\tif (!isPlainObject(options)) options = {};\n\tconst { trimOnly = false, withTrim = true } = options;\n\tif (trimOnly) return value.trim();\n\tif (withTrim) value = value.trim();\n\treturn value.replace(/\\s+/g, \" \");\n};\nconst isStringArray = (v) => isArray(v) && v.every((i) => isString(i));\nconst isStringSet = (v) => isSet(v) && [...v].every((i) => isString(i));\nconst assertValidatePatternArgs = (v, parameterKey = \"pattern\") => {\n\tif (!isString(v) && !isStringArray(v) && !isStringSet(v)) throw new TypeError(`The \\`${parameterKey}\\` argument must be a string, string[] or Set<string>.`);\n};\nconst flattenStrings = (input) => {\n\treturn input.flat(Infinity).filter((v) => typeof v === \"string\");\n};\nconst toStringSet = (pattern, options = {}) => {\n\tconst { withValidationType = true, parameterKey = \"pattern\" } = options;\n\tif (withValidationType) assertValidatePatternArgs(pattern, parameterKey);\n\treturn toObjectSet(pattern);\n};\nconst toObjectSet = (value) => {\n\tif (isSet(value)) return value;\n\treturn new Set(isArray(value) ? value : [value]);\n};\nconst toArray = (value) => {\n\treturn isArray(value) ? value : [value];\n};\nconst hasGlobalRequire = (value) => isObject(value) && isFunction(value.require);\nconst getRuntimeRequire = () => {\n\tif (!hasGlobalRequire(globalThis)) return void 0;\n\treturn globalThis.require;\n};\nconst __runtimeRequire = ((x) => {\n\tconst r = getRuntimeRequire();\n\tif (r) return r;\n\tif (typeof Proxy !== \"undefined\") return new Proxy(x, { get(target, prop) {\n\t\tconst r2 = getRuntimeRequire();\n\t\treturn r2 ? r2[prop] : target[prop];\n\t} });\n\treturn x;\n})(function(id) {\n\tconst r = getRuntimeRequire();\n\tif (r) return r.call(this, id);\n\tthrow new Error(`Calling \\`require\\` for \"${id}\" in an environment that doesn't expose the \\`require\\` function.`);\n});\nconst picocolors = pcr;\nconst NEWLINE = atob(\"Cg==\");\nconst EOL = hasGlobalRequire(globalThis) ? __runtimeRequire(\"node:os\").EOL : NEWLINE;\nfunction plural(count, word, pluralWord) {\n\tif (count === 1) return word;\n\treturn pluralWord ?? `${word}s`;\n}\nfunction padText(value, options = {}) {\n\tconst { start = true, end = true, padOnInvalid = true } = options;\n\tif (!isNonEmptyString(value)) return padOnInvalid ? \" \" : \"\";\n\treturn `${start ? \" \" : \"\"}${value}${end ? \" \" : \"\"}`;\n}\nfunction joinInline(...text) {\n\treturn text.filter(Boolean).join(\" \");\n}\nfunction joinLines(...text) {\n\treturn text.filter(Boolean).join(EOL);\n}\nfunction joinLinesLoose(...text) {\n\treturn text.filter((v) => v !== false && v !== null && v !== void 0).join(EOL);\n}\nfunction formatOptionValue(value, options) {\n\tconst { pretty = false, indent = 2, sortKeys = false, sortArray = false } = options ?? {};\n\tconst indentUnit = \" \".repeat(indent);\n\tfunction formatRecursive(input, depth = 0) {\n\t\tconst currentIndent = indentUnit.repeat(depth);\n\t\tconst nextIndent = indentUnit.repeat(depth + 1);\n\t\tconst joinInline = picocolors.dim(\", \");\n\t\tconst joinPretty = `,${EOL}`;\n\t\tif (isSet(input)) return formatRecursive([...input], depth);\n\t\tif (isMap(input)) return formatRecursive(Object.fromEntries(input), depth);\n\t\tif (isArray(input)) {\n\t\t\tconst arr = sortArray ? [...input].sort() : input;\n\t\t\tif (arr.length === 0) return picocolors.gray(\"[]\");\n\t\t\tif (!pretty) {\n\t\t\t\tconst items = arr.map((v) => formatRecursive(v, depth)).join(joinInline);\n\t\t\t\treturn picocolors.gray(\"[\") + items + picocolors.gray(\"]\");\n\t\t\t}\n\t\t\tconst items = arr.map((v) => nextIndent + formatRecursive(v, depth + 1)).join(joinPretty);\n\t\t\treturn picocolors.gray(`[${EOL}`) + items + EOL + currentIndent + picocolors.gray(\"]\");\n\t\t}\n\t\tif (isPlainObject(input)) {\n\t\t\tlet entries = Object.entries(input);\n\t\t\tif (sortKeys) entries = entries.sort(([a], [b]) => a.localeCompare(b));\n\t\t\tif (entries.length === 0) return picocolors.gray(\"{}\");\n\t\t\tif (!pretty) {\n\t\t\t\tconst props = entries.map(([key, val]) => {\n\t\t\t\t\treturn picocolors.dim(key) + picocolors.gray(\": \") + formatRecursive(val, depth);\n\t\t\t\t}).join(joinInline);\n\t\t\t\treturn picocolors.gray(\"{ \") + props + picocolors.gray(\" }\");\n\t\t\t}\n\t\t\tconst props = entries.map(([key, val]) => {\n\t\t\t\treturn nextIndent + picocolors.dim(key) + picocolors.gray(\": \") + formatRecursive(val, depth + 1);\n\t\t\t}).join(joinPretty);\n\t\t\treturn picocolors.gray(`{${EOL}`) + props + EOL + currentIndent + picocolors.gray(\"}\");\n\t\t}\n\t\tif (isRegExp(input)) return picocolors.greenBright(\"/\") + picocolors.redBright(input.source) + picocolors.greenBright(\"/\") + picocolors.magentaBright(input.flags);\n\t\tif (isString(input)) return picocolors.gray(`\"${input}\"`);\n\t\tif (isNumber(input, { includeNaN: true })) return picocolors.redBright(String(input));\n\t\tif (isBoolean(input)) return picocolors.redBright(String(input));\n\t\tif (isNil(input)) return picocolors.redBright(String(input));\n\t\tif (isObject(input)) return picocolors.cyanBright(Object.prototype.toString.call(input));\n\t\treturn picocolors.cyanBright(String(input));\n\t}\n\treturn formatRecursive(value);\n}\nexport { isString as C, toArray as D, safeStableStringify as E, toObjectSet as O, isSet as S, normalizeSpaces as T, isNonEmptyString as _, joinLines as a, isPlainObject as b, picocolors as c, flattenStrings as d, isArray as f, isNil as g, isFunction as h, joinInline as i, toStringSet as k, plural as l, isError as m, NEWLINE as n, joinLinesLoose as o, isBoolean as p, formatOptionValue as r, padText as s, EOL as t, deepFreeze as u, isNull as v, isUndefined as w, isRegExp as x, isNumber as y };\n//# sourceMappingURL=formatter-BpNI5pAL.js.map\n","","","import { joinLines, EOL } from \"@rzl-zone/build-tools/utils\";\n\nimport { punycodeUtilsJS } from \"@/urls/utils/punyCode\";\nimport { assertIsPlainObject } from \"@/assertions/objects/assertIsPlainObject\";\nimport { safeStableStringify } from \"@/conversions/stringify/safeStableStringify\";\n\nimport sldMap from \"./_private/data/domain/sldMap.json\";\nimport ccTldMap from \"./_private/data/domain/ccTldMap.json\";\n\nimport { isString } from \"./isString\";\nimport { isBoolean } from \"./isBoolean\";\n\nimport { getPreciseType } from \"../type/getPreciseType\";\n\n/** ---------------------------------------------------------\n * * ***Options for `isValidDomain` predicate.***\n * ---------------------------------------------------------\n * **Customize the behavior of domain validation.**\n */\ntype IsValidDomainOptions = {\n /** * ***Enable conversion of Unicode domains (IDN) to ASCII (punycode).***\n *\n * - Example: `\"пример.рф\"` ➔ `\"xn--e1afmkfd.xn--p1ai\"`\n * - Allows validating Unicode domains correctly.\n * - Default: `false`\n *\n * @defaultValue `false`.\n */\n allowUnicode?: boolean;\n\n /** * ***If `true`, validates **only top-level domains (TLDs)** that are not part of any SLD/second-level domain.***\n *\n * - Accepts country-code TLDs like `\"ai\"` or `\"ai.\"` ✅\n * - Rejects common TLDs that are part of SLDs like `\"com\"` ❌\n * - Only the final label is checked; subdomains are ignored.\n * - Default: `false`\n *\n * @defaultValue `false`.\n */\n topLevel?: boolean;\n\n /** * ***Allow or disallow subdomains.***\n *\n * - Example: `\"sub.example.com\"` ✅ if `subdomain` is `true`, ❌ if `false`\n * - Wildcards and SLDs are considered when evaluating subdomains.\n * - Default: `true`\n *\n * @defaultValue `true`.\n */\n subdomain?: boolean;\n\n /** * ***Allow a wildcard `*` in the left-most label.***\n *\n * - Example: `\"*.example.com\"` ✅ if `wildcard` is `true`, ❌ if `false`\n * - Wildcards are only valid in the first label and require at least one additional label.\n * - Default: `false`\n *\n * @defaultValue `false`.\n */\n wildcard?: boolean;\n\n /** * ***Allow a port after the domain.***\n *\n * - Example: `\"localhost:3000\"` or `\"example.com:8080\"` ✅ if `allowPort` is `true`\n * - Validates that the port is a number between `1` and `65535`.\n * - Does not affect domain validation rules otherwise.\n * - Default: `false`\n *\n * @defaultValue `false`.\n */\n allowPort?: boolean;\n\n /** * ***Allow special domains like `localhost`.***\n *\n * - Example: `\"localhost\"` ✅ if `allowLocalhost` is `true`\n * - Works with or without a port if `allowPort` is enabled.\n * - Default: `false`\n *\n * @defaultValue `false`.\n */\n allowLocalhost?: boolean;\n\n /** * ***Allow URLs with protocol (`http`/`https`) and automatically extract the hostname.***\n *\n * - Example: `\"https://example.com/foo/bar\"` ➔ `\"example.com\"`\n * - The function will validate only the hostname part and ignore the path, query, and fragment.\n * - Default: `false`\n *\n * @defaultValue `false`.\n */\n allowProtocol?: boolean;\n};\n\n/** ---------------------------------------------------------\n * * ***Predicate: `isValidDomain`.***\n * ---------------------------------------------------------\n * **Validates whether a given string is a properly formatted domain name.**\n *\n * - **Supports options for:**\n * - `allowUnicode` ➔ allows internationalized domain names (IDN) with Unicode characters.\n * - `topLevel` ➔ validates **only top-level domains (TLDs)**; ignores subdomains and SLDs.\n * - `subdomain` ➔ allows or disallows subdomains.\n * - `wildcard` ➔ allows wildcard (`*`) in the left-most label.\n * - `allowPort` ➔ allows a port number after the domain (e.g., `example.com:8080`).\n * - `allowLocalhost` ➔ allows the special domain `\"localhost\"`.\n * - `allowProtocol` ➔ allows a URL with protocol (`http`/`https`) and extracts the hostname.\n *\n * - **Behavior:**\n * - ✅ Converts Unicode to ASCII (punycode) if `allowUnicode` is `true`.\n * - ✅ Checks label lengths (≤63 chars), valid characters, and punycode consistency.\n * - ✅ Validates port if `allowPort` is `true` (must be 1–65535).\n * - ✅ Accepts `\"localhost\"` if `allowLocalhost` is `true`.\n * - ✅ Extracts hostname from URLs if `allowProtocol` is `true`.\n * - ❌ Rejects invalid domains, labels starting/ending with `-`, double dots, malformed TLDs, or invalid port numbers.\n * - ✅ Handles both standard domains (example.com), URLs with protocols (https://example.com/foo), and IDNs (пример.рф).\n *\n * @param {*} value - The value to validate; only strings are valid domains.\n * @param {IsValidDomainOptions} [options] - Optional configuration for domain validation.\n * @param {boolean} [options.allowUnicode=false] - Enable punycode conversion for Unicode domains.\n * @param {boolean} [options.topLevel=false] - Validate only TLDs (e.g., `ai`, `uk.`); ignores SLDs like `com`.\n * @param {boolean} [options.subdomain=true] - Allow subdomains; set `false` to reject any subdomain.\n * @param {boolean} [options.wildcard=false] - Allow wildcard `*` in the left-most label (e.g., `*.example.com`).\n * @param {boolean} [options.allowPort=false] - Allow port number after domain (e.g., `:3000`); must be 1–65535.\n * @param {boolean} [options.allowLocalhost=false] - Allow special domain `\"localhost\"`.\n * @param {boolean} [options.allowProtocol=false] - Allow URLs with protocol (`http`/`https`) and extract hostname only.\n * @returns {boolean} Returns `true` if the value is a valid domain according to the rules and options; otherwise `false`.\n *\n * @example\n * isValidDomain(\"google.com\");\n * // ➔ true\n * isValidDomain(\"пример.рф\", { allowUnicode: true });\n * // ➔ true\n * isValidDomain(\"sub.example.com\", { subdomain: false });\n * // ➔ false\n * isValidDomain(\"*.example.com\", { wildcard: true });\n * // ➔ true\n * isValidDomain(\"com\", { topLevel: true });\n * // ➔ false (common TLD rejected because it's part of SLD)\n * isValidDomain(\"ai.\", { topLevel: true });\n * // ➔ true (country-code TLD accepted)\n * isValidDomain(\"localhost\", { allowLocalhost: true });\n * // ➔ true\n * isValidDomain(\"localhost:3000\", { allowLocalhost: true, allowPort: true });\n * // ➔ true\n * isValidDomain(\"example.com:8080\", { allowPort: true });\n * // ➔ true\n * isValidDomain(\"https://example.com/foo/bar\", { allowProtocol: true });\n * // ➔ true (protocol stripped and hostname validated)\n * isValidDomain(\"invalid_domain.com\");\n * // ➔ false\n */\nexport function isValidDomain(\n value: unknown,\n options: IsValidDomainOptions = {}\n): boolean {\n if (!isString(value)) return false;\n\n assertIsPlainObject(options, {\n message: ({ currentType, validType }) =>\n `Second parameter (\\`options\\`) must be of type \\`${validType}\\`, but received: \\`${currentType}\\`.`\n });\n\n const {\n subdomain = true,\n topLevel = false,\n wildcard = false,\n allowUnicode = false,\n allowPort = false,\n allowLocalhost = false,\n allowProtocol = false\n } = options;\n\n // Validate Options:\n const invalid = Object.entries({\n subdomain,\n topLevel,\n wildcard,\n allowUnicode,\n allowProtocol,\n allowPort,\n allowLocalhost\n }).filter(([, value]) => !isBoolean(value));\n\n if (invalid.length) {\n const msg = invalid\n .map(([key, value], i) => {\n return joinLines(\n ` ${i + 1}. option: \"${key}\"`,\n \" expected: boolean\",\n ` received: ${getPreciseType(value)} (${safeStableStringify(\n value,\n {\n keepUndefined: true\n }\n )})`\n );\n })\n .join(EOL);\n\n throw new TypeError(\n joinLines(\n \"\",\n \"> Invalid options detected in second parameter of `isValidDomain`:\",\n msg\n )\n );\n }\n // -----------------\n\n let _value = value.toLowerCase();\n\n if (allowProtocol) {\n try {\n const url = new URL(value); // use original input\n if (url.protocol !== \"http:\" && url.protocol !== \"https:\") return false; // reject non-http(s)\n if (!allowPort && url.port) return false; // reject port if allowPort=false\n _value = url.hostname.toLowerCase(); // extract only hostname\n\n // wildcard check\n const labels = _value.split(\".\");\n if (labels[0] === \"*\" && !wildcard) return false;\n } catch {\n // if parsing fails, leave _value unchanged\n }\n }\n\n if (value.endsWith(\".\")) {\n _value = _value.slice(0, _value.length - 1);\n }\n\n // Handle port\n let port: string;\n if (allowPort) {\n const portMatch = _value.match(/:(\\d{1,5})$/);\n if (portMatch) {\n port = portMatch[0];\n _value = _value.slice(0, -port.length);\n const portNum = Number(portMatch[1]);\n if (portNum < 1 || portNum > 65535) return false;\n }\n }\n\n // Allow localhost\n if (allowLocalhost && _value === \"localhost\") return true;\n\n if (allowUnicode) {\n try {\n _value = punycodeUtilsJS.toASCII(_value);\n } catch {\n return false;\n }\n }\n\n if (_value.length > 253) return false;\n\n const validChars = /^([\\u0E00-\\u0E7Fa-z0-9-._*]+)$/g;\n if (!validChars.test(_value)) return false;\n\n if (topLevel) {\n if (ccTldMap[_value.replace(/\\.$/, \"\") as keyof typeof ccTldMap]) {\n return true;\n }\n }\n\n const sldRegex = /(.*)\\.(([\\u0E00-\\u0E7Fa-z0-9]+)(\\.[a-z0-9]+))/;\n const matches = _value.match(sldRegex);\n // eslint-disable-next-line no-useless-assignment\n let tld: string | null = null;\n let labels: string[] | null = null;\n\n if (matches && matches.length > 2) {\n if (sldMap[matches[2] as keyof typeof sldMap]) {\n // eslint-disable-next-line no-useless-assignment\n tld = matches[2] || null;\n labels = matches[1]?.split(\".\") || null;\n }\n }\n\n if (!labels) {\n labels = _value.split(\".\");\n if (labels.length <= 1) return false;\n\n tld = labels.pop()!;\n const tldRegex = /^(?:xn--)?(?!^\\d+$)[\\u0E00-\\u0E7Fa-z0-9]+$/gi;\n if (!tldRegex.test(tld)) return false;\n }\n\n if (subdomain === false && labels.length > 1) return false;\n\n return labels.every((label, index) => {\n if (wildcard && index === 0 && label === \"*\" && labels.length > 1) {\n return true;\n }\n\n let validLabelChars = /^([\\u0E00-\\u0E7Fa-zA-Z0-9-_]+)$/g;\n if (index === labels.length - 1) {\n validLabelChars = /^([\\u0E00-\\u0E7Fa-zA-Z0-9-]+)$/g;\n }\n\n const doubleDashCount = (label.match(/--(--)?/g) || []).length;\n const xnDashCount = (label.match(/xn--/g) || []).length;\n if (index === labels.length - 1 && doubleDashCount !== xnDashCount) {\n return false;\n }\n\n return (\n validLabelChars.test(label) &&\n label.length < 64 &&\n !label.startsWith(\"-\") &&\n !label.endsWith(\"-\")\n );\n });\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgBA,MAAa,SAAS,UAAiC;CACrD,OAAO,iBAAiB;AAC1B;;;;;;;;;;;;;ACgCA,SAAS,QAAQ,OAAO;CACvB,OAAO,MAAM,QAAQ,KAAK;AAC3B;AAOA,SAAS,SAAS,OAAO;CACxB,OAAO,OAAO,UAAU,YAAY,CAAC,MAAM,KAAK,KAAK,CAAC,QAAQ,KAAK;AACpE;AAIA,MAAM,SAAS,UAAU;CACxB,OAAO,SAAS;AACjB;AAOA,MAAM,cAAc,UAAU;CAC7B,OAAO,OAAO,UAAU;AACzB;AA0IA,MAAM,oBAAoB,UAAU,SAAS,KAAK,KAAK,WAAW,MAAM,OAAO;AAC/E,MAAM,0BAA0B;CAC/B,IAAI,CAAC,iBAAiB,UAAU,GAAG,OAAO,KAAK;CAC/C,OAAO,WAAW;AACnB;AACA,MAAM,qBAAqB,MAAM;CAChC,MAAM,IAAI,kBAAkB;CAC5B,IAAI,GAAG,OAAO;CACd,IAAI,OAAO,UAAU,aAAa,OAAO,IAAI,MAAM,GAAG,EAAE,IAAI,QAAQ,MAAM;EACzE,MAAM,KAAK,kBAAkB;EAC7B,OAAO,KAAK,GAAG,QAAQ,OAAO;CAC/B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f,CAAC,MAAM,WAAW,GAAG,KACrB,CAAC,MAAM,SAAS,GAAG;CAEvB,CAAC;AACH"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"isValidDomain-ZbyeGOO9.cjs","names":["isString","isBoolean","getPreciseType","safeStableStringify","punycodeUtilsJS","ccTldMap","sldMap"],"sources":["../src/predicates/is/isURL.ts","../../build-tools/dist/formatter-BpNI5pAL.js","../src/predicates/is/_private/data/domain/sldMap.json","../src/predicates/is/_private/data/domain/ccTldMap.json","../src/predicates/is/isValidDomain.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","/*!\n* ========================================================================\n* @rzl-zone/build-tools\n* ------------------------------------------------------------------------\n* Version: `0.0.12`\n* Author: `Rizalvin Dwiky <rizalvindwiky1998@gmail.com>`\n* Repository: `https://github.com/rzl-zone/rzl-zone/tree/main/packages/build-tools`\n* ========================================================================\n*/\n\nimport pcr from \"picocolors\";\nfunction deepFreeze(value) {\n\tif (typeof value !== \"object\" || value === null) return value;\n\tconst seen = /* @__PURE__ */ new WeakSet();\n\tconst stack = [value];\n\twhile (stack.length) {\n\t\tconst obj = stack.pop();\n\t\tif (seen.has(obj) || Object.isFrozen(obj)) continue;\n\t\tseen.add(obj);\n\t\tif (isMap(obj)) for (const [k, v] of obj) {\n\t\t\tif (typeof k === \"object\" && k !== null) stack.push(k);\n\t\t\tif (typeof v === \"object\" && v !== null) stack.push(v);\n\t\t}\n\t\telse if (isSet(obj)) {\n\t\t\tfor (const v of obj) if (typeof v === \"object\" && v !== null) stack.push(v);\n\t\t} else if (isArray(obj)) {\n\t\t\tfor (const v of obj) if (typeof v === \"object\" && v !== null) stack.push(v);\n\t\t} else {\n\t\t\tconst record = obj;\n\t\t\tfor (const key of Reflect.ownKeys(record)) {\n\t\t\t\tconst v = record[key];\n\t\t\t\tif (typeof v === \"object\" && v !== null) stack.push(v);\n\t\t\t}\n\t\t}\n\t\tObject.freeze(obj);\n\t}\n\treturn value;\n}\nconst isRegExp = (value) => {\n\treturn value instanceof RegExp;\n};\nconst isString = (value) => {\n\treturn typeof value === \"string\";\n};\nfunction isSet(value) {\n\treturn Object.prototype.toString.call(value) === \"[object Set]\" || value instanceof Set;\n}\nfunction isMap(value) {\n\treturn Object.prototype.toString.call(value) === \"[object Map]\" || value instanceof Map;\n}\nfunction isArray(value) {\n\treturn Array.isArray(value);\n}\nconst isNull = (val) => val === null;\nfunction isPlainObject(value) {\n\tif (!isObject(value)) return false;\n\tconst proto = Object.getPrototypeOf(value);\n\treturn proto === Object.prototype || proto === null;\n}\nfunction isObject(value) {\n\treturn typeof value === \"object\" && !isNil(value) && !isArray(value);\n}\nfunction isObjectOrArray(value) {\n\treturn isArray(value) || isObject(value);\n}\nconst isNil = (value) => {\n\treturn value == null;\n};\nconst isBoolean = (value) => {\n\treturn typeof value === \"boolean\";\n};\nconst isUndefined = (value) => {\n\treturn typeof value === \"undefined\";\n};\nconst isFunction = (value) => {\n\treturn typeof value === \"function\";\n};\nconst isNumberObject = (value) => {\n\treturn isObject(value) && Object.prototype.toString.call(value) === \"[object Number]\";\n};\nconst isStringObject = (value) => {\n\treturn isObject(value) && Object.prototype.toString.call(value) === \"[object String]\";\n};\nconst isBooleanObject = (value) => {\n\treturn isObject(value) && Object.prototype.toString.call(value) === \"[object Boolean]\";\n};\nconst isInfinityNumber = (value) => {\n\tif (typeof value === \"number\" || isNumberObject(value)) {\n\t\tconst num = Number(value);\n\t\treturn num === Infinity || num === -Infinity;\n\t}\n\treturn false;\n};\nconst isSymbol = (value) => {\n\treturn typeof value === \"symbol\";\n};\nconst isBigInt = (value) => {\n\treturn typeof value === \"bigint\";\n};\nconst isNaN = (value) => {\n\treturn typeof value === \"number\" ? Number.isNaN(value) : isNumberObject(value) && Number.isNaN(value.valueOf());\n};\nconst isNonEmptyString = (value, options = {}) => {\n\tif (!isString(value)) return false;\n\treturn (options.trim ?? true ? value.trim() : value).length > 0;\n};\nconst isNumber = (value, options = {}) => {\n\tconst includeNaN = isPlainObject(options) && isBoolean(options.includeNaN) ? options.includeNaN : false;\n\tconst aNumber = typeof value === \"number\";\n\treturn includeNaN ? aNumber : aNumber && !Number.isNaN(value);\n};\nconst isError = (error) => {\n\treturn Object.prototype.toString.call(error) === \"[object Error]\" || error instanceof Error;\n};\nconst isDate = (value, options = {}) => {\n\tconst skipInvalidDate = isPlainObject(options) && isBoolean(options.skipInvalidDate) ? options.skipInvalidDate : false;\n\tconst instanceDate = value instanceof Date;\n\tif (skipInvalidDate) return instanceDate;\n\treturn instanceDate && !isNaN(value.getTime());\n};\nconst safeStableStringify = (value, options = {}) => {\n\tconst pretty = options.pretty ?? false;\n\tconst sortKeys = options.sortKeys ?? true;\n\tconst sortArray = options.sortArray ?? false;\n\tconst keepUndefined = options.keepUndefined ?? false;\n\tif (isUndefined(value)) return keepUndefined ? \"undefined\" : \"null\";\n\tconst seen = /* @__PURE__ */ new WeakSet();\n\tconst isPrimitive = (val) => isNull(val) || !isObjectOrArray(val) && !isFunction(val);\n\tconst deepProcess = (val) => {\n\t\tif (isNumberObject(val)) {\n\t\t\tconst valOf = val.valueOf();\n\t\t\treturn isNaN(valOf) || isInfinityNumber(valOf) ? null : valOf;\n\t\t}\n\t\tif (isStringObject(val)) return val.valueOf();\n\t\tif (isBooleanObject(val)) return val.valueOf();\n\t\tif (isFunction(val) || isSymbol(val)) return void 0;\n\t\tif (isBigInt(val)) return val.toString();\n\t\tif (isNaN(val) || isInfinityNumber(val)) return null;\n\t\tif (isUndefined(val)) return keepUndefined ? void 0 : null;\n\t\tif (isObjectOrArray(val)) {\n\t\t\tif (seen.has(val)) return \"[Circular]\";\n\t\t\tseen.add(val);\n\t\t\tif (isDate(val)) return val.toISOString();\n\t\t\tif (isMap(val)) return { map: Array.from(val.entries()).map(([k, v]) => [k, deepProcess(v)]) };\n\t\t\tif (isSet(val)) return { set: Array.from(val.values()).map(deepProcess) };\n\t\t\tif (isArray(val)) {\n\t\t\t\tconst processedArr = val.map(deepProcess);\n\t\t\t\tif (sortArray) {\n\t\t\t\t\tconst primitives = [];\n\t\t\t\t\tconst nonPrimitives = [];\n\t\t\t\t\tfor (const item of processedArr) if (isPrimitive(item)) primitives.push(item);\n\t\t\t\t\telse nonPrimitives.push(item);\n\t\t\t\t\tprimitives.sort((a, b) => {\n\t\t\t\t\t\tif (isNumber(a) && isNumber(b)) return a - b;\n\t\t\t\t\t\treturn String(a).localeCompare(String(b));\n\t\t\t\t\t});\n\t\t\t\t\treturn [...primitives, ...nonPrimitives];\n\t\t\t\t}\n\t\t\t\treturn processedArr;\n\t\t\t}\n\t\t\tconst keys = Object.keys(val);\n\t\t\tif (sortKeys) keys.sort((a, b) => {\n\t\t\t\tconst na = Number(a);\n\t\t\t\tconst nb = Number(b);\n\t\t\t\tif (!isNaN(na) && !isNaN(nb)) return na - nb;\n\t\t\t\treturn a.localeCompare(b);\n\t\t\t});\n\t\t\tconst result = {};\n\t\t\tif (isObject(val)) for (const k of keys) {\n\t\t\t\tconst v = deepProcess(val[k]);\n\t\t\t\tif (!isUndefined(v)) result[k] = v;\n\t\t\t}\n\t\t\treturn result;\n\t\t}\n\t\treturn val;\n\t};\n\ttry {\n\t\treturn JSON.stringify(deepProcess(value), null, pretty ? 2 : 0);\n\t} catch (err) {\n\t\tconsole.warn(\"Error in safeStableStringify:\", err);\n\t\treturn \"{}\";\n\t}\n};\nconst normalizeSpaces = (value, options = {\n\twithTrim: true,\n\ttrimOnly: false\n}) => {\n\tif (!isNonEmptyString(value)) return \"\";\n\tif (!isPlainObject(options)) options = {};\n\tconst { trimOnly = false, withTrim = true } = options;\n\tif (trimOnly) return value.trim();\n\tif (withTrim) value = value.trim();\n\treturn value.replace(/\\s+/g, \" \");\n};\nconst isStringArray = (v) => isArray(v) && v.every((i) => isString(i));\nconst isStringSet = (v) => isSet(v) && [...v].every((i) => isString(i));\nconst assertValidatePatternArgs = (v, parameterKey = \"pattern\") => {\n\tif (!isString(v) && !isStringArray(v) && !isStringSet(v)) throw new TypeError(`The \\`${parameterKey}\\` argument must be a string, string[] or Set<string>.`);\n};\nconst flattenStrings = (input) => {\n\treturn input.flat(Infinity).filter((v) => typeof v === \"string\");\n};\nconst toStringSet = (pattern, options = {}) => {\n\tconst { withValidationType = true, parameterKey = \"pattern\" } = options;\n\tif (withValidationType) assertValidatePatternArgs(pattern, parameterKey);\n\treturn toObjectSet(pattern);\n};\nconst toObjectSet = (value) => {\n\tif (isSet(value)) return value;\n\treturn new Set(isArray(value) ? value : [value]);\n};\nconst toArray = (value) => {\n\treturn isArray(value) ? value : [value];\n};\nconst hasGlobalRequire = (value) => isObject(value) && isFunction(value.require);\nconst getRuntimeRequire = () => {\n\tif (!hasGlobalRequire(globalThis)) return void 0;\n\treturn globalThis.require;\n};\nconst __runtimeRequire = ((x) => {\n\tconst r = getRuntimeRequire();\n\tif (r) return r;\n\tif (typeof Proxy !== \"undefined\") return new Proxy(x, { get(target, prop) {\n\t\tconst r2 = getRuntimeRequire();\n\t\treturn r2 ? r2[prop] : target[prop];\n\t} });\n\treturn x;\n})(function(id) {\n\tconst r = getRuntimeRequire();\n\tif (r) return r.call(this, id);\n\tthrow new Error(`Calling \\`require\\` for \"${id}\" in an environment that doesn't expose the \\`require\\` function.`);\n});\nconst picocolors = pcr;\nconst NEWLINE = atob(\"Cg==\");\nconst EOL = hasGlobalRequire(globalThis) ? __runtimeRequire(\"node:os\").EOL : NEWLINE;\nfunction plural(count, word, pluralWord) {\n\tif (count === 1) return word;\n\treturn pluralWord ?? `${word}s`;\n}\nfunction padText(value, options = {}) {\n\tconst { start = true, end = true, padOnInvalid = true } = options;\n\tif (!isNonEmptyString(value)) return padOnInvalid ? \" \" : \"\";\n\treturn `${start ? \" \" : \"\"}${value}${end ? \" \" : \"\"}`;\n}\nfunction joinInline(...text) {\n\treturn text.filter(Boolean).join(\" \");\n}\nfunction joinLines(...text) {\n\treturn text.filter(Boolean).join(EOL);\n}\nfunction joinLinesLoose(...text) {\n\treturn text.filter((v) => v !== false && v !== null && v !== void 0).join(EOL);\n}\nfunction formatOptionValue(value, options) {\n\tconst { pretty = false, indent = 2, sortKeys = false, sortArray = false } = options ?? {};\n\tconst indentUnit = \" \".repeat(indent);\n\tfunction formatRecursive(input, depth = 0) {\n\t\tconst currentIndent = indentUnit.repeat(depth);\n\t\tconst nextIndent = indentUnit.repeat(depth + 1);\n\t\tconst joinInline = picocolors.dim(\", \");\n\t\tconst joinPretty = `,${EOL}`;\n\t\tif (isSet(input)) return formatRecursive([...input], depth);\n\t\tif (isMap(input)) return formatRecursive(Object.fromEntries(input), depth);\n\t\tif (isArray(input)) {\n\t\t\tconst arr = sortArray ? [...input].sort() : input;\n\t\t\tif (arr.length === 0) return picocolors.gray(\"[]\");\n\t\t\tif (!pretty) {\n\t\t\t\tconst items = arr.map((v) => formatRecursive(v, depth)).join(joinInline);\n\t\t\t\treturn picocolors.gray(\"[\") + items + picocolors.gray(\"]\");\n\t\t\t}\n\t\t\tconst items = arr.map((v) => nextIndent + formatRecursive(v, depth + 1)).join(joinPretty);\n\t\t\treturn picocolors.gray(`[${EOL}`) + items + EOL + currentIndent + picocolors.gray(\"]\");\n\t\t}\n\t\tif (isPlainObject(input)) {\n\t\t\tlet entries = Object.entries(input);\n\t\t\tif (sortKeys) entries = entries.sort(([a], [b]) => a.localeCompare(b));\n\t\t\tif (entries.length === 0) return picocolors.gray(\"{}\");\n\t\t\tif (!pretty) {\n\t\t\t\tconst props = entries.map(([key, val]) => {\n\t\t\t\t\treturn picocolors.dim(key) + picocolors.gray(\": \") + formatRecursive(val, depth);\n\t\t\t\t}).join(joinInline);\n\t\t\t\treturn picocolors.gray(\"{ \") + props + picocolors.gray(\" }\");\n\t\t\t}\n\t\t\tconst props = entries.map(([key, val]) => {\n\t\t\t\treturn nextIndent + picocolors.dim(key) + picocolors.gray(\": \") + formatRecursive(val, depth + 1);\n\t\t\t}).join(joinPretty);\n\t\t\treturn picocolors.gray(`{${EOL}`) + props + EOL + currentIndent + picocolors.gray(\"}\");\n\t\t}\n\t\tif (isRegExp(input)) return picocolors.greenBright(\"/\") + picocolors.redBright(input.source) + picocolors.greenBright(\"/\") + picocolors.magentaBright(input.flags);\n\t\tif (isString(input)) return picocolors.gray(`\"${input}\"`);\n\t\tif (isNumber(input, { includeNaN: true })) return picocolors.redBright(String(input));\n\t\tif (isBoolean(input)) return picocolors.redBright(String(input));\n\t\tif (isNil(input)) return picocolors.redBright(String(input));\n\t\tif (isObject(input)) return picocolors.cyanBright(Object.prototype.toString.call(input));\n\t\treturn picocolors.cyanBright(String(input));\n\t}\n\treturn formatRecursive(value);\n}\nexport { isString as C, toArray as D, safeStableStringify as E, toObjectSet as O, isSet as S, normalizeSpaces as T, isNonEmptyString as _, joinLines as a, isPlainObject as b, picocolors as c, flattenStrings as d, isArray as f, isNil as g, isFunction as h, joinInline as i, toStringSet as k, plural as l, isError as m, NEWLINE as n, joinLinesLoose as o, isBoolean as p, formatOptionValue as r, padText as s, EOL as t, deepFreeze as u, isNull as v, isUndefined as w, isRegExp as x, isNumber as y };\n//# sourceMappingURL=formatter-BpNI5pAL.js.map\n","","","import { joinLines, EOL } from \"@rzl-zone/build-tools/utils\";\n\nimport { punycodeUtilsJS } from \"@/urls/utils/punyCode\";\nimport { assertIsPlainObject } from \"@/assertions/objects/assertIsPlainObject\";\nimport { safeStableStringify } from \"@/conversions/stringify/safeStableStringify\";\n\nimport sldMap from \"./_private/data/domain/sldMap.json\";\nimport ccTldMap from \"./_private/data/domain/ccTldMap.json\";\n\nimport { isString } from \"./isString\";\nimport { isBoolean } from \"./isBoolean\";\n\nimport { getPreciseType } from \"../type/getPreciseType\";\n\n/** ---------------------------------------------------------\n * * ***Options for `isValidDomain` predicate.***\n * ---------------------------------------------------------\n * **Customize the behavior of domain validation.**\n */\ntype IsValidDomainOptions = {\n /** * ***Enable conversion of Unicode domains (IDN) to ASCII (punycode).***\n *\n * - Example: `\"пример.рф\"` ➔ `\"xn--e1afmkfd.xn--p1ai\"`\n * - Allows validating Unicode domains correctly.\n * - Default: `false`\n *\n * @defaultValue `false`.\n */\n allowUnicode?: boolean;\n\n /** * ***If `true`, validates **only top-level domains (TLDs)** that are not part of any SLD/second-level domain.***\n *\n * - Accepts country-code TLDs like `\"ai\"` or `\"ai.\"` ✅\n * - Rejects common TLDs that are part of SLDs like `\"com\"` ❌\n * - Only the final label is checked; subdomains are ignored.\n * - Default: `false`\n *\n * @defaultValue `false`.\n */\n topLevel?: boolean;\n\n /** * ***Allow or disallow subdomains.***\n *\n * - Example: `\"sub.example.com\"` ✅ if `subdomain` is `true`, ❌ if `false`\n * - Wildcards and SLDs are considered when evaluating subdomains.\n * - Default: `true`\n *\n * @defaultValue `true`.\n */\n subdomain?: boolean;\n\n /** * ***Allow a wildcard `*` in the left-most label.***\n *\n * - Example: `\"*.example.com\"` ✅ if `wildcard` is `true`, ❌ if `false`\n * - Wildcards are only valid in the first label and require at least one additional label.\n * - Default: `false`\n *\n * @defaultValue `false`.\n */\n wildcard?: boolean;\n\n /** * ***Allow a port after the domain.***\n *\n * - Example: `\"localhost:3000\"` or `\"example.com:8080\"` ✅ if `allowPort` is `true`\n * - Validates that the port is a number between `1` and `65535`.\n * - Does not affect domain validation rules otherwise.\n * - Default: `false`\n *\n * @defaultValue `false`.\n */\n allowPort?: boolean;\n\n /** * ***Allow special domains like `localhost`.***\n *\n * - Example: `\"localhost\"` ✅ if `allowLocalhost` is `true`\n * - Works with or without a port if `allowPort` is enabled.\n * - Default: `false`\n *\n * @defaultValue `false`.\n */\n allowLocalhost?: boolean;\n\n /** * ***Allow URLs with protocol (`http`/`https`) and automatically extract the hostname.***\n *\n * - Example: `\"https://example.com/foo/bar\"` ➔ `\"example.com\"`\n * - The function will validate only the hostname part and ignore the path, query, and fragment.\n * - Default: `false`\n *\n * @defaultValue `false`.\n */\n allowProtocol?: boolean;\n};\n\n/** ---------------------------------------------------------\n * * ***Predicate: `isValidDomain`.***\n * ---------------------------------------------------------\n * **Validates whether a given string is a properly formatted domain name.**\n *\n * - **Supports options for:**\n * - `allowUnicode` ➔ allows internationalized domain names (IDN) with Unicode characters.\n * - `topLevel` ➔ validates **only top-level domains (TLDs)**; ignores subdomains and SLDs.\n * - `subdomain` ➔ allows or disallows subdomains.\n * - `wildcard` ➔ allows wildcard (`*`) in the left-most label.\n * - `allowPort` ➔ allows a port number after the domain (e.g., `example.com:8080`).\n * - `allowLocalhost` ➔ allows the special domain `\"localhost\"`.\n * - `allowProtocol` ➔ allows a URL with protocol (`http`/`https`) and extracts the hostname.\n *\n * - **Behavior:**\n * - ✅ Converts Unicode to ASCII (punycode) if `allowUnicode` is `true`.\n * - ✅ Checks label lengths (≤63 chars), valid characters, and punycode consistency.\n * - ✅ Validates port if `allowPort` is `true` (must be 1–65535).\n * - ✅ Accepts `\"localhost\"` if `allowLocalhost` is `true`.\n * - ✅ Extracts hostname from URLs if `allowProtocol` is `true`.\n * - ❌ Rejects invalid domains, labels starting/ending with `-`, double dots, malformed TLDs, or invalid port numbers.\n * - ✅ Handles both standard domains (example.com), URLs with protocols (https://example.com/foo), and IDNs (пример.рф).\n *\n * @param {*} value - The value to validate; only strings are valid domains.\n * @param {IsValidDomainOptions} [options] - Optional configuration for domain validation.\n * @param {boolean} [options.allowUnicode=false] - Enable punycode conversion for Unicode domains.\n * @param {boolean} [options.topLevel=false] - Validate only TLDs (e.g., `ai`, `uk.`); ignores SLDs like `com`.\n * @param {boolean} [options.subdomain=true] - Allow subdomains; set `false` to reject any subdomain.\n * @param {boolean} [options.wildcard=false] - Allow wildcard `*` in the left-most label (e.g., `*.example.com`).\n * @param {boolean} [options.allowPort=false] - Allow port number after domain (e.g., `:3000`); must be 1–65535.\n * @param {boolean} [options.allowLocalhost=false] - Allow special domain `\"localhost\"`.\n * @param {boolean} [options.allowProtocol=false] - Allow URLs with protocol (`http`/`https`) and extract hostname only.\n * @returns {boolean} Returns `true` if the value is a valid domain according to the rules and options; otherwise `false`.\n *\n * @example\n * isValidDomain(\"google.com\");\n * // ➔ true\n * isValidDomain(\"пример.рф\", { allowUnicode: true });\n * // ➔ true\n * isValidDomain(\"sub.example.com\", { subdomain: false });\n * // ➔ false\n * isValidDomain(\"*.example.com\", { wildcard: true });\n * // ➔ true\n * isValidDomain(\"com\", { topLevel: true });\n * // ➔ false (common TLD rejected because it's part of SLD)\n * isValidDomain(\"ai.\", { topLevel: true });\n * // ➔ true (country-code TLD accepted)\n * isValidDomain(\"localhost\", { allowLocalhost: true });\n * // ➔ true\n * isValidDomain(\"localhost:3000\", { allowLocalhost: true, allowPort: true });\n * // ➔ true\n * isValidDomain(\"example.com:8080\", { allowPort: true });\n * // ➔ true\n * isValidDomain(\"https://example.com/foo/bar\", { allowProtocol: true });\n * // ➔ true (protocol stripped and hostname validated)\n * isValidDomain(\"invalid_domain.com\");\n * // ➔ false\n */\nexport function isValidDomain(\n value: unknown,\n options: IsValidDomainOptions = {}\n): boolean {\n if (!isString(value)) return false;\n\n assertIsPlainObject(options, {\n message: ({ currentType, validType }) =>\n `Second parameter (\\`options\\`) must be of type \\`${validType}\\`, but received: \\`${currentType}\\`.`\n });\n\n const {\n subdomain = true,\n topLevel = false,\n wildcard = false,\n allowUnicode = false,\n allowPort = false,\n allowLocalhost = false,\n allowProtocol = false\n } = options;\n\n // Validate Options:\n const invalid = Object.entries({\n subdomain,\n topLevel,\n wildcard,\n allowUnicode,\n allowProtocol,\n allowPort,\n allowLocalhost\n }).filter(([, value]) => !isBoolean(value));\n\n if (invalid.length) {\n const msg = invalid\n .map(([key, value], i) => {\n return joinLines(\n ` ${i + 1}. option: \"${key}\"`,\n \" expected: boolean\",\n ` received: ${getPreciseType(value)} (${safeStableStringify(\n value,\n {\n keepUndefined: true\n }\n )})`\n );\n })\n .join(EOL);\n\n throw new TypeError(\n joinLines(\n \"\",\n \"> Invalid options detected in second parameter of `isValidDomain`:\",\n msg\n )\n );\n }\n // -----------------\n\n let _value = value.toLowerCase();\n\n if (allowProtocol) {\n try {\n const url = new URL(value); // use original input\n if (url.protocol !== \"http:\" && url.protocol !== \"https:\") return false; // reject non-http(s)\n if (!allowPort && url.port) return false; // reject port if allowPort=false\n _value = url.hostname.toLowerCase(); // extract only hostname\n\n // wildcard check\n const labels = _value.split(\".\");\n if (labels[0] === \"*\" && !wildcard) return false;\n } catch {\n // if parsing fails, leave _value unchanged\n }\n }\n\n if (value.endsWith(\".\")) {\n _value = _value.slice(0, _value.length - 1);\n }\n\n // Handle port\n let port: string;\n if (allowPort) {\n const portMatch = _value.match(/:(\\d{1,5})$/);\n if (portMatch) {\n port = portMatch[0];\n _value = _value.slice(0, -port.length);\n const portNum = Number(portMatch[1]);\n if (portNum < 1 || portNum > 65535) return false;\n }\n }\n\n // Allow localhost\n if (allowLocalhost && _value === \"localhost\") return true;\n\n if (allowUnicode) {\n try {\n _value = punycodeUtilsJS.toASCII(_value);\n } catch {\n return false;\n }\n }\n\n if (_value.length > 253) return false;\n\n const validChars = /^([\\u0E00-\\u0E7Fa-z0-9-._*]+)$/g;\n if (!validChars.test(_value)) return false;\n\n if (topLevel) {\n if (ccTldMap[_value.replace(/\\.$/, \"\") as keyof typeof ccTldMap]) {\n return true;\n }\n }\n\n const sldRegex = /(.*)\\.(([\\u0E00-\\u0E7Fa-z0-9]+)(\\.[a-z0-9]+))/;\n const matches = _value.match(sldRegex);\n // eslint-disable-next-line no-useless-assignment\n let tld: string | null = null;\n let labels: string[] | null = null;\n\n if (matches && matches.length > 2) {\n if (sldMap[matches[2] as keyof typeof sldMap]) {\n // eslint-disable-next-line no-useless-assignment\n tld = matches[2] || null;\n labels = matches[1]?.split(\".\") || null;\n }\n }\n\n if (!labels) {\n labels = _value.split(\".\");\n if (labels.length <= 1) return false;\n\n tld = labels.pop()!;\n const tldRegex = /^(?:xn--)?(?!^\\d+$)[\\u0E00-\\u0E7Fa-z0-9]+$/gi;\n if (!tldRegex.test(tld)) return false;\n }\n\n if (subdomain === false && labels.length > 1) return false;\n\n return labels.every((label, index) => {\n if (wildcard && index === 0 && label === \"*\" && labels.length > 1) {\n return true;\n }\n\n let validLabelChars = /^([\\u0E00-\\u0E7Fa-zA-Z0-9-_]+)$/g;\n if (index === labels.length - 1) {\n validLabelChars = /^([\\u0E00-\\u0E7Fa-zA-Z0-9-]+)$/g;\n }\n\n const doubleDashCount = (label.match(/--(--)?/g) || []).length;\n const xnDashCount = (label.match(/xn--/g) || []).length;\n if (index === labels.length - 1 && doubleDashCount !== xnDashCount) {\n return false;\n }\n\n return (\n validLabelChars.test(label) &&\n label.length < 64 &&\n !label.startsWith(\"-\") &&\n !label.endsWith(\"-\")\n );\n });\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgBA,MAAa,SAAS,UAAiC;CACrD,OAAO,iBAAiB;AAC1B;;;;;;;;;;;;;ACgCA,SAAS,QAAQ,OAAO;CACvB,OAAO,MAAM,QAAQ,KAAK;AAC3B;AAOA,SAAS,SAAS,OAAO;CACxB,OAAO,OAAO,UAAU,YAAY,CAAC,MAAM,KAAK,KAAK,CAAC,QAAQ,KAAK;AACpE;AAIA,MAAM,SAAS,UAAU;CACxB,OAAO,SAAS;AACjB;AAOA,MAAM,cAAc,UAAU;CAC7B,OAAO,OAAO,UAAU;AACzB;AA0IA,MAAM,oBAAoB,UAAU,SAAS,KAAK,KAAK,WAAW,MAAM,OAAO;AAC/E,MAAM,0BAA0B;CAC/B,IAAI,CAAC,iBAAiB,UAAU,GAAG,OAAO,KAAK;CAC/C,OAAO,W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SAAS,GAC5B,kBAAkB;EAGpB,MAAM,mBAAmB,MAAM,MAAM,UAAU,KAAK,CAAC,GAAG;EACxD,MAAM,eAAe,MAAM,MAAM,OAAO,KAAK,CAAC,GAAG;EACjD,IAAI,UAAU,OAAO,SAAS,KAAK,oBAAoB,aACrD,OAAO;EAGT,OACE,gBAAgB,KAAK,KAAK,KAC1B,MAAM,SAAS,MACf,CAAC,MAAM,WAAW,GAAG,KACrB,CAAC,MAAM,SAAS,GAAG;CAEvB,CAAC;AACH"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"noop-BY43WaoU.cjs","names":[],"sources":["../src/generators/utils/noop.ts"],"sourcesContent":["/**\n * --------------------------------------------------\n * * ***Utility: `noop`.***\n * --------------------------------------------------\n * **A no-operation function that performs no action.**\n *\n * @description\n * Commonly used as a **placeholder**, **default callback**, or **stub function**.\n *\n * - **Behavior**:\n * - Does not return any meaningful value (`void`).\n * - Safely callable in any context without side effects.\n *\n * @remarks\n * Although this function returns `void`, it implicitly results in `undefined`,\n * but the return value should never be relied upon.\n *\n * @example\n * **1. Basic usage** — does nothing and returns undefined implicitly:\n * ```\n * import { noop } from \"@rzl-zone/utils-js/generators\";\n *\n * noop(); // ➔ no effect (void)\n * ```\n * @example\n * **2. Using with type-checking helpers:**\n * ```ts\n * import { noop } from \"@rzl-zone/utils-js/generators\";\n * import { isFunction, isUndefined } from \"@rzl-zone/utils-js/predicates\";\n *\n * isFunction(noop); // ➔ true — `noop` is a function\n * isUndefined(noop()); // ➔ true — calling `noop()` returns `undefined`\n * isFunction(noop()); // ➔ false — the return value is `undefined`, not a function\n * ```\n * @example\n * **3. As a default callback:**\n * ```ts\n * import { noop } from \"@rzl-zone/utils-js/generators\";\n *\n * const callback = noop;\n * callback(); // ➔ no effect (void)\n * ```\n */\nexport const noop = (): void => {};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2CA,MAAa,aAAmB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"noop-CjY8xVHv.js","names":[],"sources":["../src/generators/utils/noop.ts"],"sourcesContent":["/**\n * --------------------------------------------------\n * * ***Utility: `noop`.***\n * --------------------------------------------------\n * **A no-operation function that performs no action.**\n *\n * @description\n * Commonly used as a **placeholder**, **default callback**, or **stub function**.\n *\n * - **Behavior**:\n * - Does not return any meaningful value (`void`).\n * - Safely callable in any context without side effects.\n *\n * @remarks\n * Although this function returns `void`, it implicitly results in `undefined`,\n * but the return value should never be relied upon.\n *\n * @example\n * **1. Basic usage** — does nothing and returns undefined implicitly:\n * ```\n * import { noop } from \"@rzl-zone/utils-js/generators\";\n *\n * noop(); // ➔ no effect (void)\n * ```\n * @example\n * **2. Using with type-checking helpers:**\n * ```ts\n * import { noop } from \"@rzl-zone/utils-js/generators\";\n * import { isFunction, isUndefined } from \"@rzl-zone/utils-js/predicates\";\n *\n * isFunction(noop); // ➔ true — `noop` is a function\n * isUndefined(noop()); // ➔ true — calling `noop()` returns `undefined`\n * isFunction(noop()); // ➔ false — the return value is `undefined`, not a function\n * ```\n * @example\n * **3. As a default callback:**\n * ```ts\n * import { noop } from \"@rzl-zone/utils-js/generators\";\n *\n * const callback = noop;\n * callback(); // ➔ no effect (void)\n * ```\n */\nexport const noop = (): void => {};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2CA,MAAa,aAAmB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"normalizeSpaces-BhZp0U_6.cjs","names":["isNonEmptyString","isPlainObject"],"sources":["../src/strings/sanitizations/normalizeSpaces.ts"],"sourcesContent":["import { isPlainObject } from \"@/predicates/is/isPlainObject\";\nimport { isNonEmptyString } from \"@/predicates/is/isNonEmptyString\";\n\ntype NormalizeSpacesOptions = {\n /** If `true`, skips normalization and only trims whitespace from start & end, defaultValue: `false`.\n *\n * @default false\n */\n trimOnly?: boolean;\n /** If `false`, skips trimming value, defaultValue: `true`.\n *\n * @default true\n */\n withTrim?: boolean;\n};\n\n/** ----------------------------------------------------------\n * * ***Utility: `normalizeSpaces`.***\n * ----------------------------------------------------------\n * **Normalizes whitespace in a string by reducing multiple spaces\n * to a single space, optionally trims, or only trims based on options.**\n * - **Behavior:**\n * - Collapses all consecutive whitespace (spaces, tabs, newlines) into a single space.\n * - Can trim leading/trailing spaces (default behavior), or preserve them with `withTrim: false`.\n * - Can skip normalization entirely and only trim using `trimOnly: true`.\n * - Returns an empty string if input is `null` or `undefined`.\n * @param {string | null | undefined} value - The input string to be processed. If `null` or `undefined`, returns an empty string.\n * @param {NormalizeSpacesOptions} [options] - Configuration options.\n * @param {NormalizeSpacesOptions[\"trimOnly\"]} [options.trimOnly=false] - If `true`, skips normalization and only trims the string.\n * @param {NormalizeSpacesOptions[\"withTrim\"]} [options.withTrim=true] - If `false`, preserves leading/trailing whitespace.\n * @returns {string} The processed string.\n * @example\n * normalizeSpaces(\" Hello World\\tthis is\\n\\nok \");\n * // ➔ \"Hello World this is ok\"\n * normalizeSpaces(\" Hello World\\tthis is\\n\\nok \", { trimOnly: true });\n * // ➔ \"Hello World\tthis is\\n\\nok\"\n * normalizeSpaces(\" Hello World \", { withTrim: false });\n * // ➔ \" Hello World \"\n * normalizeSpaces(null);\n * // ➔ \"\"\n */\nexport const normalizeSpaces = (\n value: string | null | undefined,\n options: NormalizeSpacesOptions = {\n withTrim: true,\n trimOnly: false\n }\n): string => {\n if (!isNonEmptyString(value)) return \"\";\n\n if (!isPlainObject(options)) {\n options = {};\n }\n\n const { trimOnly = false, withTrim = true } = options;\n\n if (trimOnly) return value.trim();\n\n if (withTrim) {\n value = value.trim();\n }\n\n // Remove all duplicate spaces (including tabs, newlines, etc.)\n return value.replace(/\\s+/g, \" \");\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyCA,MAAa,mBACX,OACA,UAAkC;CAChC,UAAU;CACV,UAAU;AACZ,MACW;CACX,IAAI,CAACA,yCAAiB,KAAK,GAAG,OAAO;CAErC,IAAI,CAACC,sCAAc,OAAO,GACxB,UAAU,CAAC;CAGb,MAAM,EAAE,WAAW,OAAO,WAAW,SAAS;CAE9C,IAAI,UAAU,OAAO,MAAM,KAAK;CAEhC,IAAI,UACF,QAAQ,MAAM,KAAK;CAIrB,OAAO,MAAM,QAAQ,QAAQ,GAAG;AAClC"}
|