@rzl-zone/utils-js 3.13.1 → 3.14.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -6
- package/dist/.references/index.d.cts +2 -1
- package/dist/.references/index.d.ts +2 -1
- package/dist/AbortError-DK6kpzbu.cjs +26 -0
- package/dist/AbortError-DK6kpzbu.cjs.map +1 -0
- package/dist/AbortError-DVT8lAKn.js +20 -0
- package/dist/AbortError-DVT8lAKn.js.map +1 -0
- package/dist/{assertIsArray-HgzPQIAM.js → assertIsArray-CG7L7vlt.js} +3 -3
- package/dist/assertIsArray-CG7L7vlt.js.map +1 -0
- package/dist/{assertIsArray-CeXL4xv5.cjs → assertIsArray-CtCRD-_G.cjs} +5 -5
- package/dist/assertIsArray-CtCRD-_G.cjs.map +1 -0
- package/dist/assertIsPlainObject-DPZLj-Ho.cjs +26 -0
- package/dist/assertIsPlainObject-DPZLj-Ho.cjs.map +1 -0
- package/dist/assertIsPlainObject-j9bDqNLo.js +20 -0
- package/dist/assertIsPlainObject-j9bDqNLo.js.map +1 -0
- package/dist/{assertIsString-CY_WkCLr.js → assertIsString-CHIwE12y.js} +4 -4
- package/dist/assertIsString-CHIwE12y.js.map +1 -0
- package/dist/{assertIsString-DUrVt82d.cjs → assertIsString-CjE9kbQ_.cjs} +6 -6
- package/dist/assertIsString-CjE9kbQ_.cjs.map +1 -0
- package/dist/assertions/index.cjs +14 -12
- package/dist/assertions/index.cjs.map +1 -1
- package/dist/assertions/index.d.cts +2 -2
- package/dist/assertions/index.d.ts +2 -2
- package/dist/assertions/index.js +10 -8
- package/dist/assertions/index.js.map +1 -1
- package/dist/conversions/index.cjs +6 -6
- package/dist/conversions/index.d.cts +2 -2
- package/dist/conversions/index.d.ts +2 -2
- package/dist/conversions/index.js +6 -6
- package/dist/conversions-BFz6MKaV.cjs +449 -0
- package/dist/conversions-BFz6MKaV.cjs.map +1 -0
- package/dist/{conversions-1s7xMBe_.js → conversions-Ben5p5Ts.js} +43 -40
- package/dist/conversions-Ben5p5Ts.js.map +1 -0
- package/dist/errors/index.cjs +13 -0
- package/dist/errors/index.d.cts +180 -0
- package/dist/errors/index.d.ts +180 -0
- package/dist/errors/index.js +11 -0
- package/dist/events/index.cjs +10 -9
- package/dist/events/index.cjs.map +1 -1
- package/dist/events/index.d.cts +185 -100
- package/dist/events/index.d.ts +185 -100
- package/dist/events/index.js +9 -8
- package/dist/events/index.js.map +1 -1
- package/dist/formatter-ekJQF_bA-BepnCBkQ.cjs +67 -0
- package/dist/formatter-ekJQF_bA-BepnCBkQ.cjs.map +1 -0
- package/dist/formatter-ekJQF_bA-xLD9mGk4.js +55 -0
- package/dist/formatter-ekJQF_bA-xLD9mGk4.js.map +1 -0
- package/dist/formatters/index.cjs +2 -2
- package/dist/formatters/index.d.cts +2 -2
- package/dist/formatters/index.d.ts +2 -2
- package/dist/formatters/index.js +2 -2
- package/dist/{formatters-C6cVZBbG.js → formatters-BAbGsnYA.js} +78 -71
- package/dist/formatters-BAbGsnYA.js.map +1 -0
- package/dist/formatters-zd0Gs4Cs.cjs +436 -0
- package/dist/formatters-zd0Gs4Cs.cjs.map +1 -0
- package/dist/generators/index.cjs +37 -31
- package/dist/generators/index.cjs.map +1 -1
- package/dist/generators/index.d.cts +2 -2
- package/dist/generators/index.d.ts +2 -2
- package/dist/generators/index.js +29 -23
- package/dist/generators/index.js.map +1 -1
- package/dist/hasOwnProp-CVIhlD1i.js +47 -0
- package/dist/hasOwnProp-CVIhlD1i.js.map +1 -0
- package/dist/hasOwnProp-D9Tpgokd.cjs +53 -0
- package/dist/hasOwnProp-D9Tpgokd.cjs.map +1 -0
- package/dist/{index-RNQBTK8A.d.cts → index-9JsU_wMu.d.ts} +1375 -937
- package/dist/{index-ORbo-7zA.d.cts → index-BP3sUrAx.d.ts} +242 -133
- package/dist/{index-BG8wdusZ.d.cts → index-BVovC-yK.d.cts} +229 -200
- package/dist/index-C1X6ha9s.d.cts +1041 -0
- package/dist/index-CcPQZ41G.d.cts +1103 -0
- package/dist/index-CjpbuJF4.d.ts +2424 -0
- package/dist/index-CssrQyHh.d.cts +2424 -0
- package/dist/index-DZHiYYR7.d.cts +2179 -0
- package/dist/index-DZHiYYR7.d.ts +2179 -0
- package/dist/index-DlyDmXUo.d.ts +1103 -0
- package/dist/index-Dm4a___O.d.ts +1041 -0
- package/dist/{index-CRz9rSZL.d.ts → index-Dwduk7ez.d.cts} +1375 -937
- package/dist/{index-DPJ-e2JZ.d.ts → index-I5V6RbZM.d.cts} +1592 -790
- package/dist/{index-B5EBAgmC.d.cts → index-hOqBIL7F.d.ts} +1592 -790
- package/dist/{index-B1VQ6USF.d.ts → index-jyuOZMX7.d.ts} +229 -200
- package/dist/{index-ORbo-7zA.d.ts → index-lI0b7iUz.d.cts} +242 -133
- package/dist/{isBigInt-y7s3rsKc.js → isBigInt-Cez32M69.js} +2 -2
- package/dist/isBigInt-Cez32M69.js.map +1 -0
- package/dist/{isBigInt-BVj0M5pq.cjs → isBigInt-YgpNKTbA.cjs} +2 -2
- package/dist/isBigInt-YgpNKTbA.cjs.map +1 -0
- package/dist/{isEmptyString-BYMz_wt9.js → isEmptyString-C9QLWjx2.js} +4 -4
- package/dist/isEmptyString-C9QLWjx2.js.map +1 -0
- package/dist/{isEmptyString-C8PYNPgw.cjs → isEmptyString-O4TFe1Ao.cjs} +5 -5
- package/dist/isEmptyString-O4TFe1Ao.cjs.map +1 -0
- package/dist/isEmptyValue-CFExALXZ.cjs +54 -0
- package/dist/isEmptyValue-CFExALXZ.cjs.map +1 -0
- package/dist/isEmptyValue-kCjnLjbN.js +36 -0
- package/dist/isEmptyValue-kCjnLjbN.js.map +1 -0
- package/dist/{isFinite-DeDaBDr2.cjs → isFinite-B_hHbDpa.cjs} +6 -6
- package/dist/isFinite-B_hHbDpa.cjs.map +1 -0
- package/dist/{isFinite-BEJFOv6B.js → isFinite-ZvNhyHlF.js} +5 -5
- package/dist/isFinite-ZvNhyHlF.js.map +1 -0
- package/dist/{isInteger-DEDbBGez.js → isInteger-aZgzTTZG.js} +4 -4
- package/dist/isInteger-aZgzTTZG.js.map +1 -0
- package/dist/{isInteger-CQLThJOR.cjs → isInteger-dnc6W63Z.cjs} +4 -4
- package/dist/isInteger-dnc6W63Z.cjs.map +1 -0
- package/dist/isNumber-BCWD4dW0.js +20 -0
- package/dist/isNumber-BCWD4dW0.js.map +1 -0
- package/dist/isNumber-BkzwAe50.cjs +26 -0
- package/dist/isNumber-BkzwAe50.cjs.map +1 -0
- package/dist/isPlainObject-CAe_ElKO.d.cts +331 -0
- package/dist/isPlainObject-CJvRG4Je.d.ts +331 -0
- package/dist/{isServer-q3o6cSwD.js → isServer-CQzrX5e0.js} +2 -2
- package/dist/isServer-CQzrX5e0.js.map +1 -0
- package/dist/{isServer-DmycqWsF.cjs → isServer-DhFaedeT.cjs} +2 -2
- package/dist/isServer-DhFaedeT.cjs.map +1 -0
- package/dist/{isEqual-DaPDxMyw.cjs → isTypedArray-DjADSu8q.cjs} +45 -13
- package/dist/isTypedArray-DjADSu8q.cjs.map +1 -0
- package/dist/{isEqual-DM4S_kWh.js → isTypedArray-DxsPKrLh.js} +29 -9
- package/dist/isTypedArray-DxsPKrLh.js.map +1 -0
- package/dist/{isValidDomain-B8Nukgw0.js → isValidDomain-CDtNOhMc.js} +13 -54
- package/dist/isValidDomain-CDtNOhMc.js.map +1 -0
- package/dist/{isValidDomain-ZbyeGOO9.cjs → isValidDomain-D_x7uNIu.cjs} +16 -69
- package/dist/isValidDomain-D_x7uNIu.cjs.map +1 -0
- package/dist/{assertIsBoolean-CWUs-I5l.js → logger-CLWnKRKE.js} +657 -587
- package/dist/logger-CLWnKRKE.js.map +1 -0
- package/dist/{assertIsBoolean-D41HrTB_.cjs → logger-CUacYy3D.cjs} +658 -612
- package/dist/logger-CUacYy3D.cjs.map +1 -0
- package/dist/{noop-BY43WaoU.cjs → noop-CjEbNsJL.cjs} +2 -2
- package/dist/noop-CjEbNsJL.cjs.map +1 -0
- package/dist/{noop-CjY8xVHv.js → noop-qxrcogt5.js} +2 -2
- package/dist/noop-qxrcogt5.js.map +1 -0
- package/dist/{normalizeSpaces-BhZp0U_6.cjs → normalizeSpaces-D0_Z4qnO.cjs} +6 -9
- package/dist/normalizeSpaces-D0_Z4qnO.cjs.map +1 -0
- package/dist/{normalizeSpaces-BoUDtq5P.js → normalizeSpaces-DAsxzBEQ.js} +4 -7
- package/dist/normalizeSpaces-DAsxzBEQ.js.map +1 -0
- package/dist/operations/index.cjs +152 -22
- package/dist/operations/index.cjs.map +1 -1
- package/dist/operations/index.d.cts +257 -35
- package/dist/operations/index.d.ts +257 -35
- package/dist/operations/index.js +142 -13
- package/dist/operations/index.js.map +1 -1
- package/dist/parsers/index.cjs +2 -2
- package/dist/parsers/index.d.cts +238 -180
- package/dist/parsers/index.d.ts +238 -180
- package/dist/parsers/index.js +2 -2
- package/dist/{parsers-B8KYXIjE.js → parsers-BBAE_xVM.js} +9 -8
- package/dist/parsers-BBAE_xVM.js.map +1 -0
- package/dist/{parsers-B_FPX35n.cjs → parsers-i8WEeMJl.cjs} +10 -9
- package/dist/parsers-i8WEeMJl.cjs.map +1 -0
- package/dist/{parsing-Bfaw85Hd.js → parsing-D9tbKQ0v.js} +3 -3
- package/dist/parsing-D9tbKQ0v.js.map +1 -0
- package/dist/{parsing-BCZGco7n.cjs → parsing-DGjB8cwr.cjs} +4 -4
- package/dist/parsing-DGjB8cwr.cjs.map +1 -0
- package/dist/predicates/index.cjs +43 -43
- package/dist/predicates/index.d.cts +3 -3
- package/dist/predicates/index.d.ts +3 -3
- package/dist/predicates/index.js +14 -14
- package/dist/{predicates-KlyOvBSC.js → predicates-C0dova7l.js} +45 -40
- package/dist/predicates-C0dova7l.js.map +1 -0
- package/dist/{predicates-8y28VrbT.cjs → predicates-Dd7To7B4.cjs} +89 -84
- package/dist/predicates-Dd7To7B4.cjs.map +1 -0
- package/dist/promises/index.cjs +27 -26
- package/dist/promises/index.cjs.map +1 -1
- package/dist/promises/index.d.cts +227 -75
- package/dist/promises/index.d.ts +227 -75
- package/dist/promises/index.js +27 -26
- package/dist/promises/index.js.map +1 -1
- package/dist/{punyCode-DnKi0qjS.cjs → punyCode-DHTLhGdD.cjs} +12 -12
- package/dist/punyCode-DHTLhGdD.cjs.map +1 -0
- package/dist/{punyCode-Dwto1RpA.js → punyCode-Deb1Mrkc.js} +12 -12
- package/dist/punyCode-Deb1Mrkc.js.map +1 -0
- package/dist/{removeSpaces--8NW-HSx.js → removeSpaces-BPnsdRN0.js} +4 -4
- package/dist/removeSpaces-BPnsdRN0.js.map +1 -0
- package/dist/{removeSpaces-CmrrkeXz.cjs → removeSpaces-CN3pxBz_.cjs} +7 -7
- package/dist/removeSpaces-CN3pxBz_.cjs.map +1 -0
- package/dist/rzl-utils.global.js +13 -13
- package/dist/safeJsonParse-D1FLVTEM.cjs +209 -0
- package/dist/safeJsonParse-D1FLVTEM.cjs.map +1 -0
- package/dist/{safeJsonParse-OnUwG2El.js → safeJsonParse-DEVKNDSn.js} +29 -28
- package/dist/safeJsonParse-DEVKNDSn.js.map +1 -0
- package/dist/safeStableStringify-C5HHKUdn.cjs +125 -0
- package/dist/safeStableStringify-C5HHKUdn.cjs.map +1 -0
- package/dist/{safeStableStringify-B2KTTS3r.js → safeStableStringify-DfwxmiWn.js} +20 -13
- package/dist/safeStableStringify-DfwxmiWn.js.map +1 -0
- package/dist/strings/index.cjs +26 -30
- package/dist/strings/index.cjs.map +1 -1
- package/dist/strings/index.d.cts +2 -2
- package/dist/strings/index.d.ts +2 -2
- package/dist/strings/index.js +13 -17
- package/dist/strings/index.js.map +1 -1
- package/dist/tailwind/index.cjs +3 -3
- package/dist/tailwind/index.d.cts +3 -3
- package/dist/tailwind/index.d.ts +3 -3
- package/dist/tailwind/index.js +3 -3
- package/dist/{tailwind-DUuboq52.cjs → tailwind-BG7B0cDs.cjs} +59 -53
- package/dist/tailwind-BG7B0cDs.cjs.map +1 -0
- package/dist/{tailwind-CUdmv-oO.js → tailwind-tJNnFPsF.js} +38 -32
- package/dist/tailwind-tJNnFPsF.js.map +1 -0
- package/dist/{toStringArrayUnRecursive-OOHGazks.js → toStringArrayUnRecursive-D0WbLIRz.js} +9 -9
- package/dist/toStringArrayUnRecursive-D0WbLIRz.js.map +1 -0
- package/dist/toStringArrayUnRecursive-QLoaNX_-.cjs +51 -0
- package/dist/toStringArrayUnRecursive-QLoaNX_-.cjs.map +1 -0
- package/dist/urls/index.cjs +3 -3
- package/dist/urls/index.d.cts +635 -443
- package/dist/urls/index.d.ts +635 -443
- package/dist/urls/index.js +3 -3
- package/dist/{urls-BXT4Krsq.js → urls-EoWslGgg.js} +50 -41
- package/dist/urls-EoWslGgg.js.map +1 -0
- package/dist/urls-NCzPepe2.cjs +308 -0
- package/dist/urls-NCzPepe2.cjs.map +1 -0
- package/package.json +6 -6
- package/dist/assertIsArray-CeXL4xv5.cjs.map +0 -1
- package/dist/assertIsArray-HgzPQIAM.js.map +0 -1
- package/dist/assertIsBoolean-CWUs-I5l.js.map +0 -1
- package/dist/assertIsBoolean-D41HrTB_.cjs.map +0 -1
- package/dist/assertIsString-CY_WkCLr.js.map +0 -1
- package/dist/assertIsString-DUrVt82d.cjs.map +0 -1
- package/dist/conversions-1s7xMBe_.js.map +0 -1
- package/dist/conversions-B3Rf8uId.cjs +0 -446
- package/dist/conversions-B3Rf8uId.cjs.map +0 -1
- package/dist/formatters-C6cVZBbG.js.map +0 -1
- package/dist/formatters-aEAAuzjx.cjs +0 -429
- package/dist/formatters-aEAAuzjx.cjs.map +0 -1
- package/dist/index-CPCt6_Wq.d.cts +0 -765
- package/dist/index-CPCt6_Wq.d.ts +0 -765
- package/dist/index-DBwNa1iO.d.ts +0 -947
- package/dist/index-DPTYOQkn.d.cts +0 -947
- package/dist/index-Dig1fIhZ.d.cts +0 -1716
- package/dist/index-Dig1fIhZ.d.ts +0 -1716
- package/dist/isBigInt-BVj0M5pq.cjs.map +0 -1
- package/dist/isBigInt-y7s3rsKc.js.map +0 -1
- package/dist/isEmptyObject-BsHngDz4.cjs +0 -37
- package/dist/isEmptyObject-BsHngDz4.cjs.map +0 -1
- package/dist/isEmptyObject-DPGR9iPj.js +0 -25
- package/dist/isEmptyObject-DPGR9iPj.js.map +0 -1
- package/dist/isEmptyString-BYMz_wt9.js.map +0 -1
- package/dist/isEmptyString-C8PYNPgw.cjs.map +0 -1
- package/dist/isEmptyValue-BXf7f1jz.cjs +0 -30
- package/dist/isEmptyValue-BXf7f1jz.cjs.map +0 -1
- package/dist/isEmptyValue-D4OHTB3u.js +0 -24
- package/dist/isEmptyValue-D4OHTB3u.js.map +0 -1
- package/dist/isEqual-DM4S_kWh.js.map +0 -1
- package/dist/isEqual-DaPDxMyw.cjs.map +0 -1
- package/dist/isFinite-BEJFOv6B.js.map +0 -1
- package/dist/isFinite-DeDaBDr2.cjs.map +0 -1
- package/dist/isInteger-CQLThJOR.cjs.map +0 -1
- package/dist/isInteger-DEDbBGez.js.map +0 -1
- package/dist/isPlainObject-BwTkj3G0.d.cts +0 -339
- package/dist/isPlainObject-BwTkj3G0.d.ts +0 -339
- package/dist/isServer-DmycqWsF.cjs.map +0 -1
- package/dist/isServer-q3o6cSwD.js.map +0 -1
- package/dist/isTypedArray-BQLbLXsU.cjs +0 -43
- package/dist/isTypedArray-BQLbLXsU.cjs.map +0 -1
- package/dist/isTypedArray-XiBnifLN.js +0 -31
- package/dist/isTypedArray-XiBnifLN.js.map +0 -1
- package/dist/isValidDomain-B8Nukgw0.js.map +0 -1
- package/dist/isValidDomain-ZbyeGOO9.cjs.map +0 -1
- package/dist/noop-BY43WaoU.cjs.map +0 -1
- package/dist/noop-CjY8xVHv.js.map +0 -1
- package/dist/normalizeSpaces-BhZp0U_6.cjs.map +0 -1
- package/dist/normalizeSpaces-BoUDtq5P.js.map +0 -1
- package/dist/parsers-B8KYXIjE.js.map +0 -1
- package/dist/parsers-B_FPX35n.cjs.map +0 -1
- package/dist/parsing-BCZGco7n.cjs.map +0 -1
- package/dist/parsing-Bfaw85Hd.js.map +0 -1
- package/dist/predicates-8y28VrbT.cjs.map +0 -1
- package/dist/predicates-KlyOvBSC.js.map +0 -1
- package/dist/punyCode-DnKi0qjS.cjs.map +0 -1
- package/dist/punyCode-Dwto1RpA.js.map +0 -1
- package/dist/removeSpaces--8NW-HSx.js.map +0 -1
- package/dist/removeSpaces-CmrrkeXz.cjs.map +0 -1
- package/dist/safeJsonParse-OnUwG2El.js.map +0 -1
- package/dist/safeJsonParse-sFqVXf-e.cjs +0 -208
- package/dist/safeJsonParse-sFqVXf-e.cjs.map +0 -1
- package/dist/safeStableStringify-B2KTTS3r.js.map +0 -1
- package/dist/safeStableStringify-Cmi6GyWj.cjs +0 -106
- package/dist/safeStableStringify-Cmi6GyWj.cjs.map +0 -1
- package/dist/tailwind-CUdmv-oO.js.map +0 -1
- package/dist/tailwind-DUuboq52.cjs.map +0 -1
- package/dist/toStringArrayUnRecursive-OOHGazks.js.map +0 -1
- package/dist/toStringArrayUnRecursive-pfk2oP8C.cjs +0 -51
- package/dist/toStringArrayUnRecursive-pfk2oP8C.cjs.map +0 -1
- package/dist/urls-BL9C_yU3.cjs +0 -299
- package/dist/urls-BL9C_yU3.cjs.map +0 -1
- package/dist/urls-BXT4Krsq.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isEmptyString-O4TFe1Ao.cjs","names":["isNonEmptyString"],"sources":["../src/predicates/is/isEmptyString.ts"],"sourcesContent":["import { isNonEmptyString } from \"./isNonEmptyString\";\n\ntype IsEmptyStringOptions = {\n /** ----------------------------------------------------------\n * * ***Whether to trim leading and trailing whitespace before checking.***\n * -----------------------------------------------------------\n *\n * @note\n * Non-boolean values fall back to the default behavior.\n *\n * ---\n * @default true\n */\n trim?: boolean;\n};\n\n/** ----------------------------------------------------------\n * * ***Predicate: `isEmptyString`.***\n * -----------------------------------------------------------\n * **Checks whether a given value is an **empty-string**.**\n *\n * ---\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 *\n * ---\n * @param {*} value - The value to check.\n * @param {IsEmptyStringOptions} [options]\n * Optional settings (non-plain object values are ignored and replaced with default options).\n * @param {IsEmptyStringOptions[\"trim\"]} [options.trim=true]\n * If `true`, trims the string before checking (non-boolean values fall back to the default behavior), defaults: `true`.\n *\n * ---\n * @returns {boolean} Returns `true` if the value is string not a string or value string is considered empty.\n *\n * ---\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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2DA,MAAa,iBACX,OACA,YACY;CACZ,OAAO,CAACA,gCAAiB,OAAO,OAAO;AACzC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* ========================================================================
|
|
3
|
+
* @rzl-zone/utils-js
|
|
4
|
+
* ------------------------------------------------------------------------
|
|
5
|
+
* Version: `3.14.0-beta.0`
|
|
6
|
+
* Author: `Rizalvin Dwiky <rizalvindwiky@gmail.com>`
|
|
7
|
+
* Repository: `https://github.com/rzl-zone/rzl-zone/tree/main/packages/utils-js`
|
|
8
|
+
* ========================================================================
|
|
9
|
+
*/
|
|
10
|
+
"use strict";
|
|
11
|
+
const require_logger = require('./logger-CUacYy3D.cjs');
|
|
12
|
+
const require_isEmptyString = require('./isEmptyString-O4TFe1Ao.cjs');
|
|
13
|
+
const isEmptyArray = (value) => {
|
|
14
|
+
if (!require_logger.isArray(value)) return true;
|
|
15
|
+
return value.length === 0;
|
|
16
|
+
};
|
|
17
|
+
const isEmptyObject = (value, options = {}) => {
|
|
18
|
+
if (!require_logger.isObject(value)) return true;
|
|
19
|
+
if (!require_logger.isPlainObject(options)) options = {};
|
|
20
|
+
const checkSymbols = options.checkSymbols ?? false;
|
|
21
|
+
require_logger.assertIsBoolean(checkSymbols, { message: ({ currentType, validType }) => require_logger.createMessage("isEmptyObject", `Parameter \`checkSymbols\` property of the \`options\` (second parameter) must be of type \`${validType}\`, but received: \`${currentType}\`.`) });
|
|
22
|
+
const hasNoKeys = Object.keys(value).length === 0;
|
|
23
|
+
if (checkSymbols) return hasNoKeys && Object.getOwnPropertySymbols(value).length === 0;
|
|
24
|
+
return hasNoKeys;
|
|
25
|
+
};
|
|
26
|
+
const isEmptyValue = (value, options = {}) => {
|
|
27
|
+
if (!require_logger.isPlainObject(options)) options = {};
|
|
28
|
+
const checkSymbols = options.checkSymbols ?? false;
|
|
29
|
+
require_logger.assertIsBoolean(checkSymbols, { message: ({ currentType, validType }) => require_logger.createMessage("isEmptyValue", `Parameter \`checkSymbols\` property of the \`options\` (second parameter) must be of type \`${validType}\`, but received: \`${currentType}\`.`) });
|
|
30
|
+
if (require_logger.isNil(value) || value === false || require_logger.isNaN(value)) return true;
|
|
31
|
+
if (require_logger.isString(value)) return require_isEmptyString.isEmptyString(value);
|
|
32
|
+
if (require_logger.isArray(value)) return isEmptyArray(value);
|
|
33
|
+
if (require_logger.isObject(value)) return isEmptyObject(value, { checkSymbols });
|
|
34
|
+
return false;
|
|
35
|
+
};
|
|
36
|
+
Object.defineProperty(exports, 'isEmptyArray', {
|
|
37
|
+
enumerable: true,
|
|
38
|
+
get: function () {
|
|
39
|
+
return isEmptyArray;
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
Object.defineProperty(exports, 'isEmptyObject', {
|
|
43
|
+
enumerable: true,
|
|
44
|
+
get: function () {
|
|
45
|
+
return isEmptyObject;
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
Object.defineProperty(exports, 'isEmptyValue', {
|
|
49
|
+
enumerable: true,
|
|
50
|
+
get: function () {
|
|
51
|
+
return isEmptyValue;
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
//# sourceMappingURL=isEmptyValue-CFExALXZ.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isEmptyValue-CFExALXZ.cjs","names":["isArray","isObject","isPlainObject","createMessage","isPlainObject","createMessage","isNil","isNaN","isString","isEmptyString","isArray","isObject"],"sources":["../src/predicates/is/isEmptyArray.ts","../src/predicates/is/isEmptyObject.ts","../src/predicates/is/isEmptyValue.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 *\n * ---\n * - **Behavior:**\n * - Non-array inputs are considered ***`empty`*** ***(defensive strategy)***.\n *\n * ---\n * @param {*} [value] - The value to check.\n *\n * ---\n * @returns {boolean} Returns `true` if it's ***not an array*** or ***an empty-array***.\n *\n * ---\n * @example\n * isEmptyArray([]);\n * // ➔ true\n * isEmptyArray([1, 2, 3]);\n * // ➔ false\n * isEmptyArray(\"not an array\");\n * // ➔ true\n * isEmptyArray(null);\n * // ➔ true\n * isEmptyArray(undefined);\n * // ➔ 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 { createMessage } from \"@/_private/logger\";\n\nimport { assertIsBoolean } from \"@/assertions/booleans/assertIsBoolean\";\n\nimport { isObject } from \"./isObject\";\nimport { isPlainObject } from \"./isPlainObject\";\n\ntype IsEmptyObjectOptions = {\n /** ----------------------------------------------------------\n * * ***Whether to check for symbol properties in addition to string keys, defaultValue: `false`.***\n * -----------------------------------------------------------\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 *\n * ---\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 *\n * ---\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 *\n * ---\n * @returns {boolean} Return `true` if the value is considered empty or not an object, false otherwise.\n *\n * ---\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 const isEmptyObject = (\n value: unknown,\n options: IsEmptyObjectOptions = {}\n): boolean => {\n if (!isObject(value)) return true;\n if (!isPlainObject(options)) options = {};\n\n const checkSymbols = options.checkSymbols ?? false;\n\n assertIsBoolean(checkSymbols, {\n message: ({ currentType, validType }) =>\n createMessage(\n \"isEmptyObject\",\n `Parameter \\`checkSymbols\\` property of the \\`options\\` (second parameter) must be of type \\`${validType}\\`, but received: \\`${currentType}\\`.`\n )\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","import { createMessage } from \"@/_private/logger\";\n\nimport { assertIsBoolean } from \"@/assertions/booleans/assertIsBoolean\";\n\nimport { isNaN } from \"./isNaN\";\nimport { isNil } from \"./isNil\";\nimport { isArray } from \"./isArray\";\nimport { isObject } from \"./isObject\";\nimport { isString } from \"./isString\";\nimport { isEmptyArray } from \"./isEmptyArray\";\nimport { isEmptyObject } from \"./isEmptyObject\";\nimport { isEmptyString } from \"./isEmptyString\";\nimport { isPlainObject } from \"./isPlainObject\";\n\ntype IsEmptyValueOptions = {\n /** ----------------------------------------------------------\n * * ***Whether to check symbol properties when checking empty objects.***\n * ----------------------------------------------------------\n *\n * @default false\n */\n checkSymbols?: boolean;\n};\n\n/** ----------------------------------------------------------\n * * ***Predicate: `isEmptyValue`.***\n * -----------------------------------------------------------\n * **Determines if a value is **`empty`**.**\n *\n * ---\n * - #### *Behavior:*\n * - #### Covering:\n * - Empty objects: `{}`.\n * - Empty arrays: `[]`.\n * - Empty strings: `\"\"` or whitespace-only (trimmed).\n * - `null`, `undefined`, `false`, or `NaN`.\n * ---\n * - #### Returns **`false`** for:\n * - Non-empty objects/arrays.\n * - Non-empty strings.\n * - Numbers (except `NaN`).\n * - `Functions`, `true`, `symbols`, `etc`.\n *\n * ---\n * @param {*} value - The value to evaluate.\n * @param {IsEmptyValueOptions} [options] - Optional settings.\n *\n * ---\n * @returns {boolean} Return `true` if the value is considered empty, otherwise `false`.\n *\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 if (!isPlainObject(options)) options = {};\n\n const checkSymbols = options.checkSymbols ?? false;\n\n assertIsBoolean(checkSymbols, {\n message: ({ currentType, validType }) =>\n createMessage(\n \"isEmptyValue\",\n `Parameter \\`checkSymbols\\` property of the \\`options\\` (second parameter) must be of type \\`${validType}\\`, but received: \\`${currentType}\\`.`\n )\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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkCA,MAAa,gBAAgB,UAA4B;CACvD,IAAI,CAACA,uBAAQ,KAAK,GAAG,OAAO;CAE5B,OAAO,MAAM,WAAW;AAC1B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACiBA,MAAa,iBACX,OACA,UAAgC,CAAC,MACrB;CACZ,IAAI,CAACC,wBAAS,KAAK,GAAG,OAAO;CAC7B,IAAI,CAACC,6BAAc,OAAO,GAAG,UAAU,CAAC;CAExC,MAAM,eAAe,QAAQ,gBAAgB;CAE7C,+BAAgB,cAAc,EAC5B,UAAU,EAAE,aAAa,gBACvBC,6BACE,iBACA,+FAA+F,UAAU,sBAAsB,YAAY,IAC7I,EACJ,CAAC;CAED,MAAM,YAAY,OAAO,KAAK,KAAK,EAAE,WAAW;CAChD,IAAI,cACF,OAAO,aAAa,OAAO,sBAAsB,KAAK,EAAE,WAAW;CAErE,OAAO;AACT;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACWA,MAAa,gBACX,OACA,UAA+B,CAAC,MACpB;CACZ,IAAI,CAACC,6BAAc,OAAO,GAAG,UAAU,CAAC;CAExC,MAAM,eAAe,QAAQ,gBAAgB;CAE7C,+BAAgB,cAAc,EAC5B,UAAU,EAAE,aAAa,gBACvBC,6BACE,gBACA,+FAA+F,UAAU,sBAAsB,YAAY,IAC7I,EACJ,CAAC;CAED,IAAIC,qBAAM,KAAK,KAAK,UAAU,SAASC,qBAAM,KAAK,GAAG,OAAO;CAC5D,IAAIC,wBAAS,KAAK,GAAG,OAAOC,oCAAc,KAAK;CAC/C,IAAIC,uBAAQ,KAAK,GAAG,OAAO,aAAa,KAAK;CAC7C,IAAIC,wBAAS,KAAK,GAChB,OAAO,cAAc,OAAO,EAAE,aAAa,CAAC;CAG9C,OAAO;AACT"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* ========================================================================
|
|
3
|
+
* @rzl-zone/utils-js
|
|
4
|
+
* ------------------------------------------------------------------------
|
|
5
|
+
* Version: `3.14.0-beta.0`
|
|
6
|
+
* Author: `Rizalvin Dwiky <rizalvindwiky@gmail.com>`
|
|
7
|
+
* Repository: `https://github.com/rzl-zone/rzl-zone/tree/main/packages/utils-js`
|
|
8
|
+
* ========================================================================
|
|
9
|
+
*/
|
|
10
|
+
import { D as isObject, E as isPlainObject, O as isArray, S as isNaN, T as isString, k as isNil, n as assertIsBoolean, t as createMessage } from "./logger-CLWnKRKE.js";
|
|
11
|
+
import { t as isEmptyString } from "./isEmptyString-C9QLWjx2.js";
|
|
12
|
+
const isEmptyArray = (value) => {
|
|
13
|
+
if (!isArray(value)) return true;
|
|
14
|
+
return value.length === 0;
|
|
15
|
+
};
|
|
16
|
+
const isEmptyObject = (value, options = {}) => {
|
|
17
|
+
if (!isObject(value)) return true;
|
|
18
|
+
if (!isPlainObject(options)) options = {};
|
|
19
|
+
const checkSymbols = options.checkSymbols ?? false;
|
|
20
|
+
assertIsBoolean(checkSymbols, { message: ({ currentType, validType }) => createMessage("isEmptyObject", `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
|
+
const isEmptyValue = (value, options = {}) => {
|
|
26
|
+
if (!isPlainObject(options)) options = {};
|
|
27
|
+
const checkSymbols = options.checkSymbols ?? false;
|
|
28
|
+
assertIsBoolean(checkSymbols, { message: ({ currentType, validType }) => createMessage("isEmptyValue", `Parameter \`checkSymbols\` property of the \`options\` (second parameter) must be of type \`${validType}\`, but received: \`${currentType}\`.`) });
|
|
29
|
+
if (isNil(value) || value === false || isNaN(value)) return true;
|
|
30
|
+
if (isString(value)) return isEmptyString(value);
|
|
31
|
+
if (isArray(value)) return isEmptyArray(value);
|
|
32
|
+
if (isObject(value)) return isEmptyObject(value, { checkSymbols });
|
|
33
|
+
return false;
|
|
34
|
+
};
|
|
35
|
+
export { isEmptyObject as n, isEmptyArray as r, isEmptyValue as t };
|
|
36
|
+
//# sourceMappingURL=isEmptyValue-kCjnLjbN.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isEmptyValue-kCjnLjbN.js","names":[],"sources":["../src/predicates/is/isEmptyArray.ts","../src/predicates/is/isEmptyObject.ts","../src/predicates/is/isEmptyValue.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 *\n * ---\n * - **Behavior:**\n * - Non-array inputs are considered ***`empty`*** ***(defensive strategy)***.\n *\n * ---\n * @param {*} [value] - The value to check.\n *\n * ---\n * @returns {boolean} Returns `true` if it's ***not an array*** or ***an empty-array***.\n *\n * ---\n * @example\n * isEmptyArray([]);\n * // ➔ true\n * isEmptyArray([1, 2, 3]);\n * // ➔ false\n * isEmptyArray(\"not an array\");\n * // ➔ true\n * isEmptyArray(null);\n * // ➔ true\n * isEmptyArray(undefined);\n * // ➔ 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 { createMessage } from \"@/_private/logger\";\n\nimport { assertIsBoolean } from \"@/assertions/booleans/assertIsBoolean\";\n\nimport { isObject } from \"./isObject\";\nimport { isPlainObject } from \"./isPlainObject\";\n\ntype IsEmptyObjectOptions = {\n /** ----------------------------------------------------------\n * * ***Whether to check for symbol properties in addition to string keys, defaultValue: `false`.***\n * -----------------------------------------------------------\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 *\n * ---\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 *\n * ---\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 *\n * ---\n * @returns {boolean} Return `true` if the value is considered empty or not an object, false otherwise.\n *\n * ---\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 const isEmptyObject = (\n value: unknown,\n options: IsEmptyObjectOptions = {}\n): boolean => {\n if (!isObject(value)) return true;\n if (!isPlainObject(options)) options = {};\n\n const checkSymbols = options.checkSymbols ?? false;\n\n assertIsBoolean(checkSymbols, {\n message: ({ currentType, validType }) =>\n createMessage(\n \"isEmptyObject\",\n `Parameter \\`checkSymbols\\` property of the \\`options\\` (second parameter) must be of type \\`${validType}\\`, but received: \\`${currentType}\\`.`\n )\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","import { createMessage } from \"@/_private/logger\";\n\nimport { assertIsBoolean } from \"@/assertions/booleans/assertIsBoolean\";\n\nimport { isNaN } from \"./isNaN\";\nimport { isNil } from \"./isNil\";\nimport { isArray } from \"./isArray\";\nimport { isObject } from \"./isObject\";\nimport { isString } from \"./isString\";\nimport { isEmptyArray } from \"./isEmptyArray\";\nimport { isEmptyObject } from \"./isEmptyObject\";\nimport { isEmptyString } from \"./isEmptyString\";\nimport { isPlainObject } from \"./isPlainObject\";\n\ntype IsEmptyValueOptions = {\n /** ----------------------------------------------------------\n * * ***Whether to check symbol properties when checking empty objects.***\n * ----------------------------------------------------------\n *\n * @default false\n */\n checkSymbols?: boolean;\n};\n\n/** ----------------------------------------------------------\n * * ***Predicate: `isEmptyValue`.***\n * -----------------------------------------------------------\n * **Determines if a value is **`empty`**.**\n *\n * ---\n * - #### *Behavior:*\n * - #### Covering:\n * - Empty objects: `{}`.\n * - Empty arrays: `[]`.\n * - Empty strings: `\"\"` or whitespace-only (trimmed).\n * - `null`, `undefined`, `false`, or `NaN`.\n * ---\n * - #### Returns **`false`** for:\n * - Non-empty objects/arrays.\n * - Non-empty strings.\n * - Numbers (except `NaN`).\n * - `Functions`, `true`, `symbols`, `etc`.\n *\n * ---\n * @param {*} value - The value to evaluate.\n * @param {IsEmptyValueOptions} [options] - Optional settings.\n *\n * ---\n * @returns {boolean} Return `true` if the value is considered empty, otherwise `false`.\n *\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 if (!isPlainObject(options)) options = {};\n\n const checkSymbols = options.checkSymbols ?? false;\n\n assertIsBoolean(checkSymbols, {\n message: ({ currentType, validType }) =>\n createMessage(\n \"isEmptyValue\",\n `Parameter \\`checkSymbols\\` property of the \\`options\\` (second parameter) must be of type \\`${validType}\\`, but received: \\`${currentType}\\`.`\n )\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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkCA,MAAa,gBAAgB,UAA4B;CACvD,IAAI,CAAC,QAAQ,KAAK,GAAG,OAAO;CAE5B,OAAO,MAAM,WAAW;AAC1B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACiBA,MAAa,iBACX,OACA,UAAgC,CAAC,MACrB;CACZ,IAAI,CAAC,SAAS,KAAK,GAAG,OAAO;CAC7B,IAAI,CAAC,cAAc,OAAO,GAAG,UAAU,CAAC;CAExC,MAAM,eAAe,QAAQ,gBAAgB;CAE7C,gBAAgB,cAAc,EAC5B,UAAU,EAAE,aAAa,gBACvB,cACE,iBACA,+FAA+F,UAAU,sBAAsB,YAAY,IAC7I,EACJ,CAAC;CAED,MAAM,YAAY,OAAO,KAAK,KAAK,EAAE,WAAW;CAChD,IAAI,cACF,OAAO,aAAa,OAAO,sBAAsB,KAAK,EAAE,WAAW;CAErE,OAAO;AACT;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACWA,MAAa,gBACX,OACA,UAA+B,CAAC,MACpB;CACZ,IAAI,CAAC,cAAc,OAAO,GAAG,UAAU,CAAC;CAExC,MAAM,eAAe,QAAQ,gBAAgB;CAE7C,gBAAgB,cAAc,EAC5B,UAAU,EAAE,aAAa,gBACvB,cACE,gBACA,+FAA+F,UAAU,sBAAsB,YAAY,IAC7I,EACJ,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"}
|
|
@@ -2,20 +2,20 @@
|
|
|
2
2
|
* ========================================================================
|
|
3
3
|
* @rzl-zone/utils-js
|
|
4
4
|
* ------------------------------------------------------------------------
|
|
5
|
-
* Version: `3.
|
|
5
|
+
* Version: `3.14.0-beta.0`
|
|
6
6
|
* Author: `Rizalvin Dwiky <rizalvindwiky@gmail.com>`
|
|
7
7
|
* Repository: `https://github.com/rzl-zone/rzl-zone/tree/main/packages/utils-js`
|
|
8
8
|
* ========================================================================
|
|
9
9
|
*/
|
|
10
10
|
"use strict";
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
return
|
|
14
|
-
}
|
|
11
|
+
const require_isNumber = require('./isNumber-BkzwAe50.cjs');
|
|
12
|
+
const isFinite = (value) => {
|
|
13
|
+
return require_isNumber.isNumber(value) && Number.isFinite(value);
|
|
14
|
+
};
|
|
15
15
|
Object.defineProperty(exports, 'isFinite', {
|
|
16
16
|
enumerable: true,
|
|
17
17
|
get: function () {
|
|
18
18
|
return isFinite;
|
|
19
19
|
}
|
|
20
20
|
});
|
|
21
|
-
//# sourceMappingURL=isFinite-
|
|
21
|
+
//# sourceMappingURL=isFinite-B_hHbDpa.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isFinite-B_hHbDpa.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 *\n * ---\n * @description\n * This function verifies that `value` is a **primitive number** and is **finite**\n * (i.e., not `NaN`, `Infinity`, or `-Infinity`).\n *\n * ---\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 *\n * ---\n * @param {*} value - The value to check.\n *\n * ---\n * @returns {boolean} Returns `true` if `value` is a finite primitive number, else `false`.\n *\n * ---\n * @example\n * 1. #### Strict finite number check (only primitive numbers):\n * ```ts\n * import * as RzlUtilsJs from \"@rzl-zone/utils-js/predicates\";\n *\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 * ---\n *\n * 2. #### Comparison with `global isFinite()`:\n * ```ts\n * isFinite(\"3\");\n * // ➔ true (global coerces string to number)\n * isFinite(new Number(3));\n * // ➔ true (object coerced to primitive number)\n * ```\n */\nexport const isFinite = (value: unknown): value is number => {\n return isNumber(value) && Number.isFinite(value);\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqDA,MAAa,YAAY,UAAoC;CAC3D,OAAOA,0BAAS,KAAK,KAAK,OAAO,SAAS,KAAK;AACjD"}
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
* ========================================================================
|
|
3
3
|
* @rzl-zone/utils-js
|
|
4
4
|
* ------------------------------------------------------------------------
|
|
5
|
-
* Version: `3.
|
|
5
|
+
* Version: `3.14.0-beta.0`
|
|
6
6
|
* Author: `Rizalvin Dwiky <rizalvindwiky@gmail.com>`
|
|
7
7
|
* Repository: `https://github.com/rzl-zone/rzl-zone/tree/main/packages/utils-js`
|
|
8
8
|
* ========================================================================
|
|
9
9
|
*/
|
|
10
|
-
import {
|
|
11
|
-
|
|
10
|
+
import { t as isNumber } from "./isNumber-BCWD4dW0.js";
|
|
11
|
+
const isFinite = (value) => {
|
|
12
12
|
return isNumber(value) && Number.isFinite(value);
|
|
13
|
-
}
|
|
13
|
+
};
|
|
14
14
|
export { isFinite as t };
|
|
15
|
-
//# sourceMappingURL=isFinite-
|
|
15
|
+
//# sourceMappingURL=isFinite-ZvNhyHlF.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isFinite-ZvNhyHlF.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 *\n * ---\n * @description\n * This function verifies that `value` is a **primitive number** and is **finite**\n * (i.e., not `NaN`, `Infinity`, or `-Infinity`).\n *\n * ---\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 *\n * ---\n * @param {*} value - The value to check.\n *\n * ---\n * @returns {boolean} Returns `true` if `value` is a finite primitive number, else `false`.\n *\n * ---\n * @example\n * 1. #### Strict finite number check (only primitive numbers):\n * ```ts\n * import * as RzlUtilsJs from \"@rzl-zone/utils-js/predicates\";\n *\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 * ---\n *\n * 2. #### Comparison with `global isFinite()`:\n * ```ts\n * isFinite(\"3\");\n * // ➔ true (global coerces string to number)\n * isFinite(new Number(3));\n * // ➔ true (object coerced to primitive number)\n * ```\n */\nexport const isFinite = (value: unknown): value is number => {\n return isNumber(value) && Number.isFinite(value);\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqDA,MAAa,YAAY,UAAoC;CAC3D,OAAO,SAAS,KAAK,KAAK,OAAO,SAAS,KAAK;AACjD"}
|
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
* ========================================================================
|
|
3
3
|
* @rzl-zone/utils-js
|
|
4
4
|
* ------------------------------------------------------------------------
|
|
5
|
-
* Version: `3.
|
|
5
|
+
* Version: `3.14.0-beta.0`
|
|
6
6
|
* Author: `Rizalvin Dwiky <rizalvindwiky@gmail.com>`
|
|
7
7
|
* Repository: `https://github.com/rzl-zone/rzl-zone/tree/main/packages/utils-js`
|
|
8
8
|
* ========================================================================
|
|
9
9
|
*/
|
|
10
|
-
|
|
10
|
+
const isInteger = (value) => {
|
|
11
11
|
return typeof value === "number" && Number.isInteger(value);
|
|
12
|
-
}
|
|
12
|
+
};
|
|
13
13
|
export { isInteger as t };
|
|
14
|
-
//# sourceMappingURL=isInteger-
|
|
14
|
+
//# sourceMappingURL=isInteger-aZgzTTZG.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isInteger-aZgzTTZG.js","names":[],"sources":["../src/predicates/is/isInteger.ts"],"sourcesContent":["/** ---------------------------------------------------------\n * * ***Type guard: `isInteger`.***\n * ----------------------------------------------------------\n * **Checks if a value is an integer number.**\n *\n * ---\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 *\n * ---\n * @param {*} value The value to check.\n *\n * ---\n * @returns {boolean} Returns `true` if `value` is an integer, else `false`.\n *\n * ---\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 const isInteger = (value: unknown): value is number => {\n return typeof value === \"number\" && Number.isInteger(value);\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BA,MAAa,aAAa,UAAoC;CAC5D,OAAO,OAAO,UAAU,YAAY,OAAO,UAAU,KAAK;AAC5D"}
|
|
@@ -2,19 +2,19 @@
|
|
|
2
2
|
* ========================================================================
|
|
3
3
|
* @rzl-zone/utils-js
|
|
4
4
|
* ------------------------------------------------------------------------
|
|
5
|
-
* Version: `3.
|
|
5
|
+
* Version: `3.14.0-beta.0`
|
|
6
6
|
* Author: `Rizalvin Dwiky <rizalvindwiky@gmail.com>`
|
|
7
7
|
* Repository: `https://github.com/rzl-zone/rzl-zone/tree/main/packages/utils-js`
|
|
8
8
|
* ========================================================================
|
|
9
9
|
*/
|
|
10
10
|
"use strict";
|
|
11
|
-
|
|
11
|
+
const isInteger = (value) => {
|
|
12
12
|
return typeof value === "number" && Number.isInteger(value);
|
|
13
|
-
}
|
|
13
|
+
};
|
|
14
14
|
Object.defineProperty(exports, 'isInteger', {
|
|
15
15
|
enumerable: true,
|
|
16
16
|
get: function () {
|
|
17
17
|
return isInteger;
|
|
18
18
|
}
|
|
19
19
|
});
|
|
20
|
-
//# sourceMappingURL=isInteger-
|
|
20
|
+
//# sourceMappingURL=isInteger-dnc6W63Z.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isInteger-dnc6W63Z.cjs","names":[],"sources":["../src/predicates/is/isInteger.ts"],"sourcesContent":["/** ---------------------------------------------------------\n * * ***Type guard: `isInteger`.***\n * ----------------------------------------------------------\n * **Checks if a value is an integer number.**\n *\n * ---\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 *\n * ---\n * @param {*} value The value to check.\n *\n * ---\n * @returns {boolean} Returns `true` if `value` is an integer, else `false`.\n *\n * ---\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 const isInteger = (value: unknown): value is number => {\n return typeof value === \"number\" && Number.isInteger(value);\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BA,MAAa,aAAa,UAAoC;CAC5D,OAAO,OAAO,UAAU,YAAY,OAAO,UAAU,KAAK;AAC5D"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* ========================================================================
|
|
3
|
+
* @rzl-zone/utils-js
|
|
4
|
+
* ------------------------------------------------------------------------
|
|
5
|
+
* Version: `3.14.0-beta.0`
|
|
6
|
+
* Author: `Rizalvin Dwiky <rizalvindwiky@gmail.com>`
|
|
7
|
+
* Repository: `https://github.com/rzl-zone/rzl-zone/tree/main/packages/utils-js`
|
|
8
|
+
* ========================================================================
|
|
9
|
+
*/
|
|
10
|
+
import { E as isPlainObject, j as isBoolean, n as assertIsBoolean, t as createMessage } from "./logger-CLWnKRKE.js";
|
|
11
|
+
const isNumber = (value, options = {}) => {
|
|
12
|
+
if (!isPlainObject(options)) options = {};
|
|
13
|
+
const includeNaN = isPlainObject(options) && isBoolean(options.includeNaN) ? options.includeNaN : false;
|
|
14
|
+
assertIsBoolean(includeNaN, { message: ({ currentType, validType }) => errorMsg(`Parameter \`includeNaN\` property of the \`options\` (second parameter) must be of type \`${validType}\`, but received: \`${currentType}\`.`) });
|
|
15
|
+
const aNumber = typeof value === "number";
|
|
16
|
+
return includeNaN ? aNumber : aNumber && !Number.isNaN(value);
|
|
17
|
+
};
|
|
18
|
+
const errorMsg = (msg) => createMessage("isNumber", msg);
|
|
19
|
+
export { isNumber as t };
|
|
20
|
+
//# sourceMappingURL=isNumber-BCWD4dW0.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isNumber-BCWD4dW0.js","names":[],"sources":["../src/predicates/is/isNumber.ts"],"sourcesContent":["// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport type { isFinite } from \"./isFinite\";\n\nimport { createMessage } from \"@/_private/logger\";\n\nimport { assertIsBoolean } from \"@/assertions/booleans/assertIsBoolean\";\n\nimport { isBoolean } from \"./isBoolean\";\nimport { isPlainObject } from \"./isPlainObject\";\n\nexport type IsNumberOptions = {\n /** ---------------------------------------------------------\n * * ***If set to `true`, `NaN` will be considered a valid number, defaultValue: `false`.***\n * ----------------------------------------------------------\n *\n * @default false\n */\n includeNaN?: boolean;\n};\n\n/** ---------------------------------------------------------\n * * ***Type guard: `isNumber`.***\n * ----------------------------------------------------------\n * **Checks if a value is of type **`number`**.**\n *\n * ---\n * - #### *Behavior:*\n * - Uses `typeof value === \"number\"`.\n * - By default, excludes **`NaN`**.\n * - If `options.includeNaN` is `true`, then **`NaN`** is also considered valid.\n * - Still considers `Infinity` and `-Infinity` as **numbers** (consistent with JavaScript).\n *\n * ---\n * - #### *Note:*\n * - To exclude `Infinity` and `-Infinity`, use **{@link isFinite | `isFinite`}** instead.\n *\n * ---\n * @param {*} value - The value to check.\n * @param {IsNumberOptions} [options] - Optional settings.\n * @param {boolean} [options.includeNaN=false] If `true`, `NaN` will be considered a valid number, defaults to `false`, which excludes `NaN`.\n *\n * ---\n * @returns {boolean} Returns `true` if the value is a number (and depending on `includeNaN`, `NaN` is included or excluded).\n *\n * ---\n * @example\n * isNumber(42);\n * // ➔ true\n * isNumber(Infinity);\n * // ➔ true\n * isNumber(-Infinity);\n * // ➔ true\n * isNumber(NaN);\n * // ➔ false (default)\n * isNumber(NaN, { includeNaN: true });\n * // ➔ true\n * isNumber(\"42\");\n * // ➔ false\n */\nexport const isNumber = (\n value: unknown,\n options: IsNumberOptions = {}\n): value is number => {\n if (!isPlainObject(options)) options = {};\n\n const includeNaN =\n isPlainObject(options) && isBoolean(options.includeNaN)\n ? options.includeNaN\n : false;\n\n assertIsBoolean(includeNaN, {\n message: ({ currentType, validType }) =>\n errorMsg(\n `Parameter \\`includeNaN\\` property of the \\`options\\` (second parameter) must be of type \\`${validType}\\`, but received: \\`${currentType}\\`.`\n )\n });\n\n const aNumber = typeof value === \"number\";\n return includeNaN ? aNumber : aNumber && !Number.isNaN(value);\n};\n\n/**\n * @internal ***`Not part of the public API.`***\n */\nconst errorMsg = (msg: string) => createMessage(\"isNumber\", msg);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2DA,MAAa,YACX,OACA,UAA2B,CAAC,MACR;CACpB,IAAI,CAAC,cAAc,OAAO,GAAG,UAAU,CAAC;CAExC,MAAM,aACJ,cAAc,OAAO,KAAK,UAAU,QAAQ,UAAU,IAClD,QAAQ,aACR;CAEN,gBAAgB,YAAY,EAC1B,UAAU,EAAE,aAAa,gBACvB,SACE,6FAA6F,UAAU,sBAAsB,YAAY,IAC3I,EACJ,CAAC;CAED,MAAM,UAAU,OAAO,UAAU;CACjC,OAAO,aAAa,UAAU,WAAW,CAAC,OAAO,MAAM,KAAK;AAC9D;;;;AAKA,MAAM,YAAY,QAAgB,cAAc,YAAY,GAAG"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* ========================================================================
|
|
3
|
+
* @rzl-zone/utils-js
|
|
4
|
+
* ------------------------------------------------------------------------
|
|
5
|
+
* Version: `3.14.0-beta.0`
|
|
6
|
+
* Author: `Rizalvin Dwiky <rizalvindwiky@gmail.com>`
|
|
7
|
+
* Repository: `https://github.com/rzl-zone/rzl-zone/tree/main/packages/utils-js`
|
|
8
|
+
* ========================================================================
|
|
9
|
+
*/
|
|
10
|
+
"use strict";
|
|
11
|
+
const require_logger = require('./logger-CUacYy3D.cjs');
|
|
12
|
+
const isNumber = (value, options = {}) => {
|
|
13
|
+
if (!require_logger.isPlainObject(options)) options = {};
|
|
14
|
+
const includeNaN = require_logger.isPlainObject(options) && require_logger.isBoolean(options.includeNaN) ? options.includeNaN : false;
|
|
15
|
+
require_logger.assertIsBoolean(includeNaN, { message: ({ currentType, validType }) => errorMsg(`Parameter \`includeNaN\` property of the \`options\` (second parameter) must be of type \`${validType}\`, but received: \`${currentType}\`.`) });
|
|
16
|
+
const aNumber = typeof value === "number";
|
|
17
|
+
return includeNaN ? aNumber : aNumber && !Number.isNaN(value);
|
|
18
|
+
};
|
|
19
|
+
const errorMsg = (msg) => require_logger.createMessage("isNumber", msg);
|
|
20
|
+
Object.defineProperty(exports, 'isNumber', {
|
|
21
|
+
enumerable: true,
|
|
22
|
+
get: function () {
|
|
23
|
+
return isNumber;
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
//# sourceMappingURL=isNumber-BkzwAe50.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isNumber-BkzwAe50.cjs","names":["isPlainObject","isBoolean","createMessage"],"sources":["../src/predicates/is/isNumber.ts"],"sourcesContent":["// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport type { isFinite } from \"./isFinite\";\n\nimport { createMessage } from \"@/_private/logger\";\n\nimport { assertIsBoolean } from \"@/assertions/booleans/assertIsBoolean\";\n\nimport { isBoolean } from \"./isBoolean\";\nimport { isPlainObject } from \"./isPlainObject\";\n\nexport type IsNumberOptions = {\n /** ---------------------------------------------------------\n * * ***If set to `true`, `NaN` will be considered a valid number, defaultValue: `false`.***\n * ----------------------------------------------------------\n *\n * @default false\n */\n includeNaN?: boolean;\n};\n\n/** ---------------------------------------------------------\n * * ***Type guard: `isNumber`.***\n * ----------------------------------------------------------\n * **Checks if a value is of type **`number`**.**\n *\n * ---\n * - #### *Behavior:*\n * - Uses `typeof value === \"number\"`.\n * - By default, excludes **`NaN`**.\n * - If `options.includeNaN` is `true`, then **`NaN`** is also considered valid.\n * - Still considers `Infinity` and `-Infinity` as **numbers** (consistent with JavaScript).\n *\n * ---\n * - #### *Note:*\n * - To exclude `Infinity` and `-Infinity`, use **{@link isFinite | `isFinite`}** instead.\n *\n * ---\n * @param {*} value - The value to check.\n * @param {IsNumberOptions} [options] - Optional settings.\n * @param {boolean} [options.includeNaN=false] If `true`, `NaN` will be considered a valid number, defaults to `false`, which excludes `NaN`.\n *\n * ---\n * @returns {boolean} Returns `true` if the value is a number (and depending on `includeNaN`, `NaN` is included or excluded).\n *\n * ---\n * @example\n * isNumber(42);\n * // ➔ true\n * isNumber(Infinity);\n * // ➔ true\n * isNumber(-Infinity);\n * // ➔ true\n * isNumber(NaN);\n * // ➔ false (default)\n * isNumber(NaN, { includeNaN: true });\n * // ➔ true\n * isNumber(\"42\");\n * // ➔ false\n */\nexport const isNumber = (\n value: unknown,\n options: IsNumberOptions = {}\n): value is number => {\n if (!isPlainObject(options)) options = {};\n\n const includeNaN =\n isPlainObject(options) && isBoolean(options.includeNaN)\n ? options.includeNaN\n : false;\n\n assertIsBoolean(includeNaN, {\n message: ({ currentType, validType }) =>\n errorMsg(\n `Parameter \\`includeNaN\\` property of the \\`options\\` (second parameter) must be of type \\`${validType}\\`, but received: \\`${currentType}\\`.`\n )\n });\n\n const aNumber = typeof value === \"number\";\n return includeNaN ? aNumber : aNumber && !Number.isNaN(value);\n};\n\n/**\n * @internal ***`Not part of the public API.`***\n */\nconst errorMsg = (msg: string) => createMessage(\"isNumber\", msg);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2DA,MAAa,YACX,OACA,UAA2B,CAAC,MACR;CACpB,IAAI,CAACA,6BAAc,OAAO,GAAG,UAAU,CAAC;CAExC,MAAM,aACJA,6BAAc,OAAO,KAAKC,yBAAU,QAAQ,UAAU,IAClD,QAAQ,aACR;CAEN,+BAAgB,YAAY,EAC1B,UAAU,EAAE,aAAa,gBACvB,SACE,6FAA6F,UAAU,sBAAsB,YAAY,IAC3I,EACJ,CAAC;CAED,MAAM,UAAU,OAAO,UAAU;CACjC,OAAO,aAAa,UAAU,WAAW,CAAC,OAAO,MAAM,KAAK;AAC9D;;;;AAKA,MAAM,YAAY,QAAgBC,6BAAc,YAAY,GAAG"}
|