@rzl-zone/utils-js 3.14.0-beta.0 → 3.14.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/dist/.references/index.d.cts +1 -1
- package/dist/.references/index.d.ts +1 -1
- package/dist/{AbortError-DVT8lAKn.js → AbortError-CgE6QNOR.js} +3 -3
- package/dist/{AbortError-DVT8lAKn.js.map → AbortError-CgE6QNOR.js.map} +1 -1
- package/dist/{AbortError-DK6kpzbu.cjs → AbortError-D54txsmn.cjs} +3 -3
- package/dist/{AbortError-DK6kpzbu.cjs.map → AbortError-D54txsmn.cjs.map} +1 -1
- package/dist/{assertIsArray-CG7L7vlt.js → assertIsArray-DmlqnTiq.js} +3 -3
- package/dist/{assertIsArray-CG7L7vlt.js.map → assertIsArray-DmlqnTiq.js.map} +1 -1
- package/dist/{assertIsArray-CtCRD-_G.cjs → assertIsArray-Xx-zlo6O.cjs} +3 -3
- package/dist/{assertIsArray-CtCRD-_G.cjs.map → assertIsArray-Xx-zlo6O.cjs.map} +1 -1
- package/dist/{assertIsPlainObject-j9bDqNLo.js → assertIsPlainObject-CIzDchLs.js} +3 -3
- package/dist/{assertIsPlainObject-j9bDqNLo.js.map → assertIsPlainObject-CIzDchLs.js.map} +1 -1
- package/dist/{assertIsPlainObject-DPZLj-Ho.cjs → assertIsPlainObject-DYoxHcW5.cjs} +3 -3
- package/dist/{assertIsPlainObject-DPZLj-Ho.cjs.map → assertIsPlainObject-DYoxHcW5.cjs.map} +1 -1
- package/dist/{assertIsString-CjE9kbQ_.cjs → assertIsString-CuPbh3FB.cjs} +3 -3
- package/dist/{assertIsString-CjE9kbQ_.cjs.map → assertIsString-CuPbh3FB.cjs.map} +1 -1
- package/dist/{assertIsString-CHIwE12y.js → assertIsString-sgY3ml5f.js} +3 -3
- package/dist/{assertIsString-CHIwE12y.js.map → assertIsString-sgY3ml5f.js.map} +1 -1
- package/dist/assertions/index.cjs +7 -7
- package/dist/assertions/index.d.cts +2 -2
- package/dist/assertions/index.d.ts +2 -2
- package/dist/assertions/index.js +7 -7
- 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-Ben5p5Ts.js → conversions-BkxqYXxy.js} +13 -13
- package/dist/{conversions-Ben5p5Ts.js.map → conversions-BkxqYXxy.js.map} +1 -1
- package/dist/{conversions-BFz6MKaV.cjs → conversions-UdMB90xR.cjs} +13 -13
- package/dist/{conversions-BFz6MKaV.cjs.map → conversions-UdMB90xR.cjs.map} +1 -1
- package/dist/errors/index.cjs +2 -2
- package/dist/errors/index.d.cts +1 -1
- package/dist/errors/index.d.ts +1 -1
- package/dist/errors/index.js +2 -2
- package/dist/events/index.cjs +5 -5
- package/dist/events/index.d.cts +1 -1
- package/dist/events/index.d.ts +1 -1
- package/dist/events/index.js +5 -5
- package/dist/{formatter-ekJQF_bA-xLD9mGk4.js → formatter-BFgV1HhV-BtIJs2H2.js} +3 -3
- package/dist/formatter-BFgV1HhV-BtIJs2H2.js.map +1 -0
- package/dist/{formatter-ekJQF_bA-BepnCBkQ.cjs → formatter-BFgV1HhV-DyybWSuj.cjs} +3 -3
- package/dist/formatter-BFgV1HhV-DyybWSuj.cjs.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-zd0Gs4Cs.cjs → formatters-Cjng28nY.cjs} +12 -12
- package/dist/{formatters-zd0Gs4Cs.cjs.map → formatters-Cjng28nY.cjs.map} +1 -1
- package/dist/{formatters-BAbGsnYA.js → formatters-Dqccnt-p.js} +12 -12
- package/dist/{formatters-BAbGsnYA.js.map → formatters-Dqccnt-p.js.map} +1 -1
- package/dist/generators/index.cjs +8 -8
- package/dist/generators/index.d.cts +2 -2
- package/dist/generators/index.d.ts +2 -2
- package/dist/generators/index.js +7 -7
- package/dist/{hasOwnProp-D9Tpgokd.cjs → hasOwnProp-DTWYqy7S.cjs} +5 -5
- package/dist/{hasOwnProp-D9Tpgokd.cjs.map → hasOwnProp-DTWYqy7S.cjs.map} +1 -1
- package/dist/{hasOwnProp-CVIhlD1i.js → hasOwnProp-yVVsxPin.js} +5 -5
- package/dist/{hasOwnProp-CVIhlD1i.js.map → hasOwnProp-yVVsxPin.js.map} +1 -1
- package/dist/{index-BVovC-yK.d.cts → index-9Ql1W3gt.d.cts} +3 -3
- package/dist/{index-9JsU_wMu.d.ts → index-BD0J8wkE.d.cts} +3 -3
- package/dist/{index-CjpbuJF4.d.ts → index-BcoUy2oV.d.ts} +2 -2
- package/dist/{index-hOqBIL7F.d.ts → index-Bpk3YwGW.d.ts} +3 -3
- package/dist/{index-Dm4a___O.d.ts → index-CTMG8cZV.d.ts} +2 -2
- package/dist/{index-C1X6ha9s.d.cts → index-DUBCXPy4.d.cts} +2 -2
- package/dist/{index-Dwduk7ez.d.cts → index-DhUTzQ_o.d.ts} +3 -3
- package/dist/{index-jyuOZMX7.d.ts → index-DqYMKSmd.d.ts} +3 -3
- package/dist/{index-DlyDmXUo.d.ts → index-JfwSupYB.d.ts} +2 -2
- package/dist/{index-BP3sUrAx.d.ts → index-O2q2f-pu.d.cts} +2 -2
- package/dist/{index-I5V6RbZM.d.cts → index-VgNZ6ndx.d.cts} +3 -3
- package/dist/{index-lI0b7iUz.d.cts → index-k_rjVRjU.d.ts} +2 -2
- package/dist/{index-DZHiYYR7.d.ts → index-or0oP9i2.d.cts} +2 -2
- package/dist/{index-DZHiYYR7.d.cts → index-or0oP9i2.d.ts} +2 -2
- package/dist/{index-CcPQZ41G.d.cts → index-u4-Euidh.d.cts} +2 -2
- package/dist/{index-CssrQyHh.d.cts → index-zAqCZxGr.d.cts} +2 -2
- package/dist/{isBigInt-Cez32M69.js → isBigInt-DdFRCpeE.js} +2 -2
- package/dist/{isBigInt-Cez32M69.js.map → isBigInt-DdFRCpeE.js.map} +1 -1
- package/dist/{isBigInt-YgpNKTbA.cjs → isBigInt-LkCpVJ3E.cjs} +2 -2
- package/dist/{isBigInt-YgpNKTbA.cjs.map → isBigInt-LkCpVJ3E.cjs.map} +1 -1
- package/dist/{isEmptyString-C9QLWjx2.js → isEmptyString-B6ubItgT.js} +3 -3
- package/dist/{isEmptyString-C9QLWjx2.js.map → isEmptyString-B6ubItgT.js.map} +1 -1
- package/dist/{isEmptyString-O4TFe1Ao.cjs → isEmptyString-Csc5Sf_W.cjs} +3 -3
- package/dist/{isEmptyString-O4TFe1Ao.cjs.map → isEmptyString-Csc5Sf_W.cjs.map} +1 -1
- package/dist/{isEmptyValue-kCjnLjbN.js → isEmptyValue-h97JT4pD.js} +4 -4
- package/dist/{isEmptyValue-kCjnLjbN.js.map → isEmptyValue-h97JT4pD.js.map} +1 -1
- package/dist/{isEmptyValue-CFExALXZ.cjs → isEmptyValue-qNOhUBFE.cjs} +4 -4
- package/dist/{isEmptyValue-CFExALXZ.cjs.map → isEmptyValue-qNOhUBFE.cjs.map} +1 -1
- package/dist/{isFinite-B_hHbDpa.cjs → isFinite-CKeuVXbD.cjs} +3 -3
- package/dist/{isFinite-B_hHbDpa.cjs.map → isFinite-CKeuVXbD.cjs.map} +1 -1
- package/dist/{isFinite-ZvNhyHlF.js → isFinite-CzYYv-mQ.js} +3 -3
- package/dist/{isFinite-ZvNhyHlF.js.map → isFinite-CzYYv-mQ.js.map} +1 -1
- package/dist/{isInteger-aZgzTTZG.js → isInteger-BtA3flbk.js} +2 -2
- package/dist/{isInteger-aZgzTTZG.js.map → isInteger-BtA3flbk.js.map} +1 -1
- package/dist/{isInteger-dnc6W63Z.cjs → isInteger-iTok9NaH.cjs} +2 -2
- package/dist/{isInteger-dnc6W63Z.cjs.map → isInteger-iTok9NaH.cjs.map} +1 -1
- package/dist/{isNumber-BCWD4dW0.js → isNumber-C1mOuBuA.js} +3 -3
- package/dist/{isNumber-BCWD4dW0.js.map → isNumber-C1mOuBuA.js.map} +1 -1
- package/dist/{isNumber-BkzwAe50.cjs → isNumber-CM1vdNcW.cjs} +3 -3
- package/dist/{isNumber-BkzwAe50.cjs.map → isNumber-CM1vdNcW.cjs.map} +1 -1
- package/dist/{isPlainObject-CJvRG4Je.d.ts → isPlainObject-DQoM4DGQ.d.ts} +2 -2
- package/dist/{isPlainObject-CAe_ElKO.d.cts → isPlainObject-Y__iykWN.d.cts} +2 -2
- package/dist/{isServer-DhFaedeT.cjs → isServer-CWlp2R2N.cjs} +2 -2
- package/dist/{isServer-DhFaedeT.cjs.map → isServer-CWlp2R2N.cjs.map} +1 -1
- package/dist/{isServer-CQzrX5e0.js → isServer-Drgyboev.js} +2 -2
- package/dist/{isServer-CQzrX5e0.js.map → isServer-Drgyboev.js.map} +1 -1
- package/dist/{isTypedArray-DxsPKrLh.js → isTypedArray-BY8CIj3k.js} +5 -5
- package/dist/{isTypedArray-DxsPKrLh.js.map → isTypedArray-BY8CIj3k.js.map} +1 -1
- package/dist/{isTypedArray-DjADSu8q.cjs → isTypedArray-DspIjxdk.cjs} +5 -5
- package/dist/{isTypedArray-DjADSu8q.cjs.map → isTypedArray-DspIjxdk.cjs.map} +1 -1
- package/dist/{isValidDomain-CDtNOhMc.js → isValidDomain-BPfJEkFk.js} +7 -7
- package/dist/{isValidDomain-CDtNOhMc.js.map → isValidDomain-BPfJEkFk.js.map} +1 -1
- package/dist/{isValidDomain-D_x7uNIu.cjs → isValidDomain-DUUCoKtD.cjs} +10 -10
- package/dist/{isValidDomain-D_x7uNIu.cjs.map → isValidDomain-DUUCoKtD.cjs.map} +1 -1
- package/dist/{logger-CUacYy3D.cjs → logger-BXg2xufj.cjs} +2 -2
- package/dist/{logger-CUacYy3D.cjs.map → logger-BXg2xufj.cjs.map} +1 -1
- package/dist/{logger-CLWnKRKE.js → logger-Wxl_Krg6.js} +2 -2
- package/dist/{logger-CLWnKRKE.js.map → logger-Wxl_Krg6.js.map} +1 -1
- package/dist/{noop-CjEbNsJL.cjs → noop-ByxeOveJ.cjs} +2 -2
- package/dist/{noop-CjEbNsJL.cjs.map → noop-ByxeOveJ.cjs.map} +1 -1
- package/dist/{noop-qxrcogt5.js → noop-D8aGbjbP.js} +2 -2
- package/dist/{noop-qxrcogt5.js.map → noop-D8aGbjbP.js.map} +1 -1
- package/dist/{normalizeSpaces-D0_Z4qnO.cjs → normalizeSpaces-CQ7tZLNG.cjs} +3 -3
- package/dist/{normalizeSpaces-D0_Z4qnO.cjs.map → normalizeSpaces-CQ7tZLNG.cjs.map} +1 -1
- package/dist/{normalizeSpaces-DAsxzBEQ.js → normalizeSpaces-DNUOxp_8.js} +3 -3
- package/dist/{normalizeSpaces-DAsxzBEQ.js.map → normalizeSpaces-DNUOxp_8.js.map} +1 -1
- package/dist/operations/index.cjs +8 -8
- package/dist/operations/index.d.cts +2 -2
- package/dist/operations/index.d.ts +2 -2
- package/dist/operations/index.js +8 -8
- package/dist/parsers/index.cjs +2 -2
- package/dist/parsers/index.d.cts +1 -1
- package/dist/parsers/index.d.ts +1 -1
- package/dist/parsers/index.js +2 -2
- package/dist/{parsers-i8WEeMJl.cjs → parsers-CJ5tHtqF.cjs} +4 -4
- package/dist/{parsers-i8WEeMJl.cjs.map → parsers-CJ5tHtqF.cjs.map} +1 -1
- package/dist/{parsers-BBAE_xVM.js → parsers-DMlqliPw.js} +4 -4
- package/dist/{parsers-BBAE_xVM.js.map → parsers-DMlqliPw.js.map} +1 -1
- package/dist/{parsing-DGjB8cwr.cjs → parsing-DB_S0WFz.cjs} +3 -3
- package/dist/{parsing-DGjB8cwr.cjs.map → parsing-DB_S0WFz.cjs.map} +1 -1
- package/dist/{parsing-D9tbKQ0v.js → parsing-DhIQhWpX.js} +3 -3
- package/dist/{parsing-D9tbKQ0v.js.map → parsing-DhIQhWpX.js.map} +1 -1
- package/dist/predicates/index.cjs +14 -14
- 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-C0dova7l.js → predicates-BzYMbNrZ.js} +11 -11
- package/dist/{predicates-C0dova7l.js.map → predicates-BzYMbNrZ.js.map} +1 -1
- package/dist/{predicates-Dd7To7B4.cjs → predicates-DDW3etqF.cjs} +11 -11
- package/dist/{predicates-Dd7To7B4.cjs.map → predicates-DDW3etqF.cjs.map} +1 -1
- package/dist/promises/index.cjs +5 -5
- package/dist/promises/index.d.cts +2 -2
- package/dist/promises/index.d.ts +2 -2
- package/dist/promises/index.js +5 -5
- package/dist/{punyCode-DHTLhGdD.cjs → punyCode-B_VPjG0d.cjs} +4 -4
- package/dist/{punyCode-DHTLhGdD.cjs.map → punyCode-B_VPjG0d.cjs.map} +1 -1
- package/dist/{punyCode-Deb1Mrkc.js → punyCode-DsuJbWCl.js} +4 -4
- package/dist/{punyCode-Deb1Mrkc.js.map → punyCode-DsuJbWCl.js.map} +1 -1
- package/dist/{removeSpaces-BPnsdRN0.js → removeSpaces-BF-T_1Yt.js} +3 -3
- package/dist/{removeSpaces-BPnsdRN0.js.map → removeSpaces-BF-T_1Yt.js.map} +1 -1
- package/dist/{removeSpaces-CN3pxBz_.cjs → removeSpaces-BJu-gKps.cjs} +3 -3
- package/dist/{removeSpaces-CN3pxBz_.cjs.map → removeSpaces-BJu-gKps.cjs.map} +1 -1
- package/dist/rzl-utils.global.js +1 -1
- package/dist/{safeJsonParse-D1FLVTEM.cjs → safeJsonParse-B5F8XtrZ.cjs} +7 -7
- package/dist/{safeJsonParse-D1FLVTEM.cjs.map → safeJsonParse-B5F8XtrZ.cjs.map} +1 -1
- package/dist/{safeJsonParse-DEVKNDSn.js → safeJsonParse-DYSkUnhM.js} +7 -7
- package/dist/{safeJsonParse-DEVKNDSn.js.map → safeJsonParse-DYSkUnhM.js.map} +1 -1
- package/dist/{safeStableStringify-DfwxmiWn.js → safeStableStringify-CDSYnLUz.js} +5 -5
- package/dist/{safeStableStringify-DfwxmiWn.js.map → safeStableStringify-CDSYnLUz.js.map} +1 -1
- package/dist/{safeStableStringify-C5HHKUdn.cjs → safeStableStringify-MuBiT-4B.cjs} +5 -5
- package/dist/{safeStableStringify-C5HHKUdn.cjs.map → safeStableStringify-MuBiT-4B.cjs.map} +1 -1
- package/dist/strings/index.cjs +6 -6
- package/dist/strings/index.d.cts +2 -2
- package/dist/strings/index.d.ts +2 -2
- package/dist/strings/index.js +6 -6
- package/dist/tailwind/index.cjs +2 -2
- package/dist/tailwind/index.d.cts +2 -2
- package/dist/tailwind/index.d.ts +2 -2
- package/dist/tailwind/index.js +2 -2
- package/dist/{tailwind-tJNnFPsF.js → tailwind-BhHULklj.js} +6 -6
- package/dist/{tailwind-tJNnFPsF.js.map → tailwind-BhHULklj.js.map} +1 -1
- package/dist/{tailwind-BG7B0cDs.cjs → tailwind-hx6TIFIL.cjs} +6 -6
- package/dist/{tailwind-BG7B0cDs.cjs.map → tailwind-hx6TIFIL.cjs.map} +1 -1
- package/dist/{toStringArrayUnRecursive-D0WbLIRz.js → toStringArrayUnRecursive-U-nkEIDs.js} +6 -6
- package/dist/{toStringArrayUnRecursive-D0WbLIRz.js.map → toStringArrayUnRecursive-U-nkEIDs.js.map} +1 -1
- package/dist/{toStringArrayUnRecursive-QLoaNX_-.cjs → toStringArrayUnRecursive-_lJEmBlf.cjs} +6 -6
- package/dist/{toStringArrayUnRecursive-QLoaNX_-.cjs.map → toStringArrayUnRecursive-_lJEmBlf.cjs.map} +1 -1
- package/dist/urls/index.cjs +3 -3
- package/dist/urls/index.d.cts +1 -1
- package/dist/urls/index.d.ts +1 -1
- package/dist/urls/index.js +3 -3
- package/dist/{urls-EoWslGgg.js → urls-BcGIFgfR.js} +14 -14
- package/dist/{urls-EoWslGgg.js.map → urls-BcGIFgfR.js.map} +1 -1
- package/dist/{urls-NCzPepe2.cjs → urls-DGvZsMSN.cjs} +15 -15
- package/dist/{urls-NCzPepe2.cjs.map → urls-DGvZsMSN.cjs.map} +1 -1
- package/package.json +4 -4
- package/dist/formatter-ekJQF_bA-BepnCBkQ.cjs.map +0 -1
- package/dist/formatter-ekJQF_bA-xLD9mGk4.js.map +0 -1
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
* ========================================================================
|
|
3
3
|
* @rzl-zone/utils-js
|
|
4
4
|
* ------------------------------------------------------------------------
|
|
5
|
-
* Version: `3.14.0
|
|
5
|
+
* Version: `3.14.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
|
|
|
11
|
-
import { a as randomInt, i as randomIntByLength, n as randomUUID, o as getRandomItem, r as randomStr, t as noop } from "../index-
|
|
11
|
+
import { a as randomInt, i as randomIntByLength, n as randomUUID, o as getRandomItem, r as randomStr, t as noop } from "../index-k_rjVRjU.js";
|
|
12
12
|
export { getRandomItem, noop, randomInt, randomIntByLength, randomStr, randomUUID };
|
package/dist/generators/index.js
CHANGED
|
@@ -2,17 +2,17 @@
|
|
|
2
2
|
* ========================================================================
|
|
3
3
|
* @rzl-zone/utils-js
|
|
4
4
|
* ------------------------------------------------------------------------
|
|
5
|
-
* Version: `3.14.0
|
|
5
|
+
* Version: `3.14.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 { E as isPlainObject, S as isNaN, i as getPreciseType, j as isBoolean, m as isNonEmptyArray, n as assertIsBoolean, t as createMessage, w as isNonEmptyString } from "../logger-
|
|
11
|
-
import { t as isNumber } from "../isNumber-
|
|
12
|
-
import { t as safeStableStringify } from "../safeStableStringify-
|
|
13
|
-
import { t as noop } from "../noop-
|
|
14
|
-
import { t as isInteger } from "../isInteger-
|
|
15
|
-
import { n as joinLines } from "../formatter-
|
|
10
|
+
import { E as isPlainObject, S as isNaN, i as getPreciseType, j as isBoolean, m as isNonEmptyArray, n as assertIsBoolean, t as createMessage, w as isNonEmptyString } from "../logger-Wxl_Krg6.js";
|
|
11
|
+
import { t as isNumber } from "../isNumber-C1mOuBuA.js";
|
|
12
|
+
import { t as safeStableStringify } from "../safeStableStringify-CDSYnLUz.js";
|
|
13
|
+
import { t as noop } from "../noop-D8aGbjbP.js";
|
|
14
|
+
import { t as isInteger } from "../isInteger-BtA3flbk.js";
|
|
15
|
+
import { n as joinLines } from "../formatter-BFgV1HhV-BtIJs2H2.js";
|
|
16
16
|
function getRandomItem(array) {
|
|
17
17
|
if (!isNonEmptyArray(array)) return void 0;
|
|
18
18
|
return array[Math.floor(Math.random() * (array.length || 0))];
|
|
@@ -2,15 +2,15 @@
|
|
|
2
2
|
* ========================================================================
|
|
3
3
|
* @rzl-zone/utils-js
|
|
4
4
|
* ------------------------------------------------------------------------
|
|
5
|
-
* Version: `3.14.0
|
|
5
|
+
* Version: `3.14.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 require_logger = require('./logger-
|
|
12
|
-
const require_isNumber = require('./isNumber-
|
|
13
|
-
const require_safeStableStringify = require('./safeStableStringify-
|
|
11
|
+
const require_logger = require('./logger-BXg2xufj.cjs');
|
|
12
|
+
const require_isNumber = require('./isNumber-CM1vdNcW.cjs');
|
|
13
|
+
const require_safeStableStringify = require('./safeStableStringify-MuBiT-4B.cjs');
|
|
14
14
|
function hasOwnProp(obj, key, options = {}) {
|
|
15
15
|
if (!require_logger.isString(obj) && !require_logger.isObjectOrArray(obj) && !require_logger.isFunction(obj)) return false;
|
|
16
16
|
if (!require_logger.isPlainObject(options)) options = {};
|
|
@@ -50,4 +50,4 @@ Object.defineProperty(exports, 'hasOwnProp', {
|
|
|
50
50
|
return hasOwnProp;
|
|
51
51
|
}
|
|
52
52
|
});
|
|
53
|
-
//# sourceMappingURL=hasOwnProp-
|
|
53
|
+
//# sourceMappingURL=hasOwnProp-DTWYqy7S.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hasOwnProp-D9Tpgokd.cjs","names":["isString","isObjectOrArray","isFunction","isPlainObject","isNumber","isNaN","isSymbol","isNull","isUndefined","createMessage"],"sources":["../src/predicates/has/hasOwnProp.ts"],"sourcesContent":["import type {\n AnyFunction,\n AnyString,\n IsAny,\n IsStringLiteral\n} from \"@rzl-zone/ts-types-plus\";\nimport type {\n DeepRequiredSymbolHasOwnProp,\n GuardedHasOwnProp,\n HasOwnPropOptions,\n NestedKeyOfHasOwnProp,\n SmartDetectArrayFuncHasOwnProp,\n SmartDetectUnknownKeyHasOwnProp,\n NumericKeyHasOwnPropMapped,\n NumericKeyOfHasOwnProp,\n SmartDetectStringHasOwnProp\n} from \"./hasOwnProp.types\";\n\nimport { createMessage } from \"@/_private/logger\";\n\nimport { assertIsBoolean } from \"@/assertions/booleans/assertIsBoolean\";\n\nimport { isNaN } from \"../is/isNaN\";\nimport { isNull } from \"../is/isNull\";\nimport { isString } from \"../is/isString\";\nimport { isNumber } from \"../is/isNumber\";\nimport { isSymbol } from \"../is/isSymbol\";\nimport { isFunction } from \"../is/isFunction\";\nimport { isUndefined } from \"../is/isUndefined\";\nimport { isObjectOrArray } from \"../is/isObjectOrArray\";\nimport { isPlainObject, type IsPlainObjectResult } from \"../is/isPlainObject\";\n\n// ------------------- HAS OWN PROP OVERLOADS -------------------\n\n/** -------------------------------------------------------\n * * ***Type guard: `hasOwnProp`.***\n * --------------------------------------------------------\n * **A **type-safe** replacement for `Object.prototype.hasOwnProperty` with runtime validation and **TypeScript-aware type narrowing**.**\n *\n * ---\n * - #### *Supported Targets:*\n * - **Plain objects** ➔ `{ foo: \"bar\" }`.\n * - **Arrays** ➔ `[ { id: 1 }, { id: 2 } ]`.\n * - **Strings** ➔ `\"hello\"` (as array-like objects with `.length`, index, etc.).\n * - **Functions** ➔ callable objects with extra props.\n * - **Symbols** ➔ own property symbols.\n * ---\n * - #### *Key Advantages over `in` or `obj.hasOwnProperty(key)`:*\n * - Supports **dot/bracket path notation** (e.g. `\"user.address.city\"`, `\"addresses[0].zip\"`).\n * - Handles **symbol** keys safely.\n * - **Narrows** the type of `obj` in TypeScript (stronger type safety).\n * - Configurable handling of **`undefined`** and **`null`**.\n * ---\n * - #### *Runtime Behavior:*\n * - #### Returns `true` if:\n * - Value `obj` is an object/array/string/function **and** the property\n * exists **and**, it passes the `options` checks.\n * ---\n * - #### Returns `false` if:\n * - Value `obj` is not a valid type.\n * - The property does not exist.\n * - The value is `undefined` and `discardUndefined: true` (**default**).\n * - The value is `null` and `discardNull: true`.\n * - The `key` (after trimming) is an **empty string** ➔ treated as **invalid**.\n * ---\n * - #### *TypeScript Behavior:*\n * - #### Inside an `if (hasOwnProp(...)) {}` block:\n * - The property is **guaranteed to exist**.\n * - Depending on `options`, the property type is narrowed to exclude\n * `undefined` and/or `null`.\n * ---\n * - #### *Caveats:*\n * - #### Empty keys are invalid:\n * - If the `key` string is empty (`\"\"`) after trimming whitespace or other characters,\n * it will **not** be considered a valid property and always returns `false`.\n * ---\n * - #### Arrays are limited by TypeScript inference:\n * - Checking index `[0]` only narrows **that specific index**, not the rest, example:\n * 1. `hasOwnProp(users, \"[0].id\")` does **not** imply `users[1].id` exists.\n * - For different indices, use **optional chaining** (`users[1]?.id`).\n * ---\n * - #### Autocomplete limitation for array indices:\n * - Autocompletion for `[index]` is only supported up to **5** (`[0]` ➔ `[4]`).\n * - This limit is intentional for **performance and safety:**\n * 1. Generating infinite union types for all possible indices would cause\n * **TypeScript IntelliSense to hang or crash**.\n * - You can still check higher indices manually (e.g. `\"[999].id\"`),\n * but they will not show up in IntelliSense suggestions.\n *\n * ---\n * @param {HasOwnPropOptions} [options] - ***Optional configuration object.***\n * @param {HasOwnPropOptions[\"discardUndefined\"]} [options.discardUndefined=true]\n * ***If `true`, properties with `undefined` values are treated as **missing**, default: `true`.***\n * @param {HasOwnPropOptions[\"discardNull\"]} [options.discardNull=false]\n * ***If `true`, properties with `null` values are treated as **missing**, default: `false`.***\n * @param {*} obj ***The `object`, `array`, `string`, `function`, or `other value` to check against.***\n * @param {PropertyKey} key\n * ***The property key to check, can be:***\n * - `string` (supports dot/bracket paths, e.g. `\"user.address.city\"`, `\"[0].id\"`).\n * - `number` (array-like index).\n * - `symbol` (own property symbols).\n *\n * ---\n * @returns {boolean} Return `true` if the property exists (and passes `options`), otherwise `false`.\n *\n * ---\n * @example\n *\n * - #### Objects:\n * ```ts\n * const obj: { name?: string | null } = {};\n *\n * if (hasOwnProp(obj, \"name\")) {\n * // obj is now ➔ { name: string | null }\n * console.log(obj.name); // string | null\n * }\n *\n * if (hasOwnProp(obj, \"name\", { discardUndefined: true, discardNull: true })) {\n * // obj is now ➔ { name: string }\n * console.log(obj.name.toUpperCase()); // safe\n * }\n * ```\n * - #### Arrays:\n * ```ts\n * const users = [{ id: 1 }, { id: 2 }];\n *\n * if (hasOwnProp(users, \"[1].id\")) {\n * // ➔ users[1].id is guaranteed to exist\n * console.log(users[1].id); // number\n * }\n *\n * // Caveat: narrowing only applies to checked index\n * if (hasOwnProp(users, \"[0].id\")) {\n * console.log(users[0].id); // safe\n * console.log(users[1].id); // not guaranteed!\n * }\n *\n * // Solution: optional chaining\n * console.log(users[1]?.id);\n * // ➔ safe, even without narrowing\n * ```\n *\n * - #### Symbols:\n * ```ts\n * const secret = Symbol(\"secret\");\n * const obj2 = { [secret]: 42 };\n *\n * if (hasOwnProp(obj2, secret)) {\n * console.log(obj2[secret] + 1);\n * // ➔ 43\n * }\n * ```\n * - #### Strings:\n * ```ts\n * if (hasOwnProp(\"hello\", \"length\")) {\n * console.log(\"hello\".length);\n * // ➔ 5\n * }\n *\n * if (hasOwnProp(\"hello\", 1)) {\n * console.log(\"hello\"[1]);\n * // ➔ \"e\"\n * }\n * ```\n * - #### Functions:\n * ```ts\n * function fn() {}\n * fn.extra = 123;\n *\n * if (hasOwnProp(fn, \"extra\")) {\n * console.log(fn.extra);\n * // ➔ 123\n * }\n * ```\n * - #### Empty key:\n * ```ts\n * const obj = { a: 1 };\n *\n * hasOwnProp(obj, \"\");\n * // ➔ false (invalid key)\n * hasOwnProp(obj, \" \");\n * // ➔ false (trimmed to empty)\n * ```\n */\nexport function hasOwnProp<Obj>(\n obj: IsAny<Obj> extends true ? Obj : never,\n key: PropertyKey,\n options?: HasOwnPropOptions<boolean, boolean>\n /** @ts-expect-error we force `any` to `unknown` at result */\n): obj is unknown;\n\nexport function hasOwnProp<Obj extends null | undefined>(\n obj: Obj,\n key: PropertyKey,\n options?: HasOwnPropOptions<boolean, boolean>\n): false;\n\nexport function hasOwnProp<\n Obj extends object | AnyFunction,\n Key extends NestedKeyOfHasOwnProp<Obj>,\n DiscardUndefined extends boolean = true,\n DiscardNull extends boolean = false\n>(\n obj: Obj | null | undefined,\n key: Key,\n options?: HasOwnPropOptions<DiscardUndefined, DiscardNull>\n /** @ts-expect-error we force to override recursive type result */\n): obj is GuardedHasOwnProp<Obj, Key, DiscardUndefined, DiscardNull>;\n\nexport function hasOwnProp<\n Obj extends object,\n Num extends NumericKeyOfHasOwnProp<Obj>,\n DiscardUndefined extends boolean = true,\n DiscardNull extends boolean = false\n>(\n obj: Obj | null | undefined,\n key: Num,\n options?: HasOwnPropOptions<DiscardUndefined, DiscardNull>\n /** @ts-expect-error we force to override recursive type result */\n): obj is NumericKeyHasOwnPropMapped<Obj, Num, DiscardUndefined, DiscardNull>;\n\nexport function hasOwnProp<\n Obj extends object | AnyFunction,\n Sym extends symbol,\n DiscardUndefined extends boolean = true,\n DiscardNull extends boolean = false\n>(\n obj: Obj | null | undefined,\n key: Sym,\n options?: HasOwnPropOptions<DiscardUndefined, DiscardNull>\n /** @ts-expect-error we force to override recursive type result */\n): obj is DeepRequiredSymbolHasOwnProp<Obj, Sym, DiscardUndefined, DiscardNull>;\n\nexport function hasOwnProp<\n Obj extends string | null | undefined,\n Key extends string | number\n>(\n obj: Obj | null | undefined,\n key: Key,\n options?: HasOwnPropOptions<boolean, boolean>\n /** @ts-expect-error we force to override recursive type result */\n): obj is IsStringLiteral<SmartDetectStringHasOwnProp<Obj, Key>> extends true\n ? AnyString | SmartDetectStringHasOwnProp<Obj, Key>\n : SmartDetectStringHasOwnProp<Obj, Key>;\n\nexport function hasOwnProp<\n Obj extends unknown[] | AnyFunction,\n Key extends PropertyKey\n>(\n obj: Obj,\n key: Key,\n options?: HasOwnPropOptions<boolean, boolean>\n): obj is SmartDetectArrayFuncHasOwnProp<Obj, Key>;\n\nexport function hasOwnProp<\n Obj extends unknown | AnyFunction,\n Key extends PropertyKey,\n DiscardUndefined extends boolean = true,\n DiscardNull extends boolean = false\n>(\n obj: Obj,\n key:\n | Key\n | \"length\"\n | (IsPlainObjectResult<Obj> extends never ? never : keyof Obj),\n options?: HasOwnPropOptions<DiscardUndefined, DiscardNull>\n /** @ts-expect-error we force to override recursive type result */\n): obj is SmartDetectUnknownKeyHasOwnProp<\n Obj,\n Key,\n DiscardUndefined,\n DiscardNull\n>;\n\n// ------------------- IMPLEMENTATION -------------------\nexport function hasOwnProp(\n obj: unknown,\n key: PropertyKey,\n options: HasOwnPropOptions<boolean, boolean> = {}\n): unknown {\n if (!isString(obj) && !isObjectOrArray(obj) && !isFunction(obj)) return false;\n\n if (!isPlainObject(options)) options = {};\n\n // defaults: undef ➔ true, null ➔ false\n const discardUndefined =\n options.discardUndefined === undefined ? true : options.discardUndefined;\n const discardNull =\n options.discardNull === undefined ? false : options.discardNull;\n\n assertIsBoolean(discardUndefined, {\n message: ({ currentType, validType }) =>\n errorMsg(\n `Parameter \\`discardUndefined\\` property of the \\`options\\` (third parameter) must be of type \\`${validType}\\`, but received: \\`${currentType}\\`.`\n )\n });\n\n assertIsBoolean(discardNull, {\n message: ({ currentType, validType }) =>\n errorMsg(\n `Parameter \\`discardNull\\` property of the \\`options\\` (third parameter) must be of type \\`${validType}\\`, but received: \\`${currentType}\\`.`\n )\n });\n\n // Parse key ➔ path\n const path: (string | number | symbol)[] = [];\n //todo: keep use manually check for length string value for avoid Maximum infinity loop function.!!!\n if (\n (isString(key) && key.trim().length > 0) ||\n isNumber(key, { includeNaN: true })\n ) {\n const strKey = isNumber(key, { includeNaN: true }) ? String(key) : key;\n strKey.split(\".\").forEach((k) => {\n const bracketMatch = k.match(/^\\[(\\d+)\\]$/);\n const symbolMatch = k.match(/^Symbol\\((.+)\\)$/);\n if (bracketMatch) path.push(Number(bracketMatch[1]));\n else if (symbolMatch) path.push(Symbol.for(symbolMatch[1]));\n else if (!isNaN(Number(k))) path.push(Number(k));\n else path.push(k);\n });\n } else if (isSymbol(key)) {\n path.push(key);\n } else {\n return false;\n }\n\n // Traverse\n let current: unknown =\n isString(obj) && obj.trim().length > 0 ? Object(obj) : obj;\n for (const k of path) {\n if (\n (isString(k) && k.trim().length > 0) ||\n isNumber(k, { includeNaN: true })\n ) {\n if (\n isNull(current) ||\n !Object.prototype.hasOwnProperty.call(current, k)\n ) {\n return false;\n }\n current = (current as Record<PropertyKey, unknown>)[k];\n } else if (isSymbol(k)) {\n if (\n isNull(current) ||\n (typeof current !== \"object\" && !isFunction(current))\n ) {\n return false;\n }\n const symbols = Object.getOwnPropertySymbols(current);\n const matched = symbols.find(\n (s) => s === k || s.description === k.description\n );\n if (!matched) return false;\n current = (current as Record<PropertyKey, unknown>)[matched];\n } else {\n return false;\n }\n }\n // early fail for undefined if requested\n if (discardUndefined && isUndefined(current)) return false;\n\n // final null check (only if requested)\n if (discardNull && isNull(current)) return false;\n\n return true;\n}\n\n/**\n * @internal ***`Not part of the public API.`***\n */\nconst errorMsg = (msg: string) => createMessage(\"hasOwnProp\", msg);\n"],"mappings":";;;;;;;;;;;;;;;AAmRA,SAAgB,WACd,KACA,KACA,UAA+C,CAAC,GACvC;CACT,IAAI,CAACA,wBAAS,GAAG,KAAK,CAACC,+BAAgB,GAAG,KAAK,CAACC,0BAAW,GAAG,GAAG,OAAO;CAExE,IAAI,CAACC,6BAAc,OAAO,GAAG,UAAU,CAAC;CAGxC,MAAM,mBACJ,QAAQ,qBAAqB,SAAY,OAAO,QAAQ;CAC1D,MAAM,cACJ,QAAQ,gBAAgB,SAAY,QAAQ,QAAQ;CAEtD,+BAAgB,kBAAkB,EAChC,UAAU,EAAE,aAAa,gBACvB,SACE,kGAAkG,UAAU,sBAAsB,YAAY,IAChJ,EACJ,CAAC;CAED,+BAAgB,aAAa,EAC3B,UAAU,EAAE,aAAa,gBACvB,SACE,6FAA6F,UAAU,sBAAsB,YAAY,IAC3I,EACJ,CAAC;CAGD,MAAM,OAAqC,CAAC;CAE5C,IACGH,wBAAS,GAAG,KAAK,IAAI,KAAK,EAAE,SAAS,KACtCI,0BAAS,KAAK,EAAE,YAAY,KAAK,CAAC,GAGlC,CADeA,0BAAS,KAAK,EAAE,YAAY,KAAK,CAAC,IAAI,OAAO,GAAG,IAAI,KAC5D,MAAM,GAAG,EAAE,SAAS,MAAM;EAC/B,MAAM,eAAe,EAAE,MAAM,aAAa;EAC1C,MAAM,cAAc,EAAE,MAAM,kBAAkB;EAC9C,IAAI,cAAc,KAAK,KAAK,OAAO,aAAa,EAAE,CAAC;OAC9C,IAAI,aAAa,KAAK,KAAK,OAAO,IAAI,YAAY,EAAE,CAAC;OACrD,IAAI,CAACC,qBAAM,OAAO,CAAC,CAAC,GAAG,KAAK,KAAK,OAAO,CAAC,CAAC;OAC1C,KAAK,KAAK,CAAC;CAClB,CAAC;MACI,IAAIC,qCAAS,GAAG,GACrB,KAAK,KAAK,GAAG;MAEb,OAAO;CAIT,IAAI,UACFN,wBAAS,GAAG,KAAK,IAAI,KAAK,EAAE,SAAS,IAAI,OAAO,GAAG,IAAI;CACzD,KAAK,MAAM,KAAK,MACd,IACGA,wBAAS,CAAC,KAAK,EAAE,KAAK,EAAE,SAAS,KAClCI,0BAAS,GAAG,EAAE,YAAY,KAAK,CAAC,GAChC;EACA,IACEG,sBAAO,OAAO,KACd,CAAC,OAAO,UAAU,eAAe,KAAK,SAAS,CAAC,GAEhD,OAAO;EAET,UAAW,QAAyC;CACtD,OAAO,IAAID,qCAAS,CAAC,GAAG;EACtB,IACEC,sBAAO,OAAO,KACb,OAAO,YAAY,YAAY,CAACL,0BAAW,OAAO,GAEnD,OAAO;EAGT,MAAM,UADU,OAAO,sBAAsB,OACvB,EAAE,MACrB,MAAM,MAAM,KAAK,EAAE,gBAAgB,EAAE,WACxC;EACA,IAAI,CAAC,SAAS,OAAO;EACrB,UAAW,QAAyC;CACtD,OACE,OAAO;CAIX,IAAI,oBAAoBM,wCAAY,OAAO,GAAG,OAAO;CAGrD,IAAI,eAAeD,sBAAO,OAAO,GAAG,OAAO;CAE3C,OAAO;AACT;;;;AAKA,MAAM,YAAY,QAAgBE,6BAAc,cAAc,GAAG"}
|
|
1
|
+
{"version":3,"file":"hasOwnProp-DTWYqy7S.cjs","names":["isString","isObjectOrArray","isFunction","isPlainObject","isNumber","isNaN","isSymbol","isNull","isUndefined","createMessage"],"sources":["../src/predicates/has/hasOwnProp.ts"],"sourcesContent":["import type {\n AnyFunction,\n AnyString,\n IsAny,\n IsStringLiteral\n} from \"@rzl-zone/ts-types-plus\";\nimport type {\n DeepRequiredSymbolHasOwnProp,\n GuardedHasOwnProp,\n HasOwnPropOptions,\n NestedKeyOfHasOwnProp,\n SmartDetectArrayFuncHasOwnProp,\n SmartDetectUnknownKeyHasOwnProp,\n NumericKeyHasOwnPropMapped,\n NumericKeyOfHasOwnProp,\n SmartDetectStringHasOwnProp\n} from \"./hasOwnProp.types\";\n\nimport { createMessage } from \"@/_private/logger\";\n\nimport { assertIsBoolean } from \"@/assertions/booleans/assertIsBoolean\";\n\nimport { isNaN } from \"../is/isNaN\";\nimport { isNull } from \"../is/isNull\";\nimport { isString } from \"../is/isString\";\nimport { isNumber } from \"../is/isNumber\";\nimport { isSymbol } from \"../is/isSymbol\";\nimport { isFunction } from \"../is/isFunction\";\nimport { isUndefined } from \"../is/isUndefined\";\nimport { isObjectOrArray } from \"../is/isObjectOrArray\";\nimport { isPlainObject, type IsPlainObjectResult } from \"../is/isPlainObject\";\n\n// ------------------- HAS OWN PROP OVERLOADS -------------------\n\n/** -------------------------------------------------------\n * * ***Type guard: `hasOwnProp`.***\n * --------------------------------------------------------\n * **A **type-safe** replacement for `Object.prototype.hasOwnProperty` with runtime validation and **TypeScript-aware type narrowing**.**\n *\n * ---\n * - #### *Supported Targets:*\n * - **Plain objects** ➔ `{ foo: \"bar\" }`.\n * - **Arrays** ➔ `[ { id: 1 }, { id: 2 } ]`.\n * - **Strings** ➔ `\"hello\"` (as array-like objects with `.length`, index, etc.).\n * - **Functions** ➔ callable objects with extra props.\n * - **Symbols** ➔ own property symbols.\n * ---\n * - #### *Key Advantages over `in` or `obj.hasOwnProperty(key)`:*\n * - Supports **dot/bracket path notation** (e.g. `\"user.address.city\"`, `\"addresses[0].zip\"`).\n * - Handles **symbol** keys safely.\n * - **Narrows** the type of `obj` in TypeScript (stronger type safety).\n * - Configurable handling of **`undefined`** and **`null`**.\n * ---\n * - #### *Runtime Behavior:*\n * - #### Returns `true` if:\n * - Value `obj` is an object/array/string/function **and** the property\n * exists **and**, it passes the `options` checks.\n * ---\n * - #### Returns `false` if:\n * - Value `obj` is not a valid type.\n * - The property does not exist.\n * - The value is `undefined` and `discardUndefined: true` (**default**).\n * - The value is `null` and `discardNull: true`.\n * - The `key` (after trimming) is an **empty string** ➔ treated as **invalid**.\n * ---\n * - #### *TypeScript Behavior:*\n * - #### Inside an `if (hasOwnProp(...)) {}` block:\n * - The property is **guaranteed to exist**.\n * - Depending on `options`, the property type is narrowed to exclude\n * `undefined` and/or `null`.\n * ---\n * - #### *Caveats:*\n * - #### Empty keys are invalid:\n * - If the `key` string is empty (`\"\"`) after trimming whitespace or other characters,\n * it will **not** be considered a valid property and always returns `false`.\n * ---\n * - #### Arrays are limited by TypeScript inference:\n * - Checking index `[0]` only narrows **that specific index**, not the rest, example:\n * 1. `hasOwnProp(users, \"[0].id\")` does **not** imply `users[1].id` exists.\n * - For different indices, use **optional chaining** (`users[1]?.id`).\n * ---\n * - #### Autocomplete limitation for array indices:\n * - Autocompletion for `[index]` is only supported up to **5** (`[0]` ➔ `[4]`).\n * - This limit is intentional for **performance and safety:**\n * 1. Generating infinite union types for all possible indices would cause\n * **TypeScript IntelliSense to hang or crash**.\n * - You can still check higher indices manually (e.g. `\"[999].id\"`),\n * but they will not show up in IntelliSense suggestions.\n *\n * ---\n * @param {HasOwnPropOptions} [options] - ***Optional configuration object.***\n * @param {HasOwnPropOptions[\"discardUndefined\"]} [options.discardUndefined=true]\n * ***If `true`, properties with `undefined` values are treated as **missing**, default: `true`.***\n * @param {HasOwnPropOptions[\"discardNull\"]} [options.discardNull=false]\n * ***If `true`, properties with `null` values are treated as **missing**, default: `false`.***\n * @param {*} obj ***The `object`, `array`, `string`, `function`, or `other value` to check against.***\n * @param {PropertyKey} key\n * ***The property key to check, can be:***\n * - `string` (supports dot/bracket paths, e.g. `\"user.address.city\"`, `\"[0].id\"`).\n * - `number` (array-like index).\n * - `symbol` (own property symbols).\n *\n * ---\n * @returns {boolean} Return `true` if the property exists (and passes `options`), otherwise `false`.\n *\n * ---\n * @example\n *\n * - #### Objects:\n * ```ts\n * const obj: { name?: string | null } = {};\n *\n * if (hasOwnProp(obj, \"name\")) {\n * // obj is now ➔ { name: string | null }\n * console.log(obj.name); // string | null\n * }\n *\n * if (hasOwnProp(obj, \"name\", { discardUndefined: true, discardNull: true })) {\n * // obj is now ➔ { name: string }\n * console.log(obj.name.toUpperCase()); // safe\n * }\n * ```\n * - #### Arrays:\n * ```ts\n * const users = [{ id: 1 }, { id: 2 }];\n *\n * if (hasOwnProp(users, \"[1].id\")) {\n * // ➔ users[1].id is guaranteed to exist\n * console.log(users[1].id); // number\n * }\n *\n * // Caveat: narrowing only applies to checked index\n * if (hasOwnProp(users, \"[0].id\")) {\n * console.log(users[0].id); // safe\n * console.log(users[1].id); // not guaranteed!\n * }\n *\n * // Solution: optional chaining\n * console.log(users[1]?.id);\n * // ➔ safe, even without narrowing\n * ```\n *\n * - #### Symbols:\n * ```ts\n * const secret = Symbol(\"secret\");\n * const obj2 = { [secret]: 42 };\n *\n * if (hasOwnProp(obj2, secret)) {\n * console.log(obj2[secret] + 1);\n * // ➔ 43\n * }\n * ```\n * - #### Strings:\n * ```ts\n * if (hasOwnProp(\"hello\", \"length\")) {\n * console.log(\"hello\".length);\n * // ➔ 5\n * }\n *\n * if (hasOwnProp(\"hello\", 1)) {\n * console.log(\"hello\"[1]);\n * // ➔ \"e\"\n * }\n * ```\n * - #### Functions:\n * ```ts\n * function fn() {}\n * fn.extra = 123;\n *\n * if (hasOwnProp(fn, \"extra\")) {\n * console.log(fn.extra);\n * // ➔ 123\n * }\n * ```\n * - #### Empty key:\n * ```ts\n * const obj = { a: 1 };\n *\n * hasOwnProp(obj, \"\");\n * // ➔ false (invalid key)\n * hasOwnProp(obj, \" \");\n * // ➔ false (trimmed to empty)\n * ```\n */\nexport function hasOwnProp<Obj>(\n obj: IsAny<Obj> extends true ? Obj : never,\n key: PropertyKey,\n options?: HasOwnPropOptions<boolean, boolean>\n /** @ts-expect-error we force `any` to `unknown` at result */\n): obj is unknown;\n\nexport function hasOwnProp<Obj extends null | undefined>(\n obj: Obj,\n key: PropertyKey,\n options?: HasOwnPropOptions<boolean, boolean>\n): false;\n\nexport function hasOwnProp<\n Obj extends object | AnyFunction,\n Key extends NestedKeyOfHasOwnProp<Obj>,\n DiscardUndefined extends boolean = true,\n DiscardNull extends boolean = false\n>(\n obj: Obj | null | undefined,\n key: Key,\n options?: HasOwnPropOptions<DiscardUndefined, DiscardNull>\n /** @ts-expect-error we force to override recursive type result */\n): obj is GuardedHasOwnProp<Obj, Key, DiscardUndefined, DiscardNull>;\n\nexport function hasOwnProp<\n Obj extends object,\n Num extends NumericKeyOfHasOwnProp<Obj>,\n DiscardUndefined extends boolean = true,\n DiscardNull extends boolean = false\n>(\n obj: Obj | null | undefined,\n key: Num,\n options?: HasOwnPropOptions<DiscardUndefined, DiscardNull>\n /** @ts-expect-error we force to override recursive type result */\n): obj is NumericKeyHasOwnPropMapped<Obj, Num, DiscardUndefined, DiscardNull>;\n\nexport function hasOwnProp<\n Obj extends object | AnyFunction,\n Sym extends symbol,\n DiscardUndefined extends boolean = true,\n DiscardNull extends boolean = false\n>(\n obj: Obj | null | undefined,\n key: Sym,\n options?: HasOwnPropOptions<DiscardUndefined, DiscardNull>\n /** @ts-expect-error we force to override recursive type result */\n): obj is DeepRequiredSymbolHasOwnProp<Obj, Sym, DiscardUndefined, DiscardNull>;\n\nexport function hasOwnProp<\n Obj extends string | null | undefined,\n Key extends string | number\n>(\n obj: Obj | null | undefined,\n key: Key,\n options?: HasOwnPropOptions<boolean, boolean>\n /** @ts-expect-error we force to override recursive type result */\n): obj is IsStringLiteral<SmartDetectStringHasOwnProp<Obj, Key>> extends true\n ? AnyString | SmartDetectStringHasOwnProp<Obj, Key>\n : SmartDetectStringHasOwnProp<Obj, Key>;\n\nexport function hasOwnProp<\n Obj extends unknown[] | AnyFunction,\n Key extends PropertyKey\n>(\n obj: Obj,\n key: Key,\n options?: HasOwnPropOptions<boolean, boolean>\n): obj is SmartDetectArrayFuncHasOwnProp<Obj, Key>;\n\nexport function hasOwnProp<\n Obj extends unknown | AnyFunction,\n Key extends PropertyKey,\n DiscardUndefined extends boolean = true,\n DiscardNull extends boolean = false\n>(\n obj: Obj,\n key:\n | Key\n | \"length\"\n | (IsPlainObjectResult<Obj> extends never ? never : keyof Obj),\n options?: HasOwnPropOptions<DiscardUndefined, DiscardNull>\n /** @ts-expect-error we force to override recursive type result */\n): obj is SmartDetectUnknownKeyHasOwnProp<\n Obj,\n Key,\n DiscardUndefined,\n DiscardNull\n>;\n\n// ------------------- IMPLEMENTATION -------------------\nexport function hasOwnProp(\n obj: unknown,\n key: PropertyKey,\n options: HasOwnPropOptions<boolean, boolean> = {}\n): unknown {\n if (!isString(obj) && !isObjectOrArray(obj) && !isFunction(obj)) return false;\n\n if (!isPlainObject(options)) options = {};\n\n // defaults: undef ➔ true, null ➔ false\n const discardUndefined =\n options.discardUndefined === undefined ? true : options.discardUndefined;\n const discardNull =\n options.discardNull === undefined ? false : options.discardNull;\n\n assertIsBoolean(discardUndefined, {\n message: ({ currentType, validType }) =>\n errorMsg(\n `Parameter \\`discardUndefined\\` property of the \\`options\\` (third parameter) must be of type \\`${validType}\\`, but received: \\`${currentType}\\`.`\n )\n });\n\n assertIsBoolean(discardNull, {\n message: ({ currentType, validType }) =>\n errorMsg(\n `Parameter \\`discardNull\\` property of the \\`options\\` (third parameter) must be of type \\`${validType}\\`, but received: \\`${currentType}\\`.`\n )\n });\n\n // Parse key ➔ path\n const path: (string | number | symbol)[] = [];\n //todo: keep use manually check for length string value for avoid Maximum infinity loop function.!!!\n if (\n (isString(key) && key.trim().length > 0) ||\n isNumber(key, { includeNaN: true })\n ) {\n const strKey = isNumber(key, { includeNaN: true }) ? String(key) : key;\n strKey.split(\".\").forEach((k) => {\n const bracketMatch = k.match(/^\\[(\\d+)\\]$/);\n const symbolMatch = k.match(/^Symbol\\((.+)\\)$/);\n if (bracketMatch) path.push(Number(bracketMatch[1]));\n else if (symbolMatch) path.push(Symbol.for(symbolMatch[1]));\n else if (!isNaN(Number(k))) path.push(Number(k));\n else path.push(k);\n });\n } else if (isSymbol(key)) {\n path.push(key);\n } else {\n return false;\n }\n\n // Traverse\n let current: unknown =\n isString(obj) && obj.trim().length > 0 ? Object(obj) : obj;\n for (const k of path) {\n if (\n (isString(k) && k.trim().length > 0) ||\n isNumber(k, { includeNaN: true })\n ) {\n if (\n isNull(current) ||\n !Object.prototype.hasOwnProperty.call(current, k)\n ) {\n return false;\n }\n current = (current as Record<PropertyKey, unknown>)[k];\n } else if (isSymbol(k)) {\n if (\n isNull(current) ||\n (typeof current !== \"object\" && !isFunction(current))\n ) {\n return false;\n }\n const symbols = Object.getOwnPropertySymbols(current);\n const matched = symbols.find(\n (s) => s === k || s.description === k.description\n );\n if (!matched) return false;\n current = (current as Record<PropertyKey, unknown>)[matched];\n } else {\n return false;\n }\n }\n // early fail for undefined if requested\n if (discardUndefined && isUndefined(current)) return false;\n\n // final null check (only if requested)\n if (discardNull && isNull(current)) return false;\n\n return true;\n}\n\n/**\n * @internal ***`Not part of the public API.`***\n */\nconst errorMsg = (msg: string) => createMessage(\"hasOwnProp\", msg);\n"],"mappings":";;;;;;;;;;;;;;;AAmRA,SAAgB,WACd,KACA,KACA,UAA+C,CAAC,GACvC;CACT,IAAI,CAACA,wBAAS,GAAG,KAAK,CAACC,+BAAgB,GAAG,KAAK,CAACC,0BAAW,GAAG,GAAG,OAAO;CAExE,IAAI,CAACC,6BAAc,OAAO,GAAG,UAAU,CAAC;CAGxC,MAAM,mBACJ,QAAQ,qBAAqB,SAAY,OAAO,QAAQ;CAC1D,MAAM,cACJ,QAAQ,gBAAgB,SAAY,QAAQ,QAAQ;CAEtD,+BAAgB,kBAAkB,EAChC,UAAU,EAAE,aAAa,gBACvB,SACE,kGAAkG,UAAU,sBAAsB,YAAY,IAChJ,EACJ,CAAC;CAED,+BAAgB,aAAa,EAC3B,UAAU,EAAE,aAAa,gBACvB,SACE,6FAA6F,UAAU,sBAAsB,YAAY,IAC3I,EACJ,CAAC;CAGD,MAAM,OAAqC,CAAC;CAE5C,IACGH,wBAAS,GAAG,KAAK,IAAI,KAAK,EAAE,SAAS,KACtCI,0BAAS,KAAK,EAAE,YAAY,KAAK,CAAC,GAGlC,CADeA,0BAAS,KAAK,EAAE,YAAY,KAAK,CAAC,IAAI,OAAO,GAAG,IAAI,KAC5D,MAAM,GAAG,EAAE,SAAS,MAAM;EAC/B,MAAM,eAAe,EAAE,MAAM,aAAa;EAC1C,MAAM,cAAc,EAAE,MAAM,kBAAkB;EAC9C,IAAI,cAAc,KAAK,KAAK,OAAO,aAAa,EAAE,CAAC;OAC9C,IAAI,aAAa,KAAK,KAAK,OAAO,IAAI,YAAY,EAAE,CAAC;OACrD,IAAI,CAACC,qBAAM,OAAO,CAAC,CAAC,GAAG,KAAK,KAAK,OAAO,CAAC,CAAC;OAC1C,KAAK,KAAK,CAAC;CAClB,CAAC;MACI,IAAIC,qCAAS,GAAG,GACrB,KAAK,KAAK,GAAG;MAEb,OAAO;CAIT,IAAI,UACFN,wBAAS,GAAG,KAAK,IAAI,KAAK,EAAE,SAAS,IAAI,OAAO,GAAG,IAAI;CACzD,KAAK,MAAM,KAAK,MACd,IACGA,wBAAS,CAAC,KAAK,EAAE,KAAK,EAAE,SAAS,KAClCI,0BAAS,GAAG,EAAE,YAAY,KAAK,CAAC,GAChC;EACA,IACEG,sBAAO,OAAO,KACd,CAAC,OAAO,UAAU,eAAe,KAAK,SAAS,CAAC,GAEhD,OAAO;EAET,UAAW,QAAyC;CACtD,OAAO,IAAID,qCAAS,CAAC,GAAG;EACtB,IACEC,sBAAO,OAAO,KACb,OAAO,YAAY,YAAY,CAACL,0BAAW,OAAO,GAEnD,OAAO;EAGT,MAAM,UADU,OAAO,sBAAsB,OACvB,EAAE,MACrB,MAAM,MAAM,KAAK,EAAE,gBAAgB,EAAE,WACxC;EACA,IAAI,CAAC,SAAS,OAAO;EACrB,UAAW,QAAyC;CACtD,OACE,OAAO;CAIX,IAAI,oBAAoBM,wCAAY,OAAO,GAAG,OAAO;CAGrD,IAAI,eAAeD,sBAAO,OAAO,GAAG,OAAO;CAE3C,OAAO;AACT;;;;AAKA,MAAM,YAAY,QAAgBE,6BAAc,cAAc,GAAG"}
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
* ========================================================================
|
|
3
3
|
* @rzl-zone/utils-js
|
|
4
4
|
* ------------------------------------------------------------------------
|
|
5
|
-
* Version: `3.14.0
|
|
5
|
+
* Version: `3.14.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 { A as isFunction, E as isPlainObject, S as isNaN, T as isString, g as isObjectOrArray, n as assertIsBoolean, t as createMessage, x as isNull } from "./logger-
|
|
11
|
-
import { t as isNumber } from "./isNumber-
|
|
12
|
-
import { n as isSymbol, r as isUndefined } from "./safeStableStringify-
|
|
10
|
+
import { A as isFunction, E as isPlainObject, S as isNaN, T as isString, g as isObjectOrArray, n as assertIsBoolean, t as createMessage, x as isNull } from "./logger-Wxl_Krg6.js";
|
|
11
|
+
import { t as isNumber } from "./isNumber-C1mOuBuA.js";
|
|
12
|
+
import { n as isSymbol, r as isUndefined } from "./safeStableStringify-CDSYnLUz.js";
|
|
13
13
|
function hasOwnProp(obj, key, options = {}) {
|
|
14
14
|
if (!isString(obj) && !isObjectOrArray(obj) && !isFunction(obj)) return false;
|
|
15
15
|
if (!isPlainObject(options)) options = {};
|
|
@@ -44,4 +44,4 @@ function hasOwnProp(obj, key, options = {}) {
|
|
|
44
44
|
}
|
|
45
45
|
const errorMsg = (msg) => createMessage("hasOwnProp", msg);
|
|
46
46
|
export { hasOwnProp as t };
|
|
47
|
-
//# sourceMappingURL=hasOwnProp-
|
|
47
|
+
//# sourceMappingURL=hasOwnProp-yVVsxPin.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hasOwnProp-CVIhlD1i.js","names":[],"sources":["../src/predicates/has/hasOwnProp.ts"],"sourcesContent":["import type {\n AnyFunction,\n AnyString,\n IsAny,\n IsStringLiteral\n} from \"@rzl-zone/ts-types-plus\";\nimport type {\n DeepRequiredSymbolHasOwnProp,\n GuardedHasOwnProp,\n HasOwnPropOptions,\n NestedKeyOfHasOwnProp,\n SmartDetectArrayFuncHasOwnProp,\n SmartDetectUnknownKeyHasOwnProp,\n NumericKeyHasOwnPropMapped,\n NumericKeyOfHasOwnProp,\n SmartDetectStringHasOwnProp\n} from \"./hasOwnProp.types\";\n\nimport { createMessage } from \"@/_private/logger\";\n\nimport { assertIsBoolean } from \"@/assertions/booleans/assertIsBoolean\";\n\nimport { isNaN } from \"../is/isNaN\";\nimport { isNull } from \"../is/isNull\";\nimport { isString } from \"../is/isString\";\nimport { isNumber } from \"../is/isNumber\";\nimport { isSymbol } from \"../is/isSymbol\";\nimport { isFunction } from \"../is/isFunction\";\nimport { isUndefined } from \"../is/isUndefined\";\nimport { isObjectOrArray } from \"../is/isObjectOrArray\";\nimport { isPlainObject, type IsPlainObjectResult } from \"../is/isPlainObject\";\n\n// ------------------- HAS OWN PROP OVERLOADS -------------------\n\n/** -------------------------------------------------------\n * * ***Type guard: `hasOwnProp`.***\n * --------------------------------------------------------\n * **A **type-safe** replacement for `Object.prototype.hasOwnProperty` with runtime validation and **TypeScript-aware type narrowing**.**\n *\n * ---\n * - #### *Supported Targets:*\n * - **Plain objects** ➔ `{ foo: \"bar\" }`.\n * - **Arrays** ➔ `[ { id: 1 }, { id: 2 } ]`.\n * - **Strings** ➔ `\"hello\"` (as array-like objects with `.length`, index, etc.).\n * - **Functions** ➔ callable objects with extra props.\n * - **Symbols** ➔ own property symbols.\n * ---\n * - #### *Key Advantages over `in` or `obj.hasOwnProperty(key)`:*\n * - Supports **dot/bracket path notation** (e.g. `\"user.address.city\"`, `\"addresses[0].zip\"`).\n * - Handles **symbol** keys safely.\n * - **Narrows** the type of `obj` in TypeScript (stronger type safety).\n * - Configurable handling of **`undefined`** and **`null`**.\n * ---\n * - #### *Runtime Behavior:*\n * - #### Returns `true` if:\n * - Value `obj` is an object/array/string/function **and** the property\n * exists **and**, it passes the `options` checks.\n * ---\n * - #### Returns `false` if:\n * - Value `obj` is not a valid type.\n * - The property does not exist.\n * - The value is `undefined` and `discardUndefined: true` (**default**).\n * - The value is `null` and `discardNull: true`.\n * - The `key` (after trimming) is an **empty string** ➔ treated as **invalid**.\n * ---\n * - #### *TypeScript Behavior:*\n * - #### Inside an `if (hasOwnProp(...)) {}` block:\n * - The property is **guaranteed to exist**.\n * - Depending on `options`, the property type is narrowed to exclude\n * `undefined` and/or `null`.\n * ---\n * - #### *Caveats:*\n * - #### Empty keys are invalid:\n * - If the `key` string is empty (`\"\"`) after trimming whitespace or other characters,\n * it will **not** be considered a valid property and always returns `false`.\n * ---\n * - #### Arrays are limited by TypeScript inference:\n * - Checking index `[0]` only narrows **that specific index**, not the rest, example:\n * 1. `hasOwnProp(users, \"[0].id\")` does **not** imply `users[1].id` exists.\n * - For different indices, use **optional chaining** (`users[1]?.id`).\n * ---\n * - #### Autocomplete limitation for array indices:\n * - Autocompletion for `[index]` is only supported up to **5** (`[0]` ➔ `[4]`).\n * - This limit is intentional for **performance and safety:**\n * 1. Generating infinite union types for all possible indices would cause\n * **TypeScript IntelliSense to hang or crash**.\n * - You can still check higher indices manually (e.g. `\"[999].id\"`),\n * but they will not show up in IntelliSense suggestions.\n *\n * ---\n * @param {HasOwnPropOptions} [options] - ***Optional configuration object.***\n * @param {HasOwnPropOptions[\"discardUndefined\"]} [options.discardUndefined=true]\n * ***If `true`, properties with `undefined` values are treated as **missing**, default: `true`.***\n * @param {HasOwnPropOptions[\"discardNull\"]} [options.discardNull=false]\n * ***If `true`, properties with `null` values are treated as **missing**, default: `false`.***\n * @param {*} obj ***The `object`, `array`, `string`, `function`, or `other value` to check against.***\n * @param {PropertyKey} key\n * ***The property key to check, can be:***\n * - `string` (supports dot/bracket paths, e.g. `\"user.address.city\"`, `\"[0].id\"`).\n * - `number` (array-like index).\n * - `symbol` (own property symbols).\n *\n * ---\n * @returns {boolean} Return `true` if the property exists (and passes `options`), otherwise `false`.\n *\n * ---\n * @example\n *\n * - #### Objects:\n * ```ts\n * const obj: { name?: string | null } = {};\n *\n * if (hasOwnProp(obj, \"name\")) {\n * // obj is now ➔ { name: string | null }\n * console.log(obj.name); // string | null\n * }\n *\n * if (hasOwnProp(obj, \"name\", { discardUndefined: true, discardNull: true })) {\n * // obj is now ➔ { name: string }\n * console.log(obj.name.toUpperCase()); // safe\n * }\n * ```\n * - #### Arrays:\n * ```ts\n * const users = [{ id: 1 }, { id: 2 }];\n *\n * if (hasOwnProp(users, \"[1].id\")) {\n * // ➔ users[1].id is guaranteed to exist\n * console.log(users[1].id); // number\n * }\n *\n * // Caveat: narrowing only applies to checked index\n * if (hasOwnProp(users, \"[0].id\")) {\n * console.log(users[0].id); // safe\n * console.log(users[1].id); // not guaranteed!\n * }\n *\n * // Solution: optional chaining\n * console.log(users[1]?.id);\n * // ➔ safe, even without narrowing\n * ```\n *\n * - #### Symbols:\n * ```ts\n * const secret = Symbol(\"secret\");\n * const obj2 = { [secret]: 42 };\n *\n * if (hasOwnProp(obj2, secret)) {\n * console.log(obj2[secret] + 1);\n * // ➔ 43\n * }\n * ```\n * - #### Strings:\n * ```ts\n * if (hasOwnProp(\"hello\", \"length\")) {\n * console.log(\"hello\".length);\n * // ➔ 5\n * }\n *\n * if (hasOwnProp(\"hello\", 1)) {\n * console.log(\"hello\"[1]);\n * // ➔ \"e\"\n * }\n * ```\n * - #### Functions:\n * ```ts\n * function fn() {}\n * fn.extra = 123;\n *\n * if (hasOwnProp(fn, \"extra\")) {\n * console.log(fn.extra);\n * // ➔ 123\n * }\n * ```\n * - #### Empty key:\n * ```ts\n * const obj = { a: 1 };\n *\n * hasOwnProp(obj, \"\");\n * // ➔ false (invalid key)\n * hasOwnProp(obj, \" \");\n * // ➔ false (trimmed to empty)\n * ```\n */\nexport function hasOwnProp<Obj>(\n obj: IsAny<Obj> extends true ? Obj : never,\n key: PropertyKey,\n options?: HasOwnPropOptions<boolean, boolean>\n /** @ts-expect-error we force `any` to `unknown` at result */\n): obj is unknown;\n\nexport function hasOwnProp<Obj extends null | undefined>(\n obj: Obj,\n key: PropertyKey,\n options?: HasOwnPropOptions<boolean, boolean>\n): false;\n\nexport function hasOwnProp<\n Obj extends object | AnyFunction,\n Key extends NestedKeyOfHasOwnProp<Obj>,\n DiscardUndefined extends boolean = true,\n DiscardNull extends boolean = false\n>(\n obj: Obj | null | undefined,\n key: Key,\n options?: HasOwnPropOptions<DiscardUndefined, DiscardNull>\n /** @ts-expect-error we force to override recursive type result */\n): obj is GuardedHasOwnProp<Obj, Key, DiscardUndefined, DiscardNull>;\n\nexport function hasOwnProp<\n Obj extends object,\n Num extends NumericKeyOfHasOwnProp<Obj>,\n DiscardUndefined extends boolean = true,\n DiscardNull extends boolean = false\n>(\n obj: Obj | null | undefined,\n key: Num,\n options?: HasOwnPropOptions<DiscardUndefined, DiscardNull>\n /** @ts-expect-error we force to override recursive type result */\n): obj is NumericKeyHasOwnPropMapped<Obj, Num, DiscardUndefined, DiscardNull>;\n\nexport function hasOwnProp<\n Obj extends object | AnyFunction,\n Sym extends symbol,\n DiscardUndefined extends boolean = true,\n DiscardNull extends boolean = false\n>(\n obj: Obj | null | undefined,\n key: Sym,\n options?: HasOwnPropOptions<DiscardUndefined, DiscardNull>\n /** @ts-expect-error we force to override recursive type result */\n): obj is DeepRequiredSymbolHasOwnProp<Obj, Sym, DiscardUndefined, DiscardNull>;\n\nexport function hasOwnProp<\n Obj extends string | null | undefined,\n Key extends string | number\n>(\n obj: Obj | null | undefined,\n key: Key,\n options?: HasOwnPropOptions<boolean, boolean>\n /** @ts-expect-error we force to override recursive type result */\n): obj is IsStringLiteral<SmartDetectStringHasOwnProp<Obj, Key>> extends true\n ? AnyString | SmartDetectStringHasOwnProp<Obj, Key>\n : SmartDetectStringHasOwnProp<Obj, Key>;\n\nexport function hasOwnProp<\n Obj extends unknown[] | AnyFunction,\n Key extends PropertyKey\n>(\n obj: Obj,\n key: Key,\n options?: HasOwnPropOptions<boolean, boolean>\n): obj is SmartDetectArrayFuncHasOwnProp<Obj, Key>;\n\nexport function hasOwnProp<\n Obj extends unknown | AnyFunction,\n Key extends PropertyKey,\n DiscardUndefined extends boolean = true,\n DiscardNull extends boolean = false\n>(\n obj: Obj,\n key:\n | Key\n | \"length\"\n | (IsPlainObjectResult<Obj> extends never ? never : keyof Obj),\n options?: HasOwnPropOptions<DiscardUndefined, DiscardNull>\n /** @ts-expect-error we force to override recursive type result */\n): obj is SmartDetectUnknownKeyHasOwnProp<\n Obj,\n Key,\n DiscardUndefined,\n DiscardNull\n>;\n\n// ------------------- IMPLEMENTATION -------------------\nexport function hasOwnProp(\n obj: unknown,\n key: PropertyKey,\n options: HasOwnPropOptions<boolean, boolean> = {}\n): unknown {\n if (!isString(obj) && !isObjectOrArray(obj) && !isFunction(obj)) return false;\n\n if (!isPlainObject(options)) options = {};\n\n // defaults: undef ➔ true, null ➔ false\n const discardUndefined =\n options.discardUndefined === undefined ? true : options.discardUndefined;\n const discardNull =\n options.discardNull === undefined ? false : options.discardNull;\n\n assertIsBoolean(discardUndefined, {\n message: ({ currentType, validType }) =>\n errorMsg(\n `Parameter \\`discardUndefined\\` property of the \\`options\\` (third parameter) must be of type \\`${validType}\\`, but received: \\`${currentType}\\`.`\n )\n });\n\n assertIsBoolean(discardNull, {\n message: ({ currentType, validType }) =>\n errorMsg(\n `Parameter \\`discardNull\\` property of the \\`options\\` (third parameter) must be of type \\`${validType}\\`, but received: \\`${currentType}\\`.`\n )\n });\n\n // Parse key ➔ path\n const path: (string | number | symbol)[] = [];\n //todo: keep use manually check for length string value for avoid Maximum infinity loop function.!!!\n if (\n (isString(key) && key.trim().length > 0) ||\n isNumber(key, { includeNaN: true })\n ) {\n const strKey = isNumber(key, { includeNaN: true }) ? String(key) : key;\n strKey.split(\".\").forEach((k) => {\n const bracketMatch = k.match(/^\\[(\\d+)\\]$/);\n const symbolMatch = k.match(/^Symbol\\((.+)\\)$/);\n if (bracketMatch) path.push(Number(bracketMatch[1]));\n else if (symbolMatch) path.push(Symbol.for(symbolMatch[1]));\n else if (!isNaN(Number(k))) path.push(Number(k));\n else path.push(k);\n });\n } else if (isSymbol(key)) {\n path.push(key);\n } else {\n return false;\n }\n\n // Traverse\n let current: unknown =\n isString(obj) && obj.trim().length > 0 ? Object(obj) : obj;\n for (const k of path) {\n if (\n (isString(k) && k.trim().length > 0) ||\n isNumber(k, { includeNaN: true })\n ) {\n if (\n isNull(current) ||\n !Object.prototype.hasOwnProperty.call(current, k)\n ) {\n return false;\n }\n current = (current as Record<PropertyKey, unknown>)[k];\n } else if (isSymbol(k)) {\n if (\n isNull(current) ||\n (typeof current !== \"object\" && !isFunction(current))\n ) {\n return false;\n }\n const symbols = Object.getOwnPropertySymbols(current);\n const matched = symbols.find(\n (s) => s === k || s.description === k.description\n );\n if (!matched) return false;\n current = (current as Record<PropertyKey, unknown>)[matched];\n } else {\n return false;\n }\n }\n // early fail for undefined if requested\n if (discardUndefined && isUndefined(current)) return false;\n\n // final null check (only if requested)\n if (discardNull && isNull(current)) return false;\n\n return true;\n}\n\n/**\n * @internal ***`Not part of the public API.`***\n */\nconst errorMsg = (msg: string) => createMessage(\"hasOwnProp\", msg);\n"],"mappings":";;;;;;;;;;;;;;;AAmRA,SAAgB,WACd,KACA,KACA,UAA+C,CAAC,GACvC;CACT,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC,gBAAgB,GAAG,KAAK,CAAC,WAAW,GAAG,GAAG,OAAO;CAExE,IAAI,CAAC,cAAc,OAAO,GAAG,UAAU,CAAC;CAGxC,MAAM,mBACJ,QAAQ,qBAAqB,SAAY,OAAO,QAAQ;CAC1D,MAAM,cACJ,QAAQ,gBAAgB,SAAY,QAAQ,QAAQ;CAEtD,gBAAgB,kBAAkB,EAChC,UAAU,EAAE,aAAa,gBACvB,SACE,kGAAkG,UAAU,sBAAsB,YAAY,IAChJ,EACJ,CAAC;CAED,gBAAgB,aAAa,EAC3B,UAAU,EAAE,aAAa,gBACvB,SACE,6FAA6F,UAAU,sBAAsB,YAAY,IAC3I,EACJ,CAAC;CAGD,MAAM,OAAqC,CAAC;CAE5C,IACG,SAAS,GAAG,KAAK,IAAI,KAAK,EAAE,SAAS,KACtC,SAAS,KAAK,EAAE,YAAY,KAAK,CAAC,GAGlC,CADe,SAAS,KAAK,EAAE,YAAY,KAAK,CAAC,IAAI,OAAO,GAAG,IAAI,KAC5D,MAAM,GAAG,EAAE,SAAS,MAAM;EAC/B,MAAM,eAAe,EAAE,MAAM,aAAa;EAC1C,MAAM,cAAc,EAAE,MAAM,kBAAkB;EAC9C,IAAI,cAAc,KAAK,KAAK,OAAO,aAAa,EAAE,CAAC;OAC9C,IAAI,aAAa,KAAK,KAAK,OAAO,IAAI,YAAY,EAAE,CAAC;OACrD,IAAI,CAAC,MAAM,OAAO,CAAC,CAAC,GAAG,KAAK,KAAK,OAAO,CAAC,CAAC;OAC1C,KAAK,KAAK,CAAC;CAClB,CAAC;MACI,IAAI,SAAS,GAAG,GACrB,KAAK,KAAK,GAAG;MAEb,OAAO;CAIT,IAAI,UACF,SAAS,GAAG,KAAK,IAAI,KAAK,EAAE,SAAS,IAAI,OAAO,GAAG,IAAI;CACzD,KAAK,MAAM,KAAK,MACd,IACG,SAAS,CAAC,KAAK,EAAE,KAAK,EAAE,SAAS,KAClC,SAAS,GAAG,EAAE,YAAY,KAAK,CAAC,GAChC;EACA,IACE,OAAO,OAAO,KACd,CAAC,OAAO,UAAU,eAAe,KAAK,SAAS,CAAC,GAEhD,OAAO;EAET,UAAW,QAAyC;CACtD,OAAO,IAAI,SAAS,CAAC,GAAG;EACtB,IACE,OAAO,OAAO,KACb,OAAO,YAAY,YAAY,CAAC,WAAW,OAAO,GAEnD,OAAO;EAGT,MAAM,UADU,OAAO,sBAAsB,OACvB,EAAE,MACrB,MAAM,MAAM,KAAK,EAAE,gBAAgB,EAAE,WACxC;EACA,IAAI,CAAC,SAAS,OAAO;EACrB,UAAW,QAAyC;CACtD,OACE,OAAO;CAIX,IAAI,oBAAoB,YAAY,OAAO,GAAG,OAAO;CAGrD,IAAI,eAAe,OAAO,OAAO,GAAG,OAAO;CAE3C,OAAO;AACT;;;;AAKA,MAAM,YAAY,QAAgB,cAAc,cAAc,GAAG"}
|
|
1
|
+
{"version":3,"file":"hasOwnProp-yVVsxPin.js","names":[],"sources":["../src/predicates/has/hasOwnProp.ts"],"sourcesContent":["import type {\n AnyFunction,\n AnyString,\n IsAny,\n IsStringLiteral\n} from \"@rzl-zone/ts-types-plus\";\nimport type {\n DeepRequiredSymbolHasOwnProp,\n GuardedHasOwnProp,\n HasOwnPropOptions,\n NestedKeyOfHasOwnProp,\n SmartDetectArrayFuncHasOwnProp,\n SmartDetectUnknownKeyHasOwnProp,\n NumericKeyHasOwnPropMapped,\n NumericKeyOfHasOwnProp,\n SmartDetectStringHasOwnProp\n} from \"./hasOwnProp.types\";\n\nimport { createMessage } from \"@/_private/logger\";\n\nimport { assertIsBoolean } from \"@/assertions/booleans/assertIsBoolean\";\n\nimport { isNaN } from \"../is/isNaN\";\nimport { isNull } from \"../is/isNull\";\nimport { isString } from \"../is/isString\";\nimport { isNumber } from \"../is/isNumber\";\nimport { isSymbol } from \"../is/isSymbol\";\nimport { isFunction } from \"../is/isFunction\";\nimport { isUndefined } from \"../is/isUndefined\";\nimport { isObjectOrArray } from \"../is/isObjectOrArray\";\nimport { isPlainObject, type IsPlainObjectResult } from \"../is/isPlainObject\";\n\n// ------------------- HAS OWN PROP OVERLOADS -------------------\n\n/** -------------------------------------------------------\n * * ***Type guard: `hasOwnProp`.***\n * --------------------------------------------------------\n * **A **type-safe** replacement for `Object.prototype.hasOwnProperty` with runtime validation and **TypeScript-aware type narrowing**.**\n *\n * ---\n * - #### *Supported Targets:*\n * - **Plain objects** ➔ `{ foo: \"bar\" }`.\n * - **Arrays** ➔ `[ { id: 1 }, { id: 2 } ]`.\n * - **Strings** ➔ `\"hello\"` (as array-like objects with `.length`, index, etc.).\n * - **Functions** ➔ callable objects with extra props.\n * - **Symbols** ➔ own property symbols.\n * ---\n * - #### *Key Advantages over `in` or `obj.hasOwnProperty(key)`:*\n * - Supports **dot/bracket path notation** (e.g. `\"user.address.city\"`, `\"addresses[0].zip\"`).\n * - Handles **symbol** keys safely.\n * - **Narrows** the type of `obj` in TypeScript (stronger type safety).\n * - Configurable handling of **`undefined`** and **`null`**.\n * ---\n * - #### *Runtime Behavior:*\n * - #### Returns `true` if:\n * - Value `obj` is an object/array/string/function **and** the property\n * exists **and**, it passes the `options` checks.\n * ---\n * - #### Returns `false` if:\n * - Value `obj` is not a valid type.\n * - The property does not exist.\n * - The value is `undefined` and `discardUndefined: true` (**default**).\n * - The value is `null` and `discardNull: true`.\n * - The `key` (after trimming) is an **empty string** ➔ treated as **invalid**.\n * ---\n * - #### *TypeScript Behavior:*\n * - #### Inside an `if (hasOwnProp(...)) {}` block:\n * - The property is **guaranteed to exist**.\n * - Depending on `options`, the property type is narrowed to exclude\n * `undefined` and/or `null`.\n * ---\n * - #### *Caveats:*\n * - #### Empty keys are invalid:\n * - If the `key` string is empty (`\"\"`) after trimming whitespace or other characters,\n * it will **not** be considered a valid property and always returns `false`.\n * ---\n * - #### Arrays are limited by TypeScript inference:\n * - Checking index `[0]` only narrows **that specific index**, not the rest, example:\n * 1. `hasOwnProp(users, \"[0].id\")` does **not** imply `users[1].id` exists.\n * - For different indices, use **optional chaining** (`users[1]?.id`).\n * ---\n * - #### Autocomplete limitation for array indices:\n * - Autocompletion for `[index]` is only supported up to **5** (`[0]` ➔ `[4]`).\n * - This limit is intentional for **performance and safety:**\n * 1. Generating infinite union types for all possible indices would cause\n * **TypeScript IntelliSense to hang or crash**.\n * - You can still check higher indices manually (e.g. `\"[999].id\"`),\n * but they will not show up in IntelliSense suggestions.\n *\n * ---\n * @param {HasOwnPropOptions} [options] - ***Optional configuration object.***\n * @param {HasOwnPropOptions[\"discardUndefined\"]} [options.discardUndefined=true]\n * ***If `true`, properties with `undefined` values are treated as **missing**, default: `true`.***\n * @param {HasOwnPropOptions[\"discardNull\"]} [options.discardNull=false]\n * ***If `true`, properties with `null` values are treated as **missing**, default: `false`.***\n * @param {*} obj ***The `object`, `array`, `string`, `function`, or `other value` to check against.***\n * @param {PropertyKey} key\n * ***The property key to check, can be:***\n * - `string` (supports dot/bracket paths, e.g. `\"user.address.city\"`, `\"[0].id\"`).\n * - `number` (array-like index).\n * - `symbol` (own property symbols).\n *\n * ---\n * @returns {boolean} Return `true` if the property exists (and passes `options`), otherwise `false`.\n *\n * ---\n * @example\n *\n * - #### Objects:\n * ```ts\n * const obj: { name?: string | null } = {};\n *\n * if (hasOwnProp(obj, \"name\")) {\n * // obj is now ➔ { name: string | null }\n * console.log(obj.name); // string | null\n * }\n *\n * if (hasOwnProp(obj, \"name\", { discardUndefined: true, discardNull: true })) {\n * // obj is now ➔ { name: string }\n * console.log(obj.name.toUpperCase()); // safe\n * }\n * ```\n * - #### Arrays:\n * ```ts\n * const users = [{ id: 1 }, { id: 2 }];\n *\n * if (hasOwnProp(users, \"[1].id\")) {\n * // ➔ users[1].id is guaranteed to exist\n * console.log(users[1].id); // number\n * }\n *\n * // Caveat: narrowing only applies to checked index\n * if (hasOwnProp(users, \"[0].id\")) {\n * console.log(users[0].id); // safe\n * console.log(users[1].id); // not guaranteed!\n * }\n *\n * // Solution: optional chaining\n * console.log(users[1]?.id);\n * // ➔ safe, even without narrowing\n * ```\n *\n * - #### Symbols:\n * ```ts\n * const secret = Symbol(\"secret\");\n * const obj2 = { [secret]: 42 };\n *\n * if (hasOwnProp(obj2, secret)) {\n * console.log(obj2[secret] + 1);\n * // ➔ 43\n * }\n * ```\n * - #### Strings:\n * ```ts\n * if (hasOwnProp(\"hello\", \"length\")) {\n * console.log(\"hello\".length);\n * // ➔ 5\n * }\n *\n * if (hasOwnProp(\"hello\", 1)) {\n * console.log(\"hello\"[1]);\n * // ➔ \"e\"\n * }\n * ```\n * - #### Functions:\n * ```ts\n * function fn() {}\n * fn.extra = 123;\n *\n * if (hasOwnProp(fn, \"extra\")) {\n * console.log(fn.extra);\n * // ➔ 123\n * }\n * ```\n * - #### Empty key:\n * ```ts\n * const obj = { a: 1 };\n *\n * hasOwnProp(obj, \"\");\n * // ➔ false (invalid key)\n * hasOwnProp(obj, \" \");\n * // ➔ false (trimmed to empty)\n * ```\n */\nexport function hasOwnProp<Obj>(\n obj: IsAny<Obj> extends true ? Obj : never,\n key: PropertyKey,\n options?: HasOwnPropOptions<boolean, boolean>\n /** @ts-expect-error we force `any` to `unknown` at result */\n): obj is unknown;\n\nexport function hasOwnProp<Obj extends null | undefined>(\n obj: Obj,\n key: PropertyKey,\n options?: HasOwnPropOptions<boolean, boolean>\n): false;\n\nexport function hasOwnProp<\n Obj extends object | AnyFunction,\n Key extends NestedKeyOfHasOwnProp<Obj>,\n DiscardUndefined extends boolean = true,\n DiscardNull extends boolean = false\n>(\n obj: Obj | null | undefined,\n key: Key,\n options?: HasOwnPropOptions<DiscardUndefined, DiscardNull>\n /** @ts-expect-error we force to override recursive type result */\n): obj is GuardedHasOwnProp<Obj, Key, DiscardUndefined, DiscardNull>;\n\nexport function hasOwnProp<\n Obj extends object,\n Num extends NumericKeyOfHasOwnProp<Obj>,\n DiscardUndefined extends boolean = true,\n DiscardNull extends boolean = false\n>(\n obj: Obj | null | undefined,\n key: Num,\n options?: HasOwnPropOptions<DiscardUndefined, DiscardNull>\n /** @ts-expect-error we force to override recursive type result */\n): obj is NumericKeyHasOwnPropMapped<Obj, Num, DiscardUndefined, DiscardNull>;\n\nexport function hasOwnProp<\n Obj extends object | AnyFunction,\n Sym extends symbol,\n DiscardUndefined extends boolean = true,\n DiscardNull extends boolean = false\n>(\n obj: Obj | null | undefined,\n key: Sym,\n options?: HasOwnPropOptions<DiscardUndefined, DiscardNull>\n /** @ts-expect-error we force to override recursive type result */\n): obj is DeepRequiredSymbolHasOwnProp<Obj, Sym, DiscardUndefined, DiscardNull>;\n\nexport function hasOwnProp<\n Obj extends string | null | undefined,\n Key extends string | number\n>(\n obj: Obj | null | undefined,\n key: Key,\n options?: HasOwnPropOptions<boolean, boolean>\n /** @ts-expect-error we force to override recursive type result */\n): obj is IsStringLiteral<SmartDetectStringHasOwnProp<Obj, Key>> extends true\n ? AnyString | SmartDetectStringHasOwnProp<Obj, Key>\n : SmartDetectStringHasOwnProp<Obj, Key>;\n\nexport function hasOwnProp<\n Obj extends unknown[] | AnyFunction,\n Key extends PropertyKey\n>(\n obj: Obj,\n key: Key,\n options?: HasOwnPropOptions<boolean, boolean>\n): obj is SmartDetectArrayFuncHasOwnProp<Obj, Key>;\n\nexport function hasOwnProp<\n Obj extends unknown | AnyFunction,\n Key extends PropertyKey,\n DiscardUndefined extends boolean = true,\n DiscardNull extends boolean = false\n>(\n obj: Obj,\n key:\n | Key\n | \"length\"\n | (IsPlainObjectResult<Obj> extends never ? never : keyof Obj),\n options?: HasOwnPropOptions<DiscardUndefined, DiscardNull>\n /** @ts-expect-error we force to override recursive type result */\n): obj is SmartDetectUnknownKeyHasOwnProp<\n Obj,\n Key,\n DiscardUndefined,\n DiscardNull\n>;\n\n// ------------------- IMPLEMENTATION -------------------\nexport function hasOwnProp(\n obj: unknown,\n key: PropertyKey,\n options: HasOwnPropOptions<boolean, boolean> = {}\n): unknown {\n if (!isString(obj) && !isObjectOrArray(obj) && !isFunction(obj)) return false;\n\n if (!isPlainObject(options)) options = {};\n\n // defaults: undef ➔ true, null ➔ false\n const discardUndefined =\n options.discardUndefined === undefined ? true : options.discardUndefined;\n const discardNull =\n options.discardNull === undefined ? false : options.discardNull;\n\n assertIsBoolean(discardUndefined, {\n message: ({ currentType, validType }) =>\n errorMsg(\n `Parameter \\`discardUndefined\\` property of the \\`options\\` (third parameter) must be of type \\`${validType}\\`, but received: \\`${currentType}\\`.`\n )\n });\n\n assertIsBoolean(discardNull, {\n message: ({ currentType, validType }) =>\n errorMsg(\n `Parameter \\`discardNull\\` property of the \\`options\\` (third parameter) must be of type \\`${validType}\\`, but received: \\`${currentType}\\`.`\n )\n });\n\n // Parse key ➔ path\n const path: (string | number | symbol)[] = [];\n //todo: keep use manually check for length string value for avoid Maximum infinity loop function.!!!\n if (\n (isString(key) && key.trim().length > 0) ||\n isNumber(key, { includeNaN: true })\n ) {\n const strKey = isNumber(key, { includeNaN: true }) ? String(key) : key;\n strKey.split(\".\").forEach((k) => {\n const bracketMatch = k.match(/^\\[(\\d+)\\]$/);\n const symbolMatch = k.match(/^Symbol\\((.+)\\)$/);\n if (bracketMatch) path.push(Number(bracketMatch[1]));\n else if (symbolMatch) path.push(Symbol.for(symbolMatch[1]));\n else if (!isNaN(Number(k))) path.push(Number(k));\n else path.push(k);\n });\n } else if (isSymbol(key)) {\n path.push(key);\n } else {\n return false;\n }\n\n // Traverse\n let current: unknown =\n isString(obj) && obj.trim().length > 0 ? Object(obj) : obj;\n for (const k of path) {\n if (\n (isString(k) && k.trim().length > 0) ||\n isNumber(k, { includeNaN: true })\n ) {\n if (\n isNull(current) ||\n !Object.prototype.hasOwnProperty.call(current, k)\n ) {\n return false;\n }\n current = (current as Record<PropertyKey, unknown>)[k];\n } else if (isSymbol(k)) {\n if (\n isNull(current) ||\n (typeof current !== \"object\" && !isFunction(current))\n ) {\n return false;\n }\n const symbols = Object.getOwnPropertySymbols(current);\n const matched = symbols.find(\n (s) => s === k || s.description === k.description\n );\n if (!matched) return false;\n current = (current as Record<PropertyKey, unknown>)[matched];\n } else {\n return false;\n }\n }\n // early fail for undefined if requested\n if (discardUndefined && isUndefined(current)) return false;\n\n // final null check (only if requested)\n if (discardNull && isNull(current)) return false;\n\n return true;\n}\n\n/**\n * @internal ***`Not part of the public API.`***\n */\nconst errorMsg = (msg: string) => createMessage(\"hasOwnProp\", msg);\n"],"mappings":";;;;;;;;;;;;;;;AAmRA,SAAgB,WACd,KACA,KACA,UAA+C,CAAC,GACvC;CACT,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC,gBAAgB,GAAG,KAAK,CAAC,WAAW,GAAG,GAAG,OAAO;CAExE,IAAI,CAAC,cAAc,OAAO,GAAG,UAAU,CAAC;CAGxC,MAAM,mBACJ,QAAQ,qBAAqB,SAAY,OAAO,QAAQ;CAC1D,MAAM,cACJ,QAAQ,gBAAgB,SAAY,QAAQ,QAAQ;CAEtD,gBAAgB,kBAAkB,EAChC,UAAU,EAAE,aAAa,gBACvB,SACE,kGAAkG,UAAU,sBAAsB,YAAY,IAChJ,EACJ,CAAC;CAED,gBAAgB,aAAa,EAC3B,UAAU,EAAE,aAAa,gBACvB,SACE,6FAA6F,UAAU,sBAAsB,YAAY,IAC3I,EACJ,CAAC;CAGD,MAAM,OAAqC,CAAC;CAE5C,IACG,SAAS,GAAG,KAAK,IAAI,KAAK,EAAE,SAAS,KACtC,SAAS,KAAK,EAAE,YAAY,KAAK,CAAC,GAGlC,CADe,SAAS,KAAK,EAAE,YAAY,KAAK,CAAC,IAAI,OAAO,GAAG,IAAI,KAC5D,MAAM,GAAG,EAAE,SAAS,MAAM;EAC/B,MAAM,eAAe,EAAE,MAAM,aAAa;EAC1C,MAAM,cAAc,EAAE,MAAM,kBAAkB;EAC9C,IAAI,cAAc,KAAK,KAAK,OAAO,aAAa,EAAE,CAAC;OAC9C,IAAI,aAAa,KAAK,KAAK,OAAO,IAAI,YAAY,EAAE,CAAC;OACrD,IAAI,CAAC,MAAM,OAAO,CAAC,CAAC,GAAG,KAAK,KAAK,OAAO,CAAC,CAAC;OAC1C,KAAK,KAAK,CAAC;CAClB,CAAC;MACI,IAAI,SAAS,GAAG,GACrB,KAAK,KAAK,GAAG;MAEb,OAAO;CAIT,IAAI,UACF,SAAS,GAAG,KAAK,IAAI,KAAK,EAAE,SAAS,IAAI,OAAO,GAAG,IAAI;CACzD,KAAK,MAAM,KAAK,MACd,IACG,SAAS,CAAC,KAAK,EAAE,KAAK,EAAE,SAAS,KAClC,SAAS,GAAG,EAAE,YAAY,KAAK,CAAC,GAChC;EACA,IACE,OAAO,OAAO,KACd,CAAC,OAAO,UAAU,eAAe,KAAK,SAAS,CAAC,GAEhD,OAAO;EAET,UAAW,QAAyC;CACtD,OAAO,IAAI,SAAS,CAAC,GAAG;EACtB,IACE,OAAO,OAAO,KACb,OAAO,YAAY,YAAY,CAAC,WAAW,OAAO,GAEnD,OAAO;EAGT,MAAM,UADU,OAAO,sBAAsB,OACvB,EAAE,MACrB,MAAM,MAAM,KAAK,EAAE,gBAAgB,EAAE,WACxC;EACA,IAAI,CAAC,SAAS,OAAO;EACrB,UAAW,QAAyC;CACtD,OACE,OAAO;CAIX,IAAI,oBAAoB,YAAY,OAAO,GAAG,OAAO;CAGrD,IAAI,eAAe,OAAO,OAAO,GAAG,OAAO;CAE3C,OAAO;AACT;;;;AAKA,MAAM,YAAY,QAAgB,cAAc,cAAc,GAAG"}
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
* ========================================================================
|
|
3
3
|
* @rzl-zone/utils-js
|
|
4
4
|
* ------------------------------------------------------------------------
|
|
5
|
-
* Version: `3.14.0
|
|
5
|
+
* Version: `3.14.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
|
|
|
11
|
-
import { M as PickStrict, N as Prettify } from "./index-
|
|
12
|
-
import { a as IsNumberOptions, c as GetPreciseTypeOptions, i as ArrayFallback, t as IsPlainObjectResult } from "./isPlainObject-
|
|
11
|
+
import { M as PickStrict, N as Prettify } from "./index-or0oP9i2.cjs";
|
|
12
|
+
import { a as IsNumberOptions, c as GetPreciseTypeOptions, i as ArrayFallback, t as IsPlainObjectResult } from "./isPlainObject-Y__iykWN.cjs";
|
|
13
13
|
/** -----------------------------------------------------------------------------
|
|
14
14
|
* * ***Shape of the object passed to custom error message functions.***
|
|
15
15
|
* ------------------------------------------------------------------------------
|
|
@@ -2,15 +2,15 @@
|
|
|
2
2
|
* ========================================================================
|
|
3
3
|
* @rzl-zone/utils-js
|
|
4
4
|
* ------------------------------------------------------------------------
|
|
5
|
-
* Version: `3.14.0
|
|
5
|
+
* Version: `3.14.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
|
|
|
11
|
-
import { A as OverrideTypes, N as Prettify, O as OmitStrict, c as ExtractStrict, i as AnyString } from "./index-
|
|
12
|
-
import { FormatOptions, Locale } from "date-fns";
|
|
11
|
+
import { A as OverrideTypes, N as Prettify, O as OmitStrict, c as ExtractStrict, i as AnyString } from "./index-or0oP9i2.cjs";
|
|
13
12
|
import { CountryCode, NumberFormat } from "libphonenumber-js";
|
|
13
|
+
import { FormatOptions, Locale } from "date-fns";
|
|
14
14
|
type NegativeFormatOptionCustom = {
|
|
15
15
|
/**
|
|
16
16
|
* * ***Custom formatter function for the final formatted negative string, if provided, it ***OVERRIDES*** style & space entirely.***
|
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
* ========================================================================
|
|
3
3
|
* @rzl-zone/utils-js
|
|
4
4
|
* ------------------------------------------------------------------------
|
|
5
|
-
* Version: `3.14.0
|
|
5
|
+
* Version: `3.14.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
|
|
|
11
|
-
import { D as NumberRangeUnion, E as Nullish, L as TypedArray, N as Prettify, P as RemoveEmptyArrayElements, R as WebApiObjects, b as KeepNull, f as IfNotExtends, k as OrArr, l as FixNeverArrayRecursive, m as IsAny, n as AndArr, p as IntlObjects, r as AnyFunction, s as Extends, u as IfExtends, w as NormalizeEmptyArraysRecursive, x as KeepUndef } from "./index-
|
|
11
|
+
import { D as NumberRangeUnion, E as Nullish, L as TypedArray, N as Prettify, P as RemoveEmptyArrayElements, R as WebApiObjects, b as KeepNull, f as IfNotExtends, k as OrArr, l as FixNeverArrayRecursive, m as IsAny, n as AndArr, p as IntlObjects, r as AnyFunction, s as Extends, u as IfExtends, w as NormalizeEmptyArraysRecursive, x as KeepUndef } from "./index-or0oP9i2.js";
|
|
12
12
|
type NormalizeInputToNumberArrayUnRecursive<T> = T extends string | bigint | boolean | number | Nullish ? T : HasNonNumberLikeNonNullish<T>;
|
|
13
13
|
/** Detects whether `T` contains any number-like type (`string | number | bigint`).
|
|
14
14
|
*
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
* ========================================================================
|
|
3
3
|
* @rzl-zone/utils-js
|
|
4
4
|
* ------------------------------------------------------------------------
|
|
5
|
-
* Version: `3.14.0
|
|
5
|
+
* Version: `3.14.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
|
|
|
11
|
-
import { D as NumberRangeUnion, I as Trim, L as TypedArray, N as Prettify, _ as IsNever, a as CharAt, g as IsEmptyString, h as IsArray, i as AnyString, j as ParseNumber, k as OrArr, m as IsAny, r as AnyFunction, s as Extends, t as AnObjectNonArray, v as IsPositive, y as IsStringLiteral } from "./index-
|
|
12
|
-
import { i as ArrayFallback, r as IsHasKeysObject, t as IsPlainObjectResult } from "./isPlainObject-
|
|
11
|
+
import { D as NumberRangeUnion, I as Trim, L as TypedArray, N as Prettify, _ as IsNever, a as CharAt, g as IsEmptyString, h as IsArray, i as AnyString, j as ParseNumber, k as OrArr, m as IsAny, r as AnyFunction, s as Extends, t as AnObjectNonArray, v as IsPositive, y as IsStringLiteral } from "./index-or0oP9i2.js";
|
|
12
|
+
import { i as ArrayFallback, r as IsHasKeysObject, t as IsPlainObjectResult } from "./isPlainObject-DQoM4DGQ.js";
|
|
13
13
|
/** ----------------------------------------------------------
|
|
14
14
|
* * ***Predicate: `areArraysEqual`.***
|
|
15
15
|
* -----------------------------------------------------------
|
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
* ========================================================================
|
|
3
3
|
* @rzl-zone/utils-js
|
|
4
4
|
* ------------------------------------------------------------------------
|
|
5
|
-
* Version: `3.14.0
|
|
5
|
+
* Version: `3.14.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
|
|
|
11
|
-
import { S as Nilable, s as Extends } from "./index-
|
|
11
|
+
import { S as Nilable, s as Extends } from "./index-or0oP9i2.js";
|
|
12
12
|
type CapitalizeFirstOptions = {
|
|
13
13
|
/** If true **(default)**, the rest of the string will be converted to lowercase after capitalizing the first letter.
|
|
14
14
|
*
|
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
* ========================================================================
|
|
3
3
|
* @rzl-zone/utils-js
|
|
4
4
|
* ------------------------------------------------------------------------
|
|
5
|
-
* Version: `3.14.0
|
|
5
|
+
* Version: `3.14.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
|
|
|
11
|
-
import { S as Nilable, s as Extends } from "./index-
|
|
11
|
+
import { S as Nilable, s as Extends } from "./index-or0oP9i2.cjs";
|
|
12
12
|
type CapitalizeFirstOptions = {
|
|
13
13
|
/** If true **(default)**, the rest of the string will be converted to lowercase after capitalizing the first letter.
|
|
14
14
|
*
|
|
@@ -2,15 +2,15 @@
|
|
|
2
2
|
* ========================================================================
|
|
3
3
|
* @rzl-zone/utils-js
|
|
4
4
|
* ------------------------------------------------------------------------
|
|
5
|
-
* Version: `3.14.0
|
|
5
|
+
* Version: `3.14.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
|
|
|
11
|
-
import { A as OverrideTypes, N as Prettify, O as OmitStrict, c as ExtractStrict, i as AnyString } from "./index-
|
|
12
|
-
import { CountryCode, NumberFormat } from "libphonenumber-js";
|
|
11
|
+
import { A as OverrideTypes, N as Prettify, O as OmitStrict, c as ExtractStrict, i as AnyString } from "./index-or0oP9i2.js";
|
|
13
12
|
import { FormatOptions, Locale } from "date-fns";
|
|
13
|
+
import { CountryCode, NumberFormat } from "libphonenumber-js";
|
|
14
14
|
type NegativeFormatOptionCustom = {
|
|
15
15
|
/**
|
|
16
16
|
* * ***Custom formatter function for the final formatted negative string, if provided, it ***OVERRIDES*** style & space entirely.***
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
* ========================================================================
|
|
3
3
|
* @rzl-zone/utils-js
|
|
4
4
|
* ------------------------------------------------------------------------
|
|
5
|
-
* Version: `3.14.0
|
|
5
|
+
* Version: `3.14.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
|
|
|
11
|
-
import { M as PickStrict, N as Prettify } from "./index-
|
|
12
|
-
import { a as IsNumberOptions, c as GetPreciseTypeOptions, i as ArrayFallback, t as IsPlainObjectResult } from "./isPlainObject-
|
|
11
|
+
import { M as PickStrict, N as Prettify } from "./index-or0oP9i2.js";
|
|
12
|
+
import { a as IsNumberOptions, c as GetPreciseTypeOptions, i as ArrayFallback, t as IsPlainObjectResult } from "./isPlainObject-DQoM4DGQ.js";
|
|
13
13
|
/** -----------------------------------------------------------------------------
|
|
14
14
|
* * ***Shape of the object passed to custom error message functions.***
|
|
15
15
|
* ------------------------------------------------------------------------------
|
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
* ========================================================================
|
|
3
3
|
* @rzl-zone/utils-js
|
|
4
4
|
* ------------------------------------------------------------------------
|
|
5
|
-
* Version: `3.14.0
|
|
5
|
+
* Version: `3.14.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
|
|
|
11
|
-
import { F as Stringify } from "./index-
|
|
11
|
+
import { F as Stringify } from "./index-or0oP9i2.js";
|
|
12
12
|
import { ClassNameValue, ConfigExtension } from "tailwind-merge-v2";
|
|
13
13
|
import { ClassNameValue as ClassNameValue$1, ConfigExtension as ConfigExtension$1 } from "tailwind-merge-v3";
|
|
14
14
|
import { Config } from "tailwindcss";
|
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
* ========================================================================
|
|
3
3
|
* @rzl-zone/utils-js
|
|
4
4
|
* ------------------------------------------------------------------------
|
|
5
|
-
* Version: `3.14.0
|
|
5
|
+
* Version: `3.14.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
|
|
|
11
|
-
import { T as NullToUndefined, d as IfNonEmptyArray, l as FixNeverArrayRecursive, s as Extends } from "./index-
|
|
11
|
+
import { T as NullToUndefined, d as IfNonEmptyArray, l as FixNeverArrayRecursive, s as Extends } from "./index-or0oP9i2.cjs";
|
|
12
12
|
/** -------------------------------------------------------------------------------------
|
|
13
13
|
* * ***Utility: `getRandomItem`.***
|
|
14
14
|
* --------------------------------------------------------------------------------------
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
* ========================================================================
|
|
3
3
|
* @rzl-zone/utils-js
|
|
4
4
|
* ------------------------------------------------------------------------
|
|
5
|
-
* Version: `3.14.0
|
|
5
|
+
* Version: `3.14.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
|
|
|
11
|
-
import { D as NumberRangeUnion, I as Trim, L as TypedArray, N as Prettify, _ as IsNever, a as CharAt, g as IsEmptyString, h as IsArray, i as AnyString, j as ParseNumber, k as OrArr, m as IsAny, r as AnyFunction, s as Extends, t as AnObjectNonArray, v as IsPositive, y as IsStringLiteral } from "./index-
|
|
12
|
-
import { i as ArrayFallback, r as IsHasKeysObject, t as IsPlainObjectResult } from "./isPlainObject-
|
|
11
|
+
import { D as NumberRangeUnion, I as Trim, L as TypedArray, N as Prettify, _ as IsNever, a as CharAt, g as IsEmptyString, h as IsArray, i as AnyString, j as ParseNumber, k as OrArr, m as IsAny, r as AnyFunction, s as Extends, t as AnObjectNonArray, v as IsPositive, y as IsStringLiteral } from "./index-or0oP9i2.cjs";
|
|
12
|
+
import { i as ArrayFallback, r as IsHasKeysObject, t as IsPlainObjectResult } from "./isPlainObject-Y__iykWN.cjs";
|
|
13
13
|
/** ----------------------------------------------------------
|
|
14
14
|
* * ***Predicate: `areArraysEqual`.***
|
|
15
15
|
* -----------------------------------------------------------
|
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
* ========================================================================
|
|
3
3
|
* @rzl-zone/utils-js
|
|
4
4
|
* ------------------------------------------------------------------------
|
|
5
|
-
* Version: `3.14.0
|
|
5
|
+
* Version: `3.14.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
|
|
|
11
|
-
import { T as NullToUndefined, d as IfNonEmptyArray, l as FixNeverArrayRecursive, s as Extends } from "./index-
|
|
11
|
+
import { T as NullToUndefined, d as IfNonEmptyArray, l as FixNeverArrayRecursive, s as Extends } from "./index-or0oP9i2.js";
|
|
12
12
|
/** -------------------------------------------------------------------------------------
|
|
13
13
|
* * ***Utility: `getRandomItem`.***
|
|
14
14
|
* --------------------------------------------------------------------------------------
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* ========================================================================
|
|
3
3
|
* @rzl-zone/utils-js
|
|
4
4
|
* ------------------------------------------------------------------------
|
|
5
|
-
* Version: `3.14.0
|
|
5
|
+
* Version: `3.14.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
|
* ========================================================================
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
* ========================================================================
|
|
12
12
|
* @rzl-zone/ts-types-plus
|
|
13
13
|
* ------------------------------------------------------------------------
|
|
14
|
-
* Version: `0.1.8
|
|
14
|
+
* Version: `0.1.8`
|
|
15
15
|
* Author: `Rizalvin Dwiky <rizalvindwiky1998@gmail.com>`
|
|
16
16
|
* Repository: `https://github.com/rzl-zone/rzl-zone/tree/main/packages/ts-types-plus`
|
|
17
17
|
* ========================================================================
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* ========================================================================
|
|
3
3
|
* @rzl-zone/utils-js
|
|
4
4
|
* ------------------------------------------------------------------------
|
|
5
|
-
* Version: `3.14.0
|
|
5
|
+
* Version: `3.14.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
|
* ========================================================================
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
* ========================================================================
|
|
12
12
|
* @rzl-zone/ts-types-plus
|
|
13
13
|
* ------------------------------------------------------------------------
|
|
14
|
-
* Version: `0.1.8
|
|
14
|
+
* Version: `0.1.8`
|
|
15
15
|
* Author: `Rizalvin Dwiky <rizalvindwiky1998@gmail.com>`
|
|
16
16
|
* Repository: `https://github.com/rzl-zone/rzl-zone/tree/main/packages/ts-types-plus`
|
|
17
17
|
* ========================================================================
|
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
* ========================================================================
|
|
3
3
|
* @rzl-zone/utils-js
|
|
4
4
|
* ------------------------------------------------------------------------
|
|
5
|
-
* Version: `3.14.0
|
|
5
|
+
* Version: `3.14.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
|
|
|
11
|
-
import { F as Stringify } from "./index-
|
|
11
|
+
import { F as Stringify } from "./index-or0oP9i2.cjs";
|
|
12
12
|
import { Config } from "tailwindcss";
|
|
13
13
|
import { ClassNameValue, ConfigExtension } from "tailwind-merge-v2";
|
|
14
14
|
import { ClassNameValue as ClassNameValue$1, ConfigExtension as ConfigExtension$1 } from "tailwind-merge-v3";
|
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
* ========================================================================
|
|
3
3
|
* @rzl-zone/utils-js
|
|
4
4
|
* ------------------------------------------------------------------------
|
|
5
|
-
* Version: `3.14.0
|
|
5
|
+
* Version: `3.14.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
|
|
|
11
|
-
import { D as NumberRangeUnion, E as Nullish, L as TypedArray, N as Prettify, P as RemoveEmptyArrayElements, R as WebApiObjects, b as KeepNull, f as IfNotExtends, k as OrArr, l as FixNeverArrayRecursive, m as IsAny, n as AndArr, p as IntlObjects, r as AnyFunction, s as Extends, u as IfExtends, w as NormalizeEmptyArraysRecursive, x as KeepUndef } from "./index-
|
|
11
|
+
import { D as NumberRangeUnion, E as Nullish, L as TypedArray, N as Prettify, P as RemoveEmptyArrayElements, R as WebApiObjects, b as KeepNull, f as IfNotExtends, k as OrArr, l as FixNeverArrayRecursive, m as IsAny, n as AndArr, p as IntlObjects, r as AnyFunction, s as Extends, u as IfExtends, w as NormalizeEmptyArraysRecursive, x as KeepUndef } from "./index-or0oP9i2.cjs";
|
|
12
12
|
type NormalizeInputToNumberArrayUnRecursive<T> = T extends string | bigint | boolean | number | Nullish ? T : HasNonNumberLikeNonNullish<T>;
|
|
13
13
|
/** Detects whether `T` contains any number-like type (`string | number | bigint`).
|
|
14
14
|
*
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* ========================================================================
|
|
3
3
|
* @rzl-zone/utils-js
|
|
4
4
|
* ------------------------------------------------------------------------
|
|
5
|
-
* Version: `3.14.0
|
|
5
|
+
* Version: `3.14.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
|
* ========================================================================
|
|
@@ -11,4 +11,4 @@ const isBigInt = (value) => {
|
|
|
11
11
|
return typeof value === "bigint";
|
|
12
12
|
};
|
|
13
13
|
export { isBigInt as t };
|
|
14
|
-
//# sourceMappingURL=isBigInt-
|
|
14
|
+
//# sourceMappingURL=isBigInt-DdFRCpeE.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isBigInt-
|
|
1
|
+
{"version":3,"file":"isBigInt-DdFRCpeE.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 *\n * ---\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 *\n * ---\n * @param {*} value - The value to check.\n *\n * ---\n * @returns {boolean} Return `true` if value is a primitive bigint.\n *\n * ---\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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6BA,MAAa,YAAY,UAAoC;CAC3D,OAAO,OAAO,UAAU;AAC1B"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* ========================================================================
|
|
3
3
|
* @rzl-zone/utils-js
|
|
4
4
|
* ------------------------------------------------------------------------
|
|
5
|
-
* Version: `3.14.0
|
|
5
|
+
* Version: `3.14.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
|
* ========================================================================
|
|
@@ -17,4 +17,4 @@ Object.defineProperty(exports, 'isBigInt', {
|
|
|
17
17
|
return isBigInt;
|
|
18
18
|
}
|
|
19
19
|
});
|
|
20
|
-
//# sourceMappingURL=isBigInt-
|
|
20
|
+
//# sourceMappingURL=isBigInt-LkCpVJ3E.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isBigInt-
|
|
1
|
+
{"version":3,"file":"isBigInt-LkCpVJ3E.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 *\n * ---\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 *\n * ---\n * @param {*} value - The value to check.\n *\n * ---\n * @returns {boolean} Return `true` if value is a primitive bigint.\n *\n * ---\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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6BA,MAAa,YAAY,UAAoC;CAC3D,OAAO,OAAO,UAAU;AAC1B"}
|