@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 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"isBigInt-BVj0M5pq.cjs","names":[],"sources":["../src/predicates/is/isBigInt.ts"],"sourcesContent":["/** ----------------------------------------------------------\n * * ***Type guard: `isBigInt`.***\n * ----------------------------------------------------------\n * **Checks if a value is of type **[`BigInt`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt)**.**\n * - **Behavior:**\n * - Uses `typeof value === \"bigint\"` for strict type checking.\n * - Supports TypeScript type narrowing with `value is bigint`.\n * - Returns `false` for `BigInt` object (object-wrapped), e.g:\n * - `Object(BigInt(123))`.\n * @param {*} value - The value to check.\n * @returns {boolean} Return `true` if value is a primitive bigint.\n * @example\n * isBigInt(123n);\n * // ➔ true\n * isBigInt(BigInt(123));\n * // ➔ true\n * isBigInt(\"123\");\n * // ➔ false\n * isBigInt(Object(BigInt(1)));\n * // ➔ false\n */\nexport const isBigInt = (value: unknown): value is bigint => {\n return typeof value === \"bigint\";\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqBA,MAAa,YAAY,UAAoC;CAC3D,OAAO,OAAO,UAAU;AAC1B"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"isBigInt-y7s3rsKc.js","names":[],"sources":["../src/predicates/is/isBigInt.ts"],"sourcesContent":["/** ----------------------------------------------------------\n * * ***Type guard: `isBigInt`.***\n * ----------------------------------------------------------\n * **Checks if a value is of type **[`BigInt`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt)**.**\n * - **Behavior:**\n * - Uses `typeof value === \"bigint\"` for strict type checking.\n * - Supports TypeScript type narrowing with `value is bigint`.\n * - Returns `false` for `BigInt` object (object-wrapped), e.g:\n * - `Object(BigInt(123))`.\n * @param {*} value - The value to check.\n * @returns {boolean} Return `true` if value is a primitive bigint.\n * @example\n * isBigInt(123n);\n * // ➔ true\n * isBigInt(BigInt(123));\n * // ➔ true\n * isBigInt(\"123\");\n * // ➔ false\n * isBigInt(Object(BigInt(1)));\n * // ➔ false\n */\nexport const isBigInt = (value: unknown): value is bigint => {\n return typeof value === \"bigint\";\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqBA,MAAa,YAAY,UAAoC;CAC3D,OAAO,OAAO,UAAU;AAC1B"}
|
|
@@ -1,37 +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_assertIsBoolean = require('./assertIsBoolean-D41HrTB_.cjs');
|
|
12
|
-
const isEmptyArray = (value) => {
|
|
13
|
-
if (!require_assertIsBoolean.isArray(value)) return true;
|
|
14
|
-
return value.length === 0;
|
|
15
|
-
};
|
|
16
|
-
function isEmptyObject(value, options = {}) {
|
|
17
|
-
if (!require_assertIsBoolean.isObject(value)) return true;
|
|
18
|
-
require_assertIsBoolean.assertIsPlainObject(options, { message: ({ currentType, validType }) => `Second parameter (\`options\`) must be of type \`${validType}\`, but received: \`${currentType}\`.` });
|
|
19
|
-
const checkSymbols = require_assertIsBoolean.hasOwnProp(options, "checkSymbols") ? options.checkSymbols : false;
|
|
20
|
-
require_assertIsBoolean.assertIsBoolean(checkSymbols, { message: ({ currentType, validType }) => `Parameter \`checkSymbols\` property of the \`options\` (second parameter) must be of type \`${validType}\`, but received: \`${currentType}\`.` });
|
|
21
|
-
const hasNoKeys = Object.keys(value).length === 0;
|
|
22
|
-
if (checkSymbols) return hasNoKeys && Object.getOwnPropertySymbols(value).length === 0;
|
|
23
|
-
return hasNoKeys;
|
|
24
|
-
}
|
|
25
|
-
Object.defineProperty(exports, 'isEmptyArray', {
|
|
26
|
-
enumerable: true,
|
|
27
|
-
get: function () {
|
|
28
|
-
return isEmptyArray;
|
|
29
|
-
}
|
|
30
|
-
});
|
|
31
|
-
Object.defineProperty(exports, 'isEmptyObject', {
|
|
32
|
-
enumerable: true,
|
|
33
|
-
get: function () {
|
|
34
|
-
return isEmptyObject;
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
//# sourceMappingURL=isEmptyObject-BsHngDz4.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"isEmptyObject-BsHngDz4.cjs","names":["isArray","isObject","hasOwnProp"],"sources":["../src/predicates/is/isEmptyArray.ts","../src/predicates/is/isEmptyObject.ts"],"sourcesContent":["import { isArray } from \"@/predicates/is/isArray\";\n\n/** ----------------------------------------------------------\n * * ***Predicate: `isEmptyArray`.***\n * ----------------------------------------------------------\n * **Checks whether a given value is an empty array.**\n * - **Behavior:**\n * - Non-array inputs are considered ***`empty`*** ***(defensive strategy)***.\n * @param {*} [value] - The value to check.\n * @returns {boolean} Returns `true` if it's ***not an array*** or ***an empty-array***.\n * @example\n * isEmptyArray([]); // ➔ true\n * isEmptyArray([1, 2, 3]); // ➔ false\n * isEmptyArray(\"not an array\"); // ➔ true\n * isEmptyArray(null); // ➔ true\n * isEmptyArray(undefined); // ➔ true\n *\n * if (isEmptyArray(data.items)) {\n * console.log(\"No items to display.\");\n * }\n */\nexport const isEmptyArray = (value: unknown): boolean => {\n if (!isArray(value)) return true;\n\n return value.length === 0;\n};\n","import { isObject } from \"./isObject\";\nimport { hasOwnProp } from \"../has/hasOwnProp\";\n\nimport { assertIsBoolean } from \"@/assertions/booleans/assertIsBoolean\";\nimport { assertIsPlainObject } from \"@/assertions/objects/assertIsPlainObject\";\n\ntype IsEmptyObjectOptions = {\n /** Whether to check for symbol properties in addition to string keys, defaultValue: `false`.\n *\n * @default false\n */\n checkSymbols?: boolean;\n};\n\n/** ----------------------------------------------------------\n * * ***Predicate: `isEmptyObject`.***\n * ----------------------------------------------------------\n * **Checks if a value is a plain object with **no own enumerable string-key properties**,\n * and optionally **no own enumerable symbol-key properties** when `checkSymbols` is `true`.**\n * - **Behavior:**\n * - If the value is **not an object** (e.g. `null`, array, primitive), it is considered empty.\n * - If `options.checkSymbols` is `true`, **symbol properties** are also checked.\n * @param {*} value - The value to check.\n * @param {IsEmptyObjectOptions} [options] - Optional settings.\n * @param {IsEmptyObjectOptions[\"checkSymbols\"]} [options.checkSymbols=false] - Whether to also check symbol properties.\n * @returns {boolean} Return `true` if the value is considered empty or not an object, false otherwise.\n * @example\n * isEmptyObject({});\n * // ➔ true\n * isEmptyObject({}, { checkSymbols: true });\n * // ➔ true\n * isEmptyObject({ a: 1 });\n * // ➔ false\n * isEmptyObject({ [Symbol('s')]: 1 });\n * // ➔ true\n * isEmptyObject({ [Symbol('s')]: 1 }, { checkSymbols: true });\n * // ➔ false\n * isEmptyObject(null);\n * // ➔ true (not object)\n * isEmptyObject([]);\n * // ➔ true (not plain object)\n * isEmptyObject(123);\n * // ➔ true (not object)\n */\nexport function isEmptyObject(\n value: unknown,\n options: IsEmptyObjectOptions = {}\n): boolean {\n if (!isObject(value)) {\n return true;\n }\n\n assertIsPlainObject(options, {\n message: ({ currentType, validType }) =>\n `Second parameter (\\`options\\`) must be of type \\`${validType}\\`, but received: \\`${currentType}\\`.`\n });\n\n const checkSymbols = hasOwnProp(options, \"checkSymbols\")\n ? options.checkSymbols\n : false;\n\n assertIsBoolean(checkSymbols, {\n message: ({ currentType, validType }) =>\n `Parameter \\`checkSymbols\\` property of the \\`options\\` (second parameter) must be of type \\`${validType}\\`, but received: \\`${currentType}\\`.`\n });\n\n const hasNoKeys = Object.keys(value).length === 0;\n if (checkSymbols) {\n return hasNoKeys && Object.getOwnPropertySymbols(value).length === 0;\n }\n return hasNoKeys;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqBA,MAAa,gBAAgB,UAA4B;CACvD,IAAI,CAACA,gCAAQ,KAAK,GAAG,OAAO;CAE5B,OAAO,MAAM,WAAW;AAC1B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACmBA,SAAgB,cACd,OACA,UAAgC,CAAC,GACxB;CACT,IAAI,CAACC,iCAAS,KAAK,GACjB,OAAO;CAGT,4CAAoB,SAAS,EAC3B,UAAU,EAAE,aAAa,gBACvB,oDAAoD,UAAU,sBAAsB,YAAY,KACpG,CAAC;CAED,MAAM,eAAeC,mCAAW,SAAS,cAAc,IACnD,QAAQ,eACR;CAEJ,wCAAgB,cAAc,EAC5B,UAAU,EAAE,aAAa,gBACvB,+FAA+F,UAAU,sBAAsB,YAAY,KAC/I,CAAC;CAED,MAAM,YAAY,OAAO,KAAK,KAAK,EAAE,WAAW;CAChD,IAAI,cACF,OAAO,aAAa,OAAO,sBAAsB,KAAK,EAAE,WAAW;CAErE,OAAO;AACT"}
|
|
@@ -1,25 +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 { M as isArray, T as assertIsPlainObject, b as hasOwnProp, j as isObject, t as assertIsBoolean } from "./assertIsBoolean-CWUs-I5l.js";
|
|
11
|
-
const isEmptyArray = (value) => {
|
|
12
|
-
if (!isArray(value)) return true;
|
|
13
|
-
return value.length === 0;
|
|
14
|
-
};
|
|
15
|
-
function isEmptyObject(value, options = {}) {
|
|
16
|
-
if (!isObject(value)) return true;
|
|
17
|
-
assertIsPlainObject(options, { message: ({ currentType, validType }) => `Second parameter (\`options\`) must be of type \`${validType}\`, but received: \`${currentType}\`.` });
|
|
18
|
-
const checkSymbols = hasOwnProp(options, "checkSymbols") ? options.checkSymbols : false;
|
|
19
|
-
assertIsBoolean(checkSymbols, { message: ({ currentType, validType }) => `Parameter \`checkSymbols\` property of the \`options\` (second parameter) must be of type \`${validType}\`, but received: \`${currentType}\`.` });
|
|
20
|
-
const hasNoKeys = Object.keys(value).length === 0;
|
|
21
|
-
if (checkSymbols) return hasNoKeys && Object.getOwnPropertySymbols(value).length === 0;
|
|
22
|
-
return hasNoKeys;
|
|
23
|
-
}
|
|
24
|
-
export { isEmptyArray as n, isEmptyObject as t };
|
|
25
|
-
//# sourceMappingURL=isEmptyObject-DPGR9iPj.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"isEmptyObject-DPGR9iPj.js","names":[],"sources":["../src/predicates/is/isEmptyArray.ts","../src/predicates/is/isEmptyObject.ts"],"sourcesContent":["import { isArray } from \"@/predicates/is/isArray\";\n\n/** ----------------------------------------------------------\n * * ***Predicate: `isEmptyArray`.***\n * ----------------------------------------------------------\n * **Checks whether a given value is an empty array.**\n * - **Behavior:**\n * - Non-array inputs are considered ***`empty`*** ***(defensive strategy)***.\n * @param {*} [value] - The value to check.\n * @returns {boolean} Returns `true` if it's ***not an array*** or ***an empty-array***.\n * @example\n * isEmptyArray([]); // ➔ true\n * isEmptyArray([1, 2, 3]); // ➔ false\n * isEmptyArray(\"not an array\"); // ➔ true\n * isEmptyArray(null); // ➔ true\n * isEmptyArray(undefined); // ➔ true\n *\n * if (isEmptyArray(data.items)) {\n * console.log(\"No items to display.\");\n * }\n */\nexport const isEmptyArray = (value: unknown): boolean => {\n if (!isArray(value)) return true;\n\n return value.length === 0;\n};\n","import { isObject } from \"./isObject\";\nimport { hasOwnProp } from \"../has/hasOwnProp\";\n\nimport { assertIsBoolean } from \"@/assertions/booleans/assertIsBoolean\";\nimport { assertIsPlainObject } from \"@/assertions/objects/assertIsPlainObject\";\n\ntype IsEmptyObjectOptions = {\n /** Whether to check for symbol properties in addition to string keys, defaultValue: `false`.\n *\n * @default false\n */\n checkSymbols?: boolean;\n};\n\n/** ----------------------------------------------------------\n * * ***Predicate: `isEmptyObject`.***\n * ----------------------------------------------------------\n * **Checks if a value is a plain object with **no own enumerable string-key properties**,\n * and optionally **no own enumerable symbol-key properties** when `checkSymbols` is `true`.**\n * - **Behavior:**\n * - If the value is **not an object** (e.g. `null`, array, primitive), it is considered empty.\n * - If `options.checkSymbols` is `true`, **symbol properties** are also checked.\n * @param {*} value - The value to check.\n * @param {IsEmptyObjectOptions} [options] - Optional settings.\n * @param {IsEmptyObjectOptions[\"checkSymbols\"]} [options.checkSymbols=false] - Whether to also check symbol properties.\n * @returns {boolean} Return `true` if the value is considered empty or not an object, false otherwise.\n * @example\n * isEmptyObject({});\n * // ➔ true\n * isEmptyObject({}, { checkSymbols: true });\n * // ➔ true\n * isEmptyObject({ a: 1 });\n * // ➔ false\n * isEmptyObject({ [Symbol('s')]: 1 });\n * // ➔ true\n * isEmptyObject({ [Symbol('s')]: 1 }, { checkSymbols: true });\n * // ➔ false\n * isEmptyObject(null);\n * // ➔ true (not object)\n * isEmptyObject([]);\n * // ➔ true (not plain object)\n * isEmptyObject(123);\n * // ➔ true (not object)\n */\nexport function isEmptyObject(\n value: unknown,\n options: IsEmptyObjectOptions = {}\n): boolean {\n if (!isObject(value)) {\n return true;\n }\n\n assertIsPlainObject(options, {\n message: ({ currentType, validType }) =>\n `Second parameter (\\`options\\`) must be of type \\`${validType}\\`, but received: \\`${currentType}\\`.`\n });\n\n const checkSymbols = hasOwnProp(options, \"checkSymbols\")\n ? options.checkSymbols\n : false;\n\n assertIsBoolean(checkSymbols, {\n message: ({ currentType, validType }) =>\n `Parameter \\`checkSymbols\\` property of the \\`options\\` (second parameter) must be of type \\`${validType}\\`, but received: \\`${currentType}\\`.`\n });\n\n const hasNoKeys = Object.keys(value).length === 0;\n if (checkSymbols) {\n return hasNoKeys && Object.getOwnPropertySymbols(value).length === 0;\n }\n return hasNoKeys;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqBA,MAAa,gBAAgB,UAA4B;CACvD,IAAI,CAAC,QAAQ,KAAK,GAAG,OAAO;CAE5B,OAAO,MAAM,WAAW;AAC1B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACmBA,SAAgB,cACd,OACA,UAAgC,CAAC,GACxB;CACT,IAAI,CAAC,SAAS,KAAK,GACjB,OAAO;CAGT,oBAAoB,SAAS,EAC3B,UAAU,EAAE,aAAa,gBACvB,oDAAoD,UAAU,sBAAsB,YAAY,KACpG,CAAC;CAED,MAAM,eAAe,WAAW,SAAS,cAAc,IACnD,QAAQ,eACR;CAEJ,gBAAgB,cAAc,EAC5B,UAAU,EAAE,aAAa,gBACvB,+FAA+F,UAAU,sBAAsB,YAAY,KAC/I,CAAC;CAED,MAAM,YAAY,OAAO,KAAK,KAAK,EAAE,WAAW;CAChD,IAAI,cACF,OAAO,aAAa,OAAO,sBAAsB,KAAK,EAAE,WAAW;CAErE,OAAO;AACT"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"isEmptyString-BYMz_wt9.js","names":[],"sources":["../src/predicates/is/isEmptyString.ts"],"sourcesContent":["import { isNonEmptyString } from \"./isNonEmptyString\";\n\ntype IsEmptyStringOptions = {\n /** Whether to trim the string before checking, defaultValue: `true`.\n *\n * @default true */\n trim?: boolean;\n};\n\n/** ----------------------------------------------------------\n * * ***Predicate: `isEmptyString`.***\n * ----------------------------------------------------------\n * **Checks whether a given value is an **empty-string**.**\n * - **Behavior:**\n * - Considers `\"\"` and whitespace-only strings as\n * empty (if `trim` is enabled, which is the default).\n * - Non-string inputs are also considered empty.\n * @param {*} value - The value to check.\n * @param {IsEmptyStringOptions} [options] - Optional settings.\n * @param {IsEmptyStringOptions[\"trim\"]} [options.trim=true] - Whether to trim the string before checking, defaultValue: `true`.\n * @returns {boolean} Returns `true` if the value is string not a string or value string is considered empty.\n * @example\n * isEmptyString(\"\");\n * // ➔ true\n * isEmptyString(\" \");\n * // ➔ true (default trims)\n * isEmptyString(\" \", { trim: false });\n * // ➔ false\n * isEmptyString(\"hello\");\n * // ➔ false\n * isEmptyString(undefined);\n * // ➔ true\n * isEmptyString(null);\n * // ➔ true\n * isEmptyString(123 as any);\n * // ➔ true\n *\n * // Used in validation\n * if (isEmptyString(form.name)) {\n * throw new Error(\"Name cannot be empty.\");\n * }\n */\nexport const isEmptyString = (\n value: unknown,\n options: IsEmptyStringOptions = {}\n): boolean => {\n return !isNonEmptyString(value, options);\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0CA,MAAa,iBACX,OACA,UAAgC,CAAC,MACrB;CACZ,OAAO,CAAC,iBAAiB,OAAO,OAAO;AACzC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"isEmptyString-C8PYNPgw.cjs","names":["isNonEmptyString"],"sources":["../src/predicates/is/isEmptyString.ts"],"sourcesContent":["import { isNonEmptyString } from \"./isNonEmptyString\";\n\ntype IsEmptyStringOptions = {\n /** Whether to trim the string before checking, defaultValue: `true`.\n *\n * @default true */\n trim?: boolean;\n};\n\n/** ----------------------------------------------------------\n * * ***Predicate: `isEmptyString`.***\n * ----------------------------------------------------------\n * **Checks whether a given value is an **empty-string**.**\n * - **Behavior:**\n * - Considers `\"\"` and whitespace-only strings as\n * empty (if `trim` is enabled, which is the default).\n * - Non-string inputs are also considered empty.\n * @param {*} value - The value to check.\n * @param {IsEmptyStringOptions} [options] - Optional settings.\n * @param {IsEmptyStringOptions[\"trim\"]} [options.trim=true] - Whether to trim the string before checking, defaultValue: `true`.\n * @returns {boolean} Returns `true` if the value is string not a string or value string is considered empty.\n * @example\n * isEmptyString(\"\");\n * // ➔ true\n * isEmptyString(\" \");\n * // ➔ true (default trims)\n * isEmptyString(\" \", { trim: false });\n * // ➔ false\n * isEmptyString(\"hello\");\n * // ➔ false\n * isEmptyString(undefined);\n * // ➔ true\n * isEmptyString(null);\n * // ➔ true\n * isEmptyString(123 as any);\n * // ➔ true\n *\n * // Used in validation\n * if (isEmptyString(form.name)) {\n * throw new Error(\"Name cannot be empty.\");\n * }\n */\nexport const isEmptyString = (\n value: unknown,\n options: IsEmptyStringOptions = {}\n): boolean => {\n return !isNonEmptyString(value, options);\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0CA,MAAa,iBACX,OACA,UAAgC,CAAC,MACrB;CACZ,OAAO,CAACA,yCAAiB,OAAO,OAAO;AACzC"}
|
|
@@ -1,30 +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_assertIsBoolean = require('./assertIsBoolean-D41HrTB_.cjs');
|
|
12
|
-
const require_isEmptyObject = require('./isEmptyObject-BsHngDz4.cjs');
|
|
13
|
-
const require_isEmptyString = require('./isEmptyString-C8PYNPgw.cjs');
|
|
14
|
-
const isEmptyValue = (value, options = {}) => {
|
|
15
|
-
require_assertIsBoolean.assertIsPlainObject(options, { message: ({ currentType, validType }) => `Second parameter (\`options\`) must be of type \`${validType}\`, but received: \`${currentType}\`.` });
|
|
16
|
-
const checkSymbols = require_assertIsBoolean.hasOwnProp(options, "checkSymbols") ? options.checkSymbols : false;
|
|
17
|
-
require_assertIsBoolean.assertIsBoolean(checkSymbols, { message: ({ currentType, validType }) => `Parameter \`checkSymbols\` property of the \`options\` (second parameter) must be of type \`${validType}\`, but received: \`${currentType}\`.` });
|
|
18
|
-
if (require_assertIsBoolean.isNil(value) || value === false || require_assertIsBoolean.isNaN(value)) return true;
|
|
19
|
-
if (require_assertIsBoolean.isString(value)) return require_isEmptyString.isEmptyString(value);
|
|
20
|
-
if (require_assertIsBoolean.isArray(value)) return require_isEmptyObject.isEmptyArray(value);
|
|
21
|
-
if (require_assertIsBoolean.isObject(value)) return require_isEmptyObject.isEmptyObject(value, { checkSymbols });
|
|
22
|
-
return false;
|
|
23
|
-
};
|
|
24
|
-
Object.defineProperty(exports, 'isEmptyValue', {
|
|
25
|
-
enumerable: true,
|
|
26
|
-
get: function () {
|
|
27
|
-
return isEmptyValue;
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
//# sourceMappingURL=isEmptyValue-BXf7f1jz.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"isEmptyValue-BXf7f1jz.cjs","names":["hasOwnProp","isNil","isNaN","isString","isEmptyString","isArray","isEmptyArray","isObject","isEmptyObject"],"sources":["../src/predicates/is/isEmptyValue.ts"],"sourcesContent":["import { isNaN } from \"./isNaN\";\nimport { isNil } from \"./isNil\";\nimport { isArray } from \"./isArray\";\nimport { isObject } from \"./isObject\";\nimport { isString } from \"./isString\";\nimport { isEmptyArray } from \"./isEmptyArray\";\nimport { hasOwnProp } from \"../has/hasOwnProp\";\nimport { isEmptyObject } from \"./isEmptyObject\";\nimport { isEmptyString } from \"./isEmptyString\";\n\nimport { assertIsBoolean } from \"@/assertions/booleans/assertIsBoolean\";\nimport { assertIsPlainObject } from \"@/assertions/objects/assertIsPlainObject\";\n\ntype IsEmptyValueOptions = {\n /** **Whether to check symbol properties when checking empty objects.**\n * - **DefaultValue:** `false`.\n *\n * @default false\n */\n checkSymbols?: boolean;\n};\n\n/** ----------------------------------------------------------\n * * ***Predicate: `isEmptyValue`.***\n * ----------------------------------------------------------\n * **Determines if a value is **`empty`**.**\n * - **Covering:**\n * - Empty objects: `{}`\n * - Empty arrays: `[]`\n * - Empty strings: `\"\"` or whitespace-only (trimmed)\n * - `null`, `undefined`, `false`, or `NaN`\n * - **Returns **`false`** for:**\n * - Non-empty objects/arrays\n * - Non-empty strings\n * - Numbers (except `NaN`)\n * - `Functions`, `true`, `symbols`, `etc`.\n * @param {*} value - The value to evaluate.\n * @param {IsEmptyValueOptions} [options] - Optional settings.\n * @returns {boolean} Return `true` if the value is considered empty, otherwise `false`.\n * @example\n * isEmptyValue({});\n * // ➔ true\n * isEmptyValue([]);\n * // ➔ true\n * isEmptyValue({ key: \"value\" });\n * // ➔ false\n * isEmptyValue({ [Symbol(\"foo\")]: 123 });\n * // ➔ true (default `checkSymbols` is `false`)\n * isEmptyValue({ [Symbol(\"foo\")]: 123 }, { checkSymbols: false });\n * // ➔ true (default `checkSymbols` is `false`)\n * isEmptyValue({ [Symbol(\"foo\")]: 123 }, { checkSymbols: true });\n * // ➔ false\n * isEmptyValue([1, 2, 3]);\n * // ➔ false\n * isEmptyValue(NaN);\n * // ➔ true\n * isEmptyValue(true);\n * // ➔ false\n * isEmptyValue(false);\n * // ➔ true\n * isEmptyValue(null);\n * // ➔ true\n * isEmptyValue(undefined);\n * // ➔ true\n * isEmptyValue(\"\");\n * // ➔ true\n * isEmptyValue(\" \");\n * // ➔ true\n * isEmptyValue(0);\n * // ➔ false\n * isEmptyValue(-1);\n * // ➔ false\n * isEmptyValue(2);\n * // ➔ false\n * isEmptyValue(() => {});\n * // ➔ false\n */\nexport const isEmptyValue = (\n value: unknown,\n options: IsEmptyValueOptions = {}\n): boolean => {\n assertIsPlainObject(options, {\n message: ({ currentType, validType }) =>\n `Second parameter (\\`options\\`) must be of type \\`${validType}\\`, but received: \\`${currentType}\\`.`\n });\n\n const checkSymbols = hasOwnProp(options, \"checkSymbols\")\n ? options.checkSymbols\n : false;\n\n assertIsBoolean(checkSymbols, {\n message: ({ currentType, validType }) =>\n `Parameter \\`checkSymbols\\` property of the \\`options\\` (second parameter) must be of type \\`${validType}\\`, but received: \\`${currentType}\\`.`\n });\n\n if (isNil(value) || value === false || isNaN(value)) return true;\n if (isString(value)) return isEmptyString(value);\n if (isArray(value)) return isEmptyArray(value);\n if (isObject(value)) {\n return isEmptyObject(value, { checkSymbols });\n }\n\n return false;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6EA,MAAa,gBACX,OACA,UAA+B,CAAC,MACpB;CACZ,4CAAoB,SAAS,EAC3B,UAAU,EAAE,aAAa,gBACvB,oDAAoD,UAAU,sBAAsB,YAAY,KACpG,CAAC;CAED,MAAM,eAAeA,mCAAW,SAAS,cAAc,IACnD,QAAQ,eACR;CAEJ,wCAAgB,cAAc,EAC5B,UAAU,EAAE,aAAa,gBACvB,+FAA+F,UAAU,sBAAsB,YAAY,KAC/I,CAAC;CAED,IAAIC,8BAAM,KAAK,KAAK,UAAU,SAASC,8BAAM,KAAK,GAAG,OAAO;CAC5D,IAAIC,iCAAS,KAAK,GAAG,OAAOC,oCAAc,KAAK;CAC/C,IAAIC,gCAAQ,KAAK,GAAG,OAAOC,mCAAa,KAAK;CAC7C,IAAIC,iCAAS,KAAK,GAChB,OAAOC,oCAAc,OAAO,EAAE,aAAa,CAAC;CAG9C,OAAO;AACT"}
|
|
@@ -1,24 +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 { D as isNaN, M as isArray, N as isNil, T as assertIsPlainObject, b as hasOwnProp, j as isObject, k as isString, t as assertIsBoolean } from "./assertIsBoolean-CWUs-I5l.js";
|
|
11
|
-
import { n as isEmptyArray, t as isEmptyObject } from "./isEmptyObject-DPGR9iPj.js";
|
|
12
|
-
import { t as isEmptyString } from "./isEmptyString-BYMz_wt9.js";
|
|
13
|
-
const isEmptyValue = (value, options = {}) => {
|
|
14
|
-
assertIsPlainObject(options, { message: ({ currentType, validType }) => `Second parameter (\`options\`) must be of type \`${validType}\`, but received: \`${currentType}\`.` });
|
|
15
|
-
const checkSymbols = hasOwnProp(options, "checkSymbols") ? options.checkSymbols : false;
|
|
16
|
-
assertIsBoolean(checkSymbols, { message: ({ currentType, validType }) => `Parameter \`checkSymbols\` property of the \`options\` (second parameter) must be of type \`${validType}\`, but received: \`${currentType}\`.` });
|
|
17
|
-
if (isNil(value) || value === false || isNaN(value)) return true;
|
|
18
|
-
if (isString(value)) return isEmptyString(value);
|
|
19
|
-
if (isArray(value)) return isEmptyArray(value);
|
|
20
|
-
if (isObject(value)) return isEmptyObject(value, { checkSymbols });
|
|
21
|
-
return false;
|
|
22
|
-
};
|
|
23
|
-
export { isEmptyValue as t };
|
|
24
|
-
//# sourceMappingURL=isEmptyValue-D4OHTB3u.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"isEmptyValue-D4OHTB3u.js","names":[],"sources":["../src/predicates/is/isEmptyValue.ts"],"sourcesContent":["import { isNaN } from \"./isNaN\";\nimport { isNil } from \"./isNil\";\nimport { isArray } from \"./isArray\";\nimport { isObject } from \"./isObject\";\nimport { isString } from \"./isString\";\nimport { isEmptyArray } from \"./isEmptyArray\";\nimport { hasOwnProp } from \"../has/hasOwnProp\";\nimport { isEmptyObject } from \"./isEmptyObject\";\nimport { isEmptyString } from \"./isEmptyString\";\n\nimport { assertIsBoolean } from \"@/assertions/booleans/assertIsBoolean\";\nimport { assertIsPlainObject } from \"@/assertions/objects/assertIsPlainObject\";\n\ntype IsEmptyValueOptions = {\n /** **Whether to check symbol properties when checking empty objects.**\n * - **DefaultValue:** `false`.\n *\n * @default false\n */\n checkSymbols?: boolean;\n};\n\n/** ----------------------------------------------------------\n * * ***Predicate: `isEmptyValue`.***\n * ----------------------------------------------------------\n * **Determines if a value is **`empty`**.**\n * - **Covering:**\n * - Empty objects: `{}`\n * - Empty arrays: `[]`\n * - Empty strings: `\"\"` or whitespace-only (trimmed)\n * - `null`, `undefined`, `false`, or `NaN`\n * - **Returns **`false`** for:**\n * - Non-empty objects/arrays\n * - Non-empty strings\n * - Numbers (except `NaN`)\n * - `Functions`, `true`, `symbols`, `etc`.\n * @param {*} value - The value to evaluate.\n * @param {IsEmptyValueOptions} [options] - Optional settings.\n * @returns {boolean} Return `true` if the value is considered empty, otherwise `false`.\n * @example\n * isEmptyValue({});\n * // ➔ true\n * isEmptyValue([]);\n * // ➔ true\n * isEmptyValue({ key: \"value\" });\n * // ➔ false\n * isEmptyValue({ [Symbol(\"foo\")]: 123 });\n * // ➔ true (default `checkSymbols` is `false`)\n * isEmptyValue({ [Symbol(\"foo\")]: 123 }, { checkSymbols: false });\n * // ➔ true (default `checkSymbols` is `false`)\n * isEmptyValue({ [Symbol(\"foo\")]: 123 }, { checkSymbols: true });\n * // ➔ false\n * isEmptyValue([1, 2, 3]);\n * // ➔ false\n * isEmptyValue(NaN);\n * // ➔ true\n * isEmptyValue(true);\n * // ➔ false\n * isEmptyValue(false);\n * // ➔ true\n * isEmptyValue(null);\n * // ➔ true\n * isEmptyValue(undefined);\n * // ➔ true\n * isEmptyValue(\"\");\n * // ➔ true\n * isEmptyValue(\" \");\n * // ➔ true\n * isEmptyValue(0);\n * // ➔ false\n * isEmptyValue(-1);\n * // ➔ false\n * isEmptyValue(2);\n * // ➔ false\n * isEmptyValue(() => {});\n * // ➔ false\n */\nexport const isEmptyValue = (\n value: unknown,\n options: IsEmptyValueOptions = {}\n): boolean => {\n assertIsPlainObject(options, {\n message: ({ currentType, validType }) =>\n `Second parameter (\\`options\\`) must be of type \\`${validType}\\`, but received: \\`${currentType}\\`.`\n });\n\n const checkSymbols = hasOwnProp(options, \"checkSymbols\")\n ? options.checkSymbols\n : false;\n\n assertIsBoolean(checkSymbols, {\n message: ({ currentType, validType }) =>\n `Parameter \\`checkSymbols\\` property of the \\`options\\` (second parameter) must be of type \\`${validType}\\`, but received: \\`${currentType}\\`.`\n });\n\n if (isNil(value) || value === false || isNaN(value)) return true;\n if (isString(value)) return isEmptyString(value);\n if (isArray(value)) return isEmptyArray(value);\n if (isObject(value)) {\n return isEmptyObject(value, { checkSymbols });\n }\n\n return false;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6EA,MAAa,gBACX,OACA,UAA+B,CAAC,MACpB;CACZ,oBAAoB,SAAS,EAC3B,UAAU,EAAE,aAAa,gBACvB,oDAAoD,UAAU,sBAAsB,YAAY,KACpG,CAAC;CAED,MAAM,eAAe,WAAW,SAAS,cAAc,IACnD,QAAQ,eACR;CAEJ,gBAAgB,cAAc,EAC5B,UAAU,EAAE,aAAa,gBACvB,+FAA+F,UAAU,sBAAsB,YAAY,KAC/I,CAAC;CAED,IAAI,MAAM,KAAK,KAAK,UAAU,SAAS,MAAM,KAAK,GAAG,OAAO;CAC5D,IAAI,SAAS,KAAK,GAAG,OAAO,cAAc,KAAK;CAC/C,IAAI,QAAQ,KAAK,GAAG,OAAO,aAAa,KAAK;CAC7C,IAAI,SAAS,KAAK,GAChB,OAAO,cAAc,OAAO,EAAE,aAAa,CAAC;CAG9C,OAAO;AACT"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"isEqual-DM4S_kWh.js","names":[],"sources":["../src/predicates/is/isRegExp.ts","../src/predicates/is/isArrayBuffer.ts","../src/predicates/is/_private/baseDeepEqual.ts","../src/predicates/is/isEqual.ts"],"sourcesContent":["/** ----------------------------------------------------------\n * * ***Type guard: `isRegExp`.***\n * ----------------------------------------------------------\n * **Checks if a value is a [`RegExp`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp) instance.**\n * @param {*} value - The value to check.\n * @returns {boolean} Return `true` if value is an instance of **`RegExp`**.\n * @example\n * isRegExp(/abc/); // ➔ true\n * isRegExp(new RegExp(\"abc\")); // ➔ true\n * isRegExp(\"abc\"); // ➔ false\n */\nexport const isRegExp = (value: unknown): value is RegExp => {\n return value instanceof RegExp;\n};\n","/** ----------------------------------------------------\n * * ***Type guard: `isArrayBuffer`.***\n * ----------------------------------------------------\n * **Checks if `value` is classified as an `ArrayBuffer` object.**\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is instance of ***[`ArrayBuffer`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer)***, else `false`.\n * @example\n * isArrayBuffer(new ArrayBuffer(2));\n * // ➔ true\n * isArrayBuffer(new Array(2));\n * // ➔ false\n */\nexport function isArrayBuffer(value: unknown): value is ArrayBuffer {\n return value instanceof ArrayBuffer;\n}\n","import type { CustomizerIsEqualWith } from \"./types.isEqualWith\";\n\nimport { isMap } from \"../isMap\";\nimport { isSet } from \"../isSet\";\nimport { isDate } from \"../isDate\";\nimport { isArray } from \"../isArray\";\nimport { isError } from \"../isError\";\nimport { isRegExp } from \"../isRegExp\";\nimport { isUndefined } from \"../isUndefined\";\nimport { isArrayBuffer } from \"../isArrayBuffer\";\nimport { isObjectOrArray } from \"../isObjectOrArray\";\n\n/** -------------------------------------------------------------------\n * * ***Base function (**Internal**) for deep equality comparison with optional customizer.***\n * -------------------------------------------------------------------\n * **Recursively checks whether `value` and `other` are deeply equal. Supports custom comparison\n * via `customizer`, and handles arrays, objects, maps, sets, dates, errors, regexps, typed arrays,\n * and nested structures.**\n * @param value\n * - The value to compare.\n * @param other\n * - The other value to compare against.\n * @param customizer\n * - Optional function to customize the comparison for each property/value.\n * @param seen\n * - WeakMap used internally to track circular references and prevent infinite recursion.\n * @returns\n * - `true` → `value` and `other` are deeply equal.\n * - `false` → `value` and `other` are not deeply equal.\n * @example\n * ```ts\n * const obj1 = { name: \"Alice\", scores: [1, 2, 3] };\n * const obj2 = { name: \"alice\", scores: [1, 2, 3] };\n * const customizer: CustomizerIsEqualWith = (v, o) => {\n * if (typeof v === \"string\" && typeof o === \"string\") {\n * return v.toLowerCase() === o.toLowerCase();\n * }\n * };\n *\n * baseDeepEqual(obj1, obj2, customizer);\n * // returns true\n * ```\n */\nexport function baseDeepEqual(\n value: unknown,\n other: unknown,\n customizer?: CustomizerIsEqualWith,\n seen: WeakMap<object, object> = new WeakMap()\n): boolean {\n // ✅ Strict equality (+0 === -0)\n if (value === other) return true;\n\n // ✅ NaN === NaN\n if (value !== value && other !== other) return true;\n\n // ❌ Primitives mismatch\n if (!isObjectOrArray(value) || !isObjectOrArray(other)) {\n return false;\n }\n\n // ✅ Prevent circular recursion\n if (seen.get(value) === other) return true;\n seen.set(value, other);\n\n // ✅ Customizer support\n const callCustomizer = (\n v: unknown,\n o: unknown,\n key: PropertyKey,\n valObj: unknown,\n othObj: unknown\n ) => {\n if (customizer) {\n const result = customizer(v, o, key, valObj, othObj, seen);\n if (!isUndefined(result)) return result;\n }\n return baseDeepEqual(v, o, customizer, seen);\n };\n\n // ✅ Handle special instances\n if (isDate(value) && isDate(other))\n return value.getTime() === other.getTime();\n\n if (isRegExp(value) && isRegExp(other))\n return value.source === other.source && value.flags === other.flags;\n\n if (isError(value) && isError(other))\n return value.name === other.name && value.message === other.message;\n\n if (ArrayBuffer.isView(value) && ArrayBuffer.isView(other)) {\n const v = new Uint8Array(value.buffer, value.byteOffset, value.byteLength);\n const o = new Uint8Array(other.buffer, other.byteOffset, other.byteLength);\n if (v.length !== o.length) return false;\n for (let i = 0; i < v.length; i++) if (v[i] !== o[i]) return false;\n return true;\n }\n\n if (isArrayBuffer(value) && isArrayBuffer(other)) {\n if (value.byteLength !== other.byteLength) return false;\n const v = new Uint8Array(value),\n o = new Uint8Array(other);\n for (let i = 0; i < v.length; i++) if (v[i] !== o[i]) return false;\n return true;\n }\n\n if (isMap(value) && isMap(other)) {\n if (value.size !== other.size) return false;\n for (const [k, v] of value) {\n if (!other.has(k)) return false;\n if (!baseDeepEqual(v, other.get(k), customizer, seen)) return false;\n }\n return true;\n }\n\n if (isSet(value) && isSet(other)) {\n if (value.size !== other.size) return false;\n for (const v of value) {\n let matched = false;\n for (const o of other) {\n if (baseDeepEqual(v, o, customizer, seen)) {\n matched = true;\n break;\n }\n }\n if (!matched) return false;\n }\n return true;\n }\n\n if (isArray(value) && isArray(other)) {\n if (value.length !== other.length) return false;\n for (let i = 0; i < value.length; i++) {\n if (!callCustomizer(value[i], other[i], i, value, other)) return false;\n }\n return true;\n }\n\n if (Object.getPrototypeOf(value) !== Object.getPrototypeOf(other)) {\n return false;\n }\n\n const vKeys = Reflect.ownKeys(value);\n const oKeys = Reflect.ownKeys(other);\n if (vKeys.length !== oKeys.length) return false;\n\n for (const key of vKeys) {\n const vVal = value[key];\n const oVal = other[key];\n if (!callCustomizer(vVal, oVal, key, value, other)) return false;\n }\n\n return true;\n}\n","import { baseDeepEqual } from \"@/predicates/is/_private/baseDeepEqual\";\n\n/** ----------------------------------------------------\n * * ***Predicate: `isEqual`.***\n * ----------------------------------------------------------\n * **Performs a deep comparison between two values to determine if they are equivalent.**\n * @description\n * Checks whether two values are **deeply equal**, not just reference-equal (`===`).\n * - **✅ This method compares:**\n * - Arrays and TypedArrays\n * - ArrayBuffers\n * - Plain objects (`Object`) ➔ own enumerable properties only\n * - Booleans, Numbers, Strings, Symbols\n * - Dates\n * - Errors\n * - Maps\n * - Sets\n * - Regular expressions\n * - ❌ `Functions` and `DOM nodes` are ***not supported***.\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @returns {boolean} Returns `true` if the values are equivalent, else `false`.\n * @example\n * const obj1 = { user: \"fred\" };\n * const obj2 = { user: \"fred\" };\n *\n * isEqual(obj1, obj2);\n * // ➔ true\n * obj1 === obj2;\n * // ➔ false (different references)\n * isEqual([1, 2, 3], [1, 2, 3]);\n * // ➔ true\n * isEqual(new Date(\"2020-01-01\"), new Date(\"2020-01-01\"));\n * // ➔ true\n * isEqual(new Set([1, 2]), new Set([2, 1]));\n * // ➔ true\n * isEqual(/abc/i, new RegExp(\"abc\", \"i\"));\n * // ➔ true\n * isEqual({ a: 1 }, { a: 1, b: undefined });\n * // ➔ false\n */\nexport function isEqual(value: unknown, other: unknown): boolean {\n return baseDeepEqual(value, other, undefined, new WeakMap());\n}\n"],"mappings":"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"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"isEqual-DaPDxMyw.cjs","names":["isObjectOrArray","isUndefined","isDate","isError","isMap","isSet","isArray"],"sources":["../src/predicates/is/isRegExp.ts","../src/predicates/is/isArrayBuffer.ts","../src/predicates/is/_private/baseDeepEqual.ts","../src/predicates/is/isEqual.ts"],"sourcesContent":["/** ----------------------------------------------------------\n * * ***Type guard: `isRegExp`.***\n * ----------------------------------------------------------\n * **Checks if a value is a [`RegExp`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp) instance.**\n * @param {*} value - The value to check.\n * @returns {boolean} Return `true` if value is an instance of **`RegExp`**.\n * @example\n * isRegExp(/abc/); // ➔ true\n * isRegExp(new RegExp(\"abc\")); // ➔ true\n * isRegExp(\"abc\"); // ➔ false\n */\nexport const isRegExp = (value: unknown): value is RegExp => {\n return value instanceof RegExp;\n};\n","/** ----------------------------------------------------\n * * ***Type guard: `isArrayBuffer`.***\n * ----------------------------------------------------\n * **Checks if `value` is classified as an `ArrayBuffer` object.**\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is instance of ***[`ArrayBuffer`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer)***, else `false`.\n * @example\n * isArrayBuffer(new ArrayBuffer(2));\n * // ➔ true\n * isArrayBuffer(new Array(2));\n * // ➔ false\n */\nexport function isArrayBuffer(value: unknown): value is ArrayBuffer {\n return value instanceof ArrayBuffer;\n}\n","import type { CustomizerIsEqualWith } from \"./types.isEqualWith\";\n\nimport { isMap } from \"../isMap\";\nimport { isSet } from \"../isSet\";\nimport { isDate } from \"../isDate\";\nimport { isArray } from \"../isArray\";\nimport { isError } from \"../isError\";\nimport { isRegExp } from \"../isRegExp\";\nimport { isUndefined } from \"../isUndefined\";\nimport { isArrayBuffer } from \"../isArrayBuffer\";\nimport { isObjectOrArray } from \"../isObjectOrArray\";\n\n/** -------------------------------------------------------------------\n * * ***Base function (**Internal**) for deep equality comparison with optional customizer.***\n * -------------------------------------------------------------------\n * **Recursively checks whether `value` and `other` are deeply equal. Supports custom comparison\n * via `customizer`, and handles arrays, objects, maps, sets, dates, errors, regexps, typed arrays,\n * and nested structures.**\n * @param value\n * - The value to compare.\n * @param other\n * - The other value to compare against.\n * @param customizer\n * - Optional function to customize the comparison for each property/value.\n * @param seen\n * - WeakMap used internally to track circular references and prevent infinite recursion.\n * @returns\n * - `true` → `value` and `other` are deeply equal.\n * - `false` → `value` and `other` are not deeply equal.\n * @example\n * ```ts\n * const obj1 = { name: \"Alice\", scores: [1, 2, 3] };\n * const obj2 = { name: \"alice\", scores: [1, 2, 3] };\n * const customizer: CustomizerIsEqualWith = (v, o) => {\n * if (typeof v === \"string\" && typeof o === \"string\") {\n * return v.toLowerCase() === o.toLowerCase();\n * }\n * };\n *\n * baseDeepEqual(obj1, obj2, customizer);\n * // returns true\n * ```\n */\nexport function baseDeepEqual(\n value: unknown,\n other: unknown,\n customizer?: CustomizerIsEqualWith,\n seen: WeakMap<object, object> = new WeakMap()\n): boolean {\n // ✅ Strict equality (+0 === -0)\n if (value === other) return true;\n\n // ✅ NaN === NaN\n if (value !== value && other !== other) return true;\n\n // ❌ Primitives mismatch\n if (!isObjectOrArray(value) || !isObjectOrArray(other)) {\n return false;\n }\n\n // ✅ Prevent circular recursion\n if (seen.get(value) === other) return true;\n seen.set(value, other);\n\n // ✅ Customizer support\n const callCustomizer = (\n v: unknown,\n o: unknown,\n key: PropertyKey,\n valObj: unknown,\n othObj: unknown\n ) => {\n if (customizer) {\n const result = customizer(v, o, key, valObj, othObj, seen);\n if (!isUndefined(result)) return result;\n }\n return baseDeepEqual(v, o, customizer, seen);\n };\n\n // ✅ Handle special instances\n if (isDate(value) && isDate(other))\n return value.getTime() === other.getTime();\n\n if (isRegExp(value) && isRegExp(other))\n return value.source === other.source && value.flags === other.flags;\n\n if (isError(value) && isError(other))\n return value.name === other.name && value.message === other.message;\n\n if (ArrayBuffer.isView(value) && ArrayBuffer.isView(other)) {\n const v = new Uint8Array(value.buffer, value.byteOffset, value.byteLength);\n const o = new Uint8Array(other.buffer, other.byteOffset, other.byteLength);\n if (v.length !== o.length) return false;\n for (let i = 0; i < v.length; i++) if (v[i] !== o[i]) return false;\n return true;\n }\n\n if (isArrayBuffer(value) && isArrayBuffer(other)) {\n if (value.byteLength !== other.byteLength) return false;\n const v = new Uint8Array(value),\n o = new Uint8Array(other);\n for (let i = 0; i < v.length; i++) if (v[i] !== o[i]) return false;\n return true;\n }\n\n if (isMap(value) && isMap(other)) {\n if (value.size !== other.size) return false;\n for (const [k, v] of value) {\n if (!other.has(k)) return false;\n if (!baseDeepEqual(v, other.get(k), customizer, seen)) return false;\n }\n return true;\n }\n\n if (isSet(value) && isSet(other)) {\n if (value.size !== other.size) return false;\n for (const v of value) {\n let matched = false;\n for (const o of other) {\n if (baseDeepEqual(v, o, customizer, seen)) {\n matched = true;\n break;\n }\n }\n if (!matched) return false;\n }\n return true;\n }\n\n if (isArray(value) && isArray(other)) {\n if (value.length !== other.length) return false;\n for (let i = 0; i < value.length; i++) {\n if (!callCustomizer(value[i], other[i], i, value, other)) return false;\n }\n return true;\n }\n\n if (Object.getPrototypeOf(value) !== Object.getPrototypeOf(other)) {\n return false;\n }\n\n const vKeys = Reflect.ownKeys(value);\n const oKeys = Reflect.ownKeys(other);\n if (vKeys.length !== oKeys.length) return false;\n\n for (const key of vKeys) {\n const vVal = value[key];\n const oVal = other[key];\n if (!callCustomizer(vVal, oVal, key, value, other)) return false;\n }\n\n return true;\n}\n","import { baseDeepEqual } from \"@/predicates/is/_private/baseDeepEqual\";\n\n/** ----------------------------------------------------\n * * ***Predicate: `isEqual`.***\n * ----------------------------------------------------------\n * **Performs a deep comparison between two values to determine if they are equivalent.**\n * @description\n * Checks whether two values are **deeply equal**, not just reference-equal (`===`).\n * - **✅ This method compares:**\n * - Arrays and TypedArrays\n * - ArrayBuffers\n * - Plain objects (`Object`) ➔ own enumerable properties only\n * - Booleans, Numbers, Strings, Symbols\n * - Dates\n * - Errors\n * - Maps\n * - Sets\n * - Regular expressions\n * - ❌ `Functions` and `DOM nodes` are ***not supported***.\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @returns {boolean} Returns `true` if the values are equivalent, else `false`.\n * @example\n * const obj1 = { user: \"fred\" };\n * const obj2 = { user: \"fred\" };\n *\n * isEqual(obj1, obj2);\n * // ➔ true\n * obj1 === obj2;\n * // ➔ false (different references)\n * isEqual([1, 2, 3], [1, 2, 3]);\n * // ➔ true\n * isEqual(new Date(\"2020-01-01\"), new Date(\"2020-01-01\"));\n * // ➔ true\n * isEqual(new Set([1, 2]), new Set([2, 1]));\n * // ➔ true\n * isEqual(/abc/i, new RegExp(\"abc\", \"i\"));\n * // ➔ true\n * isEqual({ a: 1 }, { a: 1, b: undefined });\n * // ➔ false\n */\nexport function isEqual(value: unknown, other: unknown): boolean {\n return baseDeepEqual(value, other, undefined, new WeakMap());\n}\n"],"mappings":"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"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"isFinite-BEJFOv6B.js","names":[],"sources":["../src/predicates/is/isFinite.ts"],"sourcesContent":["import { isNumber } from \"./isNumber\";\n\n/** ----------------------------------------------------------\n * * ***Type guard: `isFinite`.***\n * -----------------------------------------------------------\n * **Checks if a value is a finite primitive number.**\n * @description\n * This function verifies that `value` is a **primitive number** and is **finite**\n * (i.e., not `NaN`, `Infinity`, or `-Infinity`).\n * - **Behavior:**\n * - Behaves like\n * [`Number.isFinite()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isFinite).\n * - But also works as a **TypeScript type guard**.\n * @param {*} value - The value to check.\n * @returns {boolean} Returns `true` if `value` is a finite primitive number, else `false`.\n * @example\n * import * as RzlUtilsJs from \"@rzl-zone/utils-js/predicates\";\n *\n * // Strict finite number check (only primitive numbers)\n * RzlUtilsJs.isFinite(3);\n * // ➔ true\n * RzlUtilsJs.isFinite(Number.MIN_VALUE);\n * // ➔ true\n * RzlUtilsJs.isFinite(\"3\");\n * // ➔ false (string is not a number)\n * RzlUtilsJs.isFinite(NaN);\n * // ➔ false\n * RzlUtilsJs.isFinite(Infinity);\n * // ➔ false\n * RzlUtilsJs.isFinite(new Number(3));\n * // ➔ false (Number object is not primitive)\n *\n * // Comparison with global isFinite()\n * isFinite(\"3\");\n * // ➔ true (global coerces string to number)\n * isFinite(new Number(3));\n * // ➔ true (object coerced to primitive number)\n */\nexport function isFinite(value: unknown): value is number {\n return isNumber(value) && Number.isFinite(value);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsCA,SAAgB,SAAS,OAAiC;CACxD,OAAO,SAAS,KAAK,KAAK,OAAO,SAAS,KAAK;AACjD"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"isFinite-DeDaBDr2.cjs","names":["isNumber"],"sources":["../src/predicates/is/isFinite.ts"],"sourcesContent":["import { isNumber } from \"./isNumber\";\n\n/** ----------------------------------------------------------\n * * ***Type guard: `isFinite`.***\n * -----------------------------------------------------------\n * **Checks if a value is a finite primitive number.**\n * @description\n * This function verifies that `value` is a **primitive number** and is **finite**\n * (i.e., not `NaN`, `Infinity`, or `-Infinity`).\n * - **Behavior:**\n * - Behaves like\n * [`Number.isFinite()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isFinite).\n * - But also works as a **TypeScript type guard**.\n * @param {*} value - The value to check.\n * @returns {boolean} Returns `true` if `value` is a finite primitive number, else `false`.\n * @example\n * import * as RzlUtilsJs from \"@rzl-zone/utils-js/predicates\";\n *\n * // Strict finite number check (only primitive numbers)\n * RzlUtilsJs.isFinite(3);\n * // ➔ true\n * RzlUtilsJs.isFinite(Number.MIN_VALUE);\n * // ➔ true\n * RzlUtilsJs.isFinite(\"3\");\n * // ➔ false (string is not a number)\n * RzlUtilsJs.isFinite(NaN);\n * // ➔ false\n * RzlUtilsJs.isFinite(Infinity);\n * // ➔ false\n * RzlUtilsJs.isFinite(new Number(3));\n * // ➔ false (Number object is not primitive)\n *\n * // Comparison with global isFinite()\n * isFinite(\"3\");\n * // ➔ true (global coerces string to number)\n * isFinite(new Number(3));\n * // ➔ true (object coerced to primitive number)\n */\nexport function isFinite(value: unknown): value is number {\n return isNumber(value) && Number.isFinite(value);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsCA,SAAgB,SAAS,OAAiC;CACxD,OAAOA,iCAAS,KAAK,KAAK,OAAO,SAAS,KAAK;AACjD"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"isInteger-CQLThJOR.cjs","names":[],"sources":["../src/predicates/is/isInteger.ts"],"sourcesContent":["/** ---------------------------------------------------------\n * * ***Type guard: `isInteger`.***\n * ----------------------------------------------------------\n * **Checks if a value is an integer number.**\n * - **ℹ️ Note:**\n * - This method is based on\n * [`Number.isInteger`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isInteger).\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an integer, else `false`.\n * @example\n * isInteger(3);\n * // ➔ true\n * isInteger(Number.MIN_VALUE);\n * // ➔ false\n * isInteger(NaN);\n * // ➔ false\n * isInteger(Infinity);\n * // ➔ false\n * isInteger(-Infinity);\n * // ➔ false\n * isInteger('3');\n * // ➔ false\n */\nexport function isInteger(value: unknown): value is number {\n return typeof value === \"number\" && Number.isInteger(value);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuBA,SAAgB,UAAU,OAAiC;CACzD,OAAO,OAAO,UAAU,YAAY,OAAO,UAAU,KAAK;AAC5D"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"isInteger-DEDbBGez.js","names":[],"sources":["../src/predicates/is/isInteger.ts"],"sourcesContent":["/** ---------------------------------------------------------\n * * ***Type guard: `isInteger`.***\n * ----------------------------------------------------------\n * **Checks if a value is an integer number.**\n * - **ℹ️ Note:**\n * - This method is based on\n * [`Number.isInteger`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isInteger).\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an integer, else `false`.\n * @example\n * isInteger(3);\n * // ➔ true\n * isInteger(Number.MIN_VALUE);\n * // ➔ false\n * isInteger(NaN);\n * // ➔ false\n * isInteger(Infinity);\n * // ➔ false\n * isInteger(-Infinity);\n * // ➔ false\n * isInteger('3');\n * // ➔ false\n */\nexport function isInteger(value: unknown): value is number {\n return typeof value === \"number\" && Number.isInteger(value);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuBA,SAAgB,UAAU,OAAiC;CACzD,OAAO,OAAO,UAAU,YAAY,OAAO,UAAU,KAAK;AAC5D"}
|
|
@@ -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 };
|