@rzl-zone/utils-js 3.12.1-beta.0 → 3.13.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +15 -35
- package/dist/.references/index.d.cts +1 -3
- package/dist/.references/index.d.ts +1 -3
- package/dist/{assertIsArray-BfAbIUfa.js → assertIsArray-6BcSdNa-.js} +3 -3
- package/dist/{assertIsArray-BfAbIUfa.js.map → assertIsArray-6BcSdNa-.js.map} +1 -1
- package/dist/{assertIsArray-BChqwPiP.cjs → assertIsArray-BqjMoan3.cjs} +3 -3
- package/dist/{assertIsArray-BChqwPiP.cjs.map → assertIsArray-BqjMoan3.cjs.map} +1 -1
- package/dist/{assertIsBoolean-BlBct0Fc.js → assertIsBoolean-Bv6gL-xe.js} +8 -8
- package/dist/assertIsBoolean-Bv6gL-xe.js.map +1 -0
- package/dist/{assertIsBoolean-DozdtbNi.cjs → assertIsBoolean-amRiJHnh.cjs} +8 -8
- package/dist/assertIsBoolean-amRiJHnh.cjs.map +1 -0
- package/dist/{assertIsString-DqV9NwbI.js → assertIsString-1WiUjgqf.js} +3 -3
- package/dist/{assertIsString-DqV9NwbI.js.map → assertIsString-1WiUjgqf.js.map} +1 -1
- package/dist/{assertIsString-Bvk7bUL7.cjs → assertIsString-C0b28AU1.cjs} +3 -3
- package/dist/{assertIsString-Bvk7bUL7.cjs.map → assertIsString-C0b28AU1.cjs.map} +1 -1
- package/dist/assertions/index.cjs +5 -5
- package/dist/assertions/index.d.cts +2 -2
- package/dist/assertions/index.d.ts +2 -2
- package/dist/assertions/index.js +5 -5
- 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-EMJa3g-D.js → conversions-BrI0GIOr.js} +16 -18
- package/dist/conversions-BrI0GIOr.js.map +1 -0
- package/dist/{conversions-CBs8-REq.cjs → conversions-lvvAYiZs.cjs} +16 -18
- package/dist/conversions-lvvAYiZs.cjs.map +1 -0
- package/dist/events/index.cjs +4 -4
- package/dist/events/index.cjs.map +1 -1
- package/dist/events/index.d.cts +153 -151
- package/dist/events/index.d.ts +153 -151
- package/dist/events/index.js +4 -4
- package/dist/events/index.js.map +1 -1
- 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-lAYgA11L.cjs → formatters-DQr05EUA.cjs} +17 -15
- package/dist/formatters-DQr05EUA.cjs.map +1 -0
- package/dist/{formatters-QcZO_Cpx.js → formatters-zDzQvtb4.js} +17 -15
- package/dist/formatters-zDzQvtb4.js.map +1 -0
- package/dist/generators/index.cjs +12 -8
- package/dist/generators/index.cjs.map +1 -1
- package/dist/generators/index.d.cts +2 -2
- package/dist/generators/index.d.ts +2 -2
- package/dist/generators/index.js +12 -8
- package/dist/generators/index.js.map +1 -1
- package/dist/index-3jBnthag.d.cts +340 -0
- package/dist/index-BXwimNPA.d.cts +2361 -0
- package/dist/index-BlTCrSyc.d.cts +2158 -0
- package/dist/index-CEm8ZOvj.d.ts +2158 -0
- package/dist/index-CLq5kZmQ.d.cts +822 -0
- package/dist/index-Ckao53JY.d.ts +2361 -0
- package/dist/index-DHHrLc0B.d.ts +947 -0
- package/dist/index-DIeR8qa-.d.ts +340 -0
- package/dist/index-DxZlGbAH.d.ts +1716 -0
- package/dist/index-DyVWeYP3.d.cts +765 -0
- package/dist/index-GSUN6rjA.d.ts +822 -0
- package/dist/index-_dJhBl1h.d.ts +765 -0
- package/dist/index-bMa-0Yr4.d.cts +1716 -0
- package/dist/index-z_uCh5KW.d.cts +947 -0
- package/dist/{isBigInt-B1cijjqm.cjs → isBigInt-CIFRnsdx.cjs} +2 -2
- package/dist/{isBigInt-B1cijjqm.cjs.map → isBigInt-CIFRnsdx.cjs.map} +1 -1
- package/dist/{isBigInt-C0bN0Rhu.js → isBigInt-D-Pu9sxp.js} +2 -2
- package/dist/{isBigInt-C0bN0Rhu.js.map → isBigInt-D-Pu9sxp.js.map} +1 -1
- package/dist/{isEmptyObject-DI42NEo0.cjs → isEmptyObject-CEySmyHK.cjs} +3 -3
- package/dist/{isEmptyObject-DI42NEo0.cjs.map → isEmptyObject-CEySmyHK.cjs.map} +1 -1
- package/dist/{isEmptyObject-DeLVIJpl.js → isEmptyObject-CZ9DLi7R.js} +3 -3
- package/dist/{isEmptyObject-DeLVIJpl.js.map → isEmptyObject-CZ9DLi7R.js.map} +1 -1
- package/dist/{isEmptyString-BTUWYTbw.js → isEmptyString-DFDtBbNr.js} +3 -3
- package/dist/{isEmptyString-BTUWYTbw.js.map → isEmptyString-DFDtBbNr.js.map} +1 -1
- package/dist/{isEmptyString-CCK3bP74.cjs → isEmptyString-DI64RQCy.cjs} +3 -3
- package/dist/{isEmptyString-CCK3bP74.cjs.map → isEmptyString-DI64RQCy.cjs.map} +1 -1
- package/dist/{isEmptyValue-DMSMFTU8.cjs → isEmptyValue-Cw6ovu7z.cjs} +5 -5
- package/dist/{isEmptyValue-DMSMFTU8.cjs.map → isEmptyValue-Cw6ovu7z.cjs.map} +1 -1
- package/dist/{isEmptyValue-fjnfQnt5.js → isEmptyValue-aGyeClwA.js} +5 -5
- package/dist/{isEmptyValue-fjnfQnt5.js.map → isEmptyValue-aGyeClwA.js.map} +1 -1
- package/dist/{isEqual-DhyP8fB_.js → isEqual-Dtb2sXUv.js} +4 -4
- package/dist/{isEqual-DhyP8fB_.js.map → isEqual-Dtb2sXUv.js.map} +1 -1
- package/dist/{isEqual-B1fRgEuU.cjs → isEqual-UsvOwrlY.cjs} +4 -4
- package/dist/{isEqual-B1fRgEuU.cjs.map → isEqual-UsvOwrlY.cjs.map} +1 -1
- package/dist/{isFinite-BYMOo0os.js → isFinite-Cz_IFXuV.js} +3 -3
- package/dist/{isFinite-BYMOo0os.js.map → isFinite-Cz_IFXuV.js.map} +1 -1
- package/dist/{isFinite-sFkps2TY.cjs → isFinite-uukWvxJh.cjs} +3 -3
- package/dist/{isFinite-sFkps2TY.cjs.map → isFinite-uukWvxJh.cjs.map} +1 -1
- package/dist/{isInteger-FTCthMre.cjs → isInteger-DPYjliLZ.cjs} +2 -2
- package/dist/{isInteger-FTCthMre.cjs.map → isInteger-DPYjliLZ.cjs.map} +1 -1
- package/dist/{isInteger-DS9V7l_f.js → isInteger-DZ163OQg.js} +2 -2
- package/dist/{isInteger-DS9V7l_f.js.map → isInteger-DZ163OQg.js.map} +1 -1
- package/dist/isPlainObject-CBABRyEX.d.cts +339 -0
- package/dist/isPlainObject-Dr8gi89U.d.ts +339 -0
- package/dist/{isServer-D1TXfOs3.js → isServer-BDShLyVJ.js} +2 -2
- package/dist/{isServer-D1TXfOs3.js.map → isServer-BDShLyVJ.js.map} +1 -1
- package/dist/{isServer-q-QLFCqE.cjs → isServer-BzDeYuGg.cjs} +2 -2
- package/dist/{isServer-q-QLFCqE.cjs.map → isServer-BzDeYuGg.cjs.map} +1 -1
- package/dist/{isTypedArray-DiCoqffZ.cjs → isTypedArray-DaYAkyrt.cjs} +3 -3
- package/dist/{isTypedArray-DiCoqffZ.cjs.map → isTypedArray-DaYAkyrt.cjs.map} +1 -1
- package/dist/{isTypedArray-47R0wdrc.js → isTypedArray-DuUUA4CL.js} +3 -3
- package/dist/{isTypedArray-47R0wdrc.js.map → isTypedArray-DuUUA4CL.js.map} +1 -1
- package/dist/{isValidDomain-BSXshgkC.cjs → isValidDomain-BxyToAlh.cjs} +74 -8
- package/dist/isValidDomain-BxyToAlh.cjs.map +1 -0
- package/dist/{isValidDomain-DwA2EN79.js → isValidDomain-CTw5vZFY.js} +57 -9
- package/dist/isValidDomain-CTw5vZFY.js.map +1 -0
- package/dist/{noop-B2mTBhW-.cjs → noop-7KrqC9DC.cjs} +2 -2
- package/dist/{noop-B2mTBhW-.cjs.map → noop-7KrqC9DC.cjs.map} +1 -1
- package/dist/{noop-BzktGBVz.js → noop-DGg9vMSD.js} +2 -2
- package/dist/{noop-BzktGBVz.js.map → noop-DGg9vMSD.js.map} +1 -1
- package/dist/{normalizeSpaces-DQHR3Tlr.cjs → normalizeSpaces-B6ZQOZRX.cjs} +3 -3
- package/dist/{normalizeSpaces-DQHR3Tlr.cjs.map → normalizeSpaces-B6ZQOZRX.cjs.map} +1 -1
- package/dist/{normalizeSpaces-WS_iERJk.js → normalizeSpaces-C1eLwykD.js} +3 -3
- package/dist/{normalizeSpaces-WS_iERJk.js.map → normalizeSpaces-C1eLwykD.js.map} +1 -1
- package/dist/operations/index.cjs +10 -10
- package/dist/operations/index.cjs.map +1 -1
- package/dist/operations/index.d.cts +120 -120
- package/dist/operations/index.d.ts +120 -120
- package/dist/operations/index.js +10 -10
- package/dist/operations/index.js.map +1 -1
- package/dist/parsers/index.cjs +2 -2
- package/dist/parsers/index.d.cts +222 -222
- package/dist/parsers/index.d.ts +222 -222
- package/dist/parsers/index.js +2 -2
- package/dist/{parsers-DXtpsDyj.cjs → parsers-DEFpCYhw.cjs} +4 -4
- package/dist/{parsers-DXtpsDyj.cjs.map → parsers-DEFpCYhw.cjs.map} +1 -1
- package/dist/{parsers-Dpuq-V4u.js → parsers-bQQ9mStV.js} +4 -4
- package/dist/{parsers-Dpuq-V4u.js.map → parsers-bQQ9mStV.js.map} +1 -1
- package/dist/{parsing-B43x1sxn.js → parsing-BngARhmu.js} +3 -3
- package/dist/{parsing-B43x1sxn.js.map → parsing-BngARhmu.js.map} +1 -1
- package/dist/{parsing-lRoxn1Nz.cjs → parsing-lI5EN4LY.cjs} +3 -3
- package/dist/{parsing-lRoxn1Nz.cjs.map → parsing-lI5EN4LY.cjs.map} +1 -1
- package/dist/predicates/index.cjs +15 -16
- package/dist/predicates/index.d.cts +3 -3
- package/dist/predicates/index.d.ts +3 -3
- package/dist/predicates/index.js +14 -15
- package/dist/{predicates-DiaYA7Ps.cjs → predicates-CMmP3fPJ.cjs} +15 -16
- package/dist/{predicates-DiaYA7Ps.cjs.map → predicates-CMmP3fPJ.cjs.map} +1 -1
- package/dist/{predicates-gNepszvo.js → predicates-V87QD8hs.js} +13 -14
- package/dist/{predicates-gNepszvo.js.map → predicates-V87QD8hs.js.map} +1 -1
- package/dist/promises/index.cjs +4 -4
- package/dist/promises/index.d.cts +101 -101
- package/dist/promises/index.d.ts +101 -101
- package/dist/promises/index.js +4 -4
- package/dist/{punyCode-hmiFzLWT.js → punyCode-BeFYDjj0.js} +6 -6
- package/dist/punyCode-BeFYDjj0.js.map +1 -0
- package/dist/{punyCode-CTWXVVFo.cjs → punyCode-DmTsB7q_.cjs} +6 -6
- package/dist/punyCode-DmTsB7q_.cjs.map +1 -0
- package/dist/{removeSpaces-BE8lfh-4.js → removeSpaces-B96axxP6.js} +7 -4
- package/dist/removeSpaces-B96axxP6.js.map +1 -0
- package/dist/{removeSpaces-DRRxNWlb.cjs → removeSpaces-C8mu_yp3.cjs} +12 -3
- package/dist/removeSpaces-C8mu_yp3.cjs.map +1 -0
- package/dist/rzl-utils.global.js +21 -0
- package/dist/{safeJsonParse-BBnQElk8.cjs → safeJsonParse-BXbtX_j7.cjs} +9 -9
- package/dist/safeJsonParse-BXbtX_j7.cjs.map +1 -0
- package/dist/{safeJsonParse-CXruaP0p.js → safeJsonParse-DyCsTXlU.js} +9 -9
- package/dist/safeJsonParse-DyCsTXlU.js.map +1 -0
- package/dist/{safeStableStringify-BNh3D0K0.js → safeStableStringify-BrOcdX9n.js} +4 -4
- package/dist/{safeStableStringify-BNh3D0K0.js.map → safeStableStringify-BrOcdX9n.js.map} +1 -1
- package/dist/{safeStableStringify-Cc62pfRp.cjs → safeStableStringify-DRYQ56Dg.cjs} +4 -4
- package/dist/{safeStableStringify-Cc62pfRp.cjs.map → safeStableStringify-DRYQ56Dg.cjs.map} +1 -1
- package/dist/strings/index.cjs +12 -10
- package/dist/strings/index.cjs.map +1 -1
- package/dist/strings/index.d.cts +2 -2
- package/dist/strings/index.d.ts +2 -2
- package/dist/strings/index.js +11 -9
- package/dist/strings/index.js.map +1 -1
- package/dist/tailwind/index.cjs +6 -2
- package/dist/tailwind/index.d.cts +3 -3
- package/dist/tailwind/index.d.ts +3 -3
- package/dist/tailwind/index.js +3 -3
- package/dist/{tailwind-IJvOdkZp.js → tailwind-BZ2_MeNX.js} +18 -8
- package/dist/tailwind-BZ2_MeNX.js.map +1 -0
- package/dist/{tailwind-DJ4cmLUw.cjs → tailwind-C1YtxJ-K.cjs} +39 -5
- package/dist/tailwind-C1YtxJ-K.cjs.map +1 -0
- package/dist/{toStringArrayUnRecursive-xUaU8Ot9.cjs → toStringArrayUnRecursive-D1mPM4wg.cjs} +6 -6
- package/dist/{toStringArrayUnRecursive-xUaU8Ot9.cjs.map → toStringArrayUnRecursive-D1mPM4wg.cjs.map} +1 -1
- package/dist/{toStringArrayUnRecursive-CFs0jTEg.js → toStringArrayUnRecursive-tHp2a7KR.js} +6 -6
- package/dist/{toStringArrayUnRecursive-CFs0jTEg.js.map → toStringArrayUnRecursive-tHp2a7KR.js.map} +1 -1
- package/dist/urls/index.cjs +9 -119
- package/dist/urls/index.d.cts +656 -659
- package/dist/urls/index.d.ts +656 -659
- package/dist/urls/index.js +3 -113
- package/dist/urls-CoxDAoki.js +263 -0
- package/dist/urls-CoxDAoki.js.map +1 -0
- package/dist/urls-DCyx8Wpk.cjs +299 -0
- package/dist/urls-DCyx8Wpk.cjs.map +1 -0
- package/package.json +4 -25
- package/dist/assertIsBoolean-BlBct0Fc.js.map +0 -1
- package/dist/assertIsBoolean-DozdtbNi.cjs.map +0 -1
- package/dist/conversions-CBs8-REq.cjs.map +0 -1
- package/dist/conversions-EMJa3g-D.js.map +0 -1
- package/dist/formatEnvPort-DpIXzPAZ.js +0 -159
- package/dist/formatEnvPort-DpIXzPAZ.js.map +0 -1
- package/dist/formatEnvPort-hHNvOim-.cjs +0 -171
- package/dist/formatEnvPort-hHNvOim-.cjs.map +0 -1
- package/dist/formatters-QcZO_Cpx.js.map +0 -1
- package/dist/formatters-lAYgA11L.cjs.map +0 -1
- package/dist/index-26W7ItWx.d.ts +0 -760
- package/dist/index-BPPQjAfs.d.cts +0 -2359
- package/dist/index-BXjlgBLz.d.cts +0 -2139
- package/dist/index-B_Wwo91H.d.ts +0 -2359
- package/dist/index-CpufydcI.d.cts +0 -704
- package/dist/index-Czc4O526.d.ts +0 -333
- package/dist/index-DPs1_p5G.d.cts +0 -760
- package/dist/index-DRpOyBSC.d.ts +0 -1703
- package/dist/index-DWWvtHUn.d.cts +0 -822
- package/dist/index-DnM0LD0n.d.cts +0 -333
- package/dist/index-GUZ9fK6T.d.ts +0 -2139
- package/dist/index-I4fAzwXV.d.ts +0 -704
- package/dist/index-JDrOl_19.d.ts +0 -822
- package/dist/index-b66P49Qe.d.cts +0 -1703
- package/dist/isPlainObject-DcFGh3_5.d.ts +0 -530
- package/dist/isPlainObject-doTI11Ib.d.cts +0 -530
- package/dist/isURL-CQiowFq2.js +0 -14
- package/dist/isURL-CQiowFq2.js.map +0 -1
- package/dist/isURL-WZypXsax.cjs +0 -20
- package/dist/isURL-WZypXsax.cjs.map +0 -1
- package/dist/isValidDomain-BSXshgkC.cjs.map +0 -1
- package/dist/isValidDomain-DwA2EN79.js.map +0 -1
- package/dist/next/index.cjs +0 -129
- package/dist/next/index.cjs.map +0 -1
- package/dist/next/index.d.cts +0 -226
- package/dist/next/index.d.ts +0 -226
- package/dist/next/index.js +0 -124
- package/dist/next/index.js.map +0 -1
- package/dist/next/server/index.cjs +0 -28
- package/dist/next/server/index.cjs.map +0 -1
- package/dist/next/server/index.d.cts +0 -39
- package/dist/next/server/index.d.ts +0 -39
- package/dist/next/server/index.js +0 -26
- package/dist/next/server/index.js.map +0 -1
- package/dist/normalizeString-2WLth_Gj.js +0 -15
- package/dist/normalizeString-2WLth_Gj.js.map +0 -1
- package/dist/normalizeString-D8euBcRD.cjs +0 -21
- package/dist/normalizeString-D8euBcRD.cjs.map +0 -1
- package/dist/punyCode-CTWXVVFo.cjs.map +0 -1
- package/dist/punyCode-hmiFzLWT.js.map +0 -1
- package/dist/removeSpaces-BE8lfh-4.js.map +0 -1
- package/dist/removeSpaces-DRRxNWlb.cjs.map +0 -1
- package/dist/safeJsonParse-BBnQElk8.cjs.map +0 -1
- package/dist/safeJsonParse-CXruaP0p.js.map +0 -1
- package/dist/tailwind-DJ4cmLUw.cjs.map +0 -1
- package/dist/tailwind-IJvOdkZp.js.map +0 -1
- package/dist/urls/index.cjs.map +0 -1
- package/dist/urls/index.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isValidDomain-BxyToAlh.cjs","names":["isString","isBoolean","getPreciseType","safeStableStringify","punycodeUtilsJS","ccTldMap","sldMap"],"sources":["../src/predicates/is/isURL.ts","../../build-tools/dist/formatter-BS3omf7k.js","../src/predicates/is/_private/data/domain/sldMap.json","../src/predicates/is/_private/data/domain/ccTldMap.json","../src/predicates/is/isValidDomain.ts"],"sourcesContent":["/** ---------------------------------------------------------\n * * ***Type guard: `isURL`.***\n * ----------------------------------------------------------\n * **Checks if a value is an instance of the\n * **[`URL`](https://developer.mozilla.org/docs/Web/API/URL)** class.**\n * - **Behavior:**\n * - Narrows type to `URL` when true.\n * - Excludes `strings`, `plain-objects`, and `other non-URL values`.\n * @param {*} value - The value to check.\n * @returns {boolean} Returns `true` if the value is an instance of `URL`, otherwise `false`.\n * @example\n * isURL(new URL(\"https://example.com\"));\n * // ➔ true\n * isURL(\"https://example.com\");\n * // ➔ false\n */\nexport const isURL = (value: unknown): value is URL => {\n return value instanceof URL;\n};\n","/*!\n* ========================================================================\n* @rzl-zone/build-tools\n* ------------------------------------------------------------------------\n* Version: `0.0.12-beta.0`\n* Author: `Rizalvin Dwiky <rizalvindwiky1998@gmail.com>`\n* Repository: `https://github.com/rzl-zone/rzl-zone/tree/main/packages/build-tools`\n* ========================================================================\n*/\n\nimport pcr from \"picocolors\";\nfunction deepFreeze(value) {\n\tif (typeof value !== \"object\" || value === null) return value;\n\tconst seen = /* @__PURE__ */ new WeakSet();\n\tconst stack = [value];\n\twhile (stack.length) {\n\t\tconst obj = stack.pop();\n\t\tif (seen.has(obj) || Object.isFrozen(obj)) continue;\n\t\tseen.add(obj);\n\t\tif (isMap(obj)) for (const [k, v] of obj) {\n\t\t\tif (typeof k === \"object\" && k !== null) stack.push(k);\n\t\t\tif (typeof v === \"object\" && v !== null) stack.push(v);\n\t\t}\n\t\telse if (isSet(obj)) {\n\t\t\tfor (const v of obj) if (typeof v === \"object\" && v !== null) stack.push(v);\n\t\t} else if (isArray(obj)) {\n\t\t\tfor (const v of obj) if (typeof v === \"object\" && v !== null) stack.push(v);\n\t\t} else {\n\t\t\tconst record = obj;\n\t\t\tfor (const key of Reflect.ownKeys(record)) {\n\t\t\t\tconst v = record[key];\n\t\t\t\tif (typeof v === \"object\" && v !== null) stack.push(v);\n\t\t\t}\n\t\t}\n\t\tObject.freeze(obj);\n\t}\n\treturn value;\n}\nconst isRegExp = (value) => {\n\treturn value instanceof RegExp;\n};\nconst isString = (value) => {\n\treturn typeof value === \"string\";\n};\nfunction isSet(value) {\n\treturn Object.prototype.toString.call(value) === \"[object Set]\" || value instanceof Set;\n}\nfunction isMap(value) {\n\treturn Object.prototype.toString.call(value) === \"[object Map]\" || value instanceof Map;\n}\nfunction isArray(value) {\n\treturn Array.isArray(value);\n}\nconst isNull = (val) => val === null;\nfunction isPlainObject(value) {\n\tif (!isObject(value)) return false;\n\tconst proto = Object.getPrototypeOf(value);\n\treturn proto === Object.prototype || proto === null;\n}\nfunction isObject(value) {\n\treturn typeof value === \"object\" && !isNil(value) && !isArray(value);\n}\nfunction isObjectOrArray(value) {\n\treturn isArray(value) || isObject(value);\n}\nconst isNil = (value) => {\n\treturn value == null;\n};\nconst isBoolean = (value) => {\n\treturn typeof value === \"boolean\";\n};\nconst isUndefined = (value) => {\n\treturn typeof value === \"undefined\";\n};\nconst isFunction = (value) => {\n\treturn typeof value === \"function\";\n};\nconst isNumberObject = (value) => {\n\treturn isObject(value) && Object.prototype.toString.call(value) === \"[object Number]\";\n};\nconst isStringObject = (value) => {\n\treturn isObject(value) && Object.prototype.toString.call(value) === \"[object String]\";\n};\nconst isBooleanObject = (value) => {\n\treturn isObject(value) && Object.prototype.toString.call(value) === \"[object Boolean]\";\n};\nconst isInfinityNumber = (value) => {\n\tif (typeof value === \"number\" || isNumberObject(value)) {\n\t\tconst num = Number(value);\n\t\treturn num === Infinity || num === -Infinity;\n\t}\n\treturn false;\n};\nconst isSymbol = (value) => {\n\treturn typeof value === \"symbol\";\n};\nconst isBigInt = (value) => {\n\treturn typeof value === \"bigint\";\n};\nconst isNaN = (value) => {\n\treturn typeof value === \"number\" ? Number.isNaN(value) : isNumberObject(value) && Number.isNaN(value.valueOf());\n};\nconst isNonEmptyString = (value, options = {}) => {\n\tif (!isString(value)) return false;\n\treturn (options.trim ?? true ? value.trim() : value).length > 0;\n};\nconst isNumber = (value, options = {}) => {\n\tconst includeNaN = isPlainObject(options) && isBoolean(options.includeNaN) ? options.includeNaN : false;\n\tconst aNumber = typeof value === \"number\";\n\treturn includeNaN ? aNumber : aNumber && !Number.isNaN(value);\n};\nconst isError = (error) => {\n\treturn Object.prototype.toString.call(error) === \"[object Error]\" || error instanceof Error;\n};\nconst isDate = (value, options = {}) => {\n\tconst skipInvalidDate = isPlainObject(options) && isBoolean(options.skipInvalidDate) ? options.skipInvalidDate : false;\n\tconst instanceDate = value instanceof Date;\n\tif (skipInvalidDate) return instanceDate;\n\treturn instanceDate && !isNaN(value.getTime());\n};\nconst safeStableStringify = (value, options = {}) => {\n\tconst pretty = options.pretty ?? false;\n\tconst sortKeys = options.sortKeys ?? true;\n\tconst sortArray = options.sortArray ?? false;\n\tconst keepUndefined = options.keepUndefined ?? false;\n\tif (isUndefined(value)) return keepUndefined ? \"undefined\" : \"null\";\n\tconst seen = /* @__PURE__ */ new WeakSet();\n\tconst isPrimitive = (val) => isNull(val) || !isObjectOrArray(val) && !isFunction(val);\n\tconst deepProcess = (val) => {\n\t\tif (isNumberObject(val)) {\n\t\t\tconst valOf = val.valueOf();\n\t\t\treturn isNaN(valOf) || isInfinityNumber(valOf) ? null : valOf;\n\t\t}\n\t\tif (isStringObject(val)) return val.valueOf();\n\t\tif (isBooleanObject(val)) return val.valueOf();\n\t\tif (isFunction(val) || isSymbol(val)) return void 0;\n\t\tif (isBigInt(val)) return val.toString();\n\t\tif (isNaN(val) || isInfinityNumber(val)) return null;\n\t\tif (isUndefined(val)) return keepUndefined ? void 0 : null;\n\t\tif (isObjectOrArray(val)) {\n\t\t\tif (seen.has(val)) return \"[Circular]\";\n\t\t\tseen.add(val);\n\t\t\tif (isDate(val)) return val.toISOString();\n\t\t\tif (isMap(val)) return { map: Array.from(val.entries()).map(([k, v]) => [k, deepProcess(v)]) };\n\t\t\tif (isSet(val)) return { set: Array.from(val.values()).map(deepProcess) };\n\t\t\tif (isArray(val)) {\n\t\t\t\tconst processedArr = val.map(deepProcess);\n\t\t\t\tif (sortArray) {\n\t\t\t\t\tconst primitives = [];\n\t\t\t\t\tconst nonPrimitives = [];\n\t\t\t\t\tfor (const item of processedArr) if (isPrimitive(item)) primitives.push(item);\n\t\t\t\t\telse nonPrimitives.push(item);\n\t\t\t\t\tprimitives.sort((a, b) => {\n\t\t\t\t\t\tif (isNumber(a) && isNumber(b)) return a - b;\n\t\t\t\t\t\treturn String(a).localeCompare(String(b));\n\t\t\t\t\t});\n\t\t\t\t\treturn [...primitives, ...nonPrimitives];\n\t\t\t\t}\n\t\t\t\treturn processedArr;\n\t\t\t}\n\t\t\tconst keys = Object.keys(val);\n\t\t\tif (sortKeys) keys.sort((a, b) => {\n\t\t\t\tconst na = Number(a);\n\t\t\t\tconst nb = Number(b);\n\t\t\t\tif (!isNaN(na) && !isNaN(nb)) return na - nb;\n\t\t\t\treturn a.localeCompare(b);\n\t\t\t});\n\t\t\tconst result = {};\n\t\t\tif (isObject(val)) for (const k of keys) {\n\t\t\t\tconst v = deepProcess(val[k]);\n\t\t\t\tif (!isUndefined(v)) result[k] = v;\n\t\t\t}\n\t\t\treturn result;\n\t\t}\n\t\treturn val;\n\t};\n\ttry {\n\t\treturn JSON.stringify(deepProcess(value), null, pretty ? 2 : 0);\n\t} catch (err) {\n\t\tconsole.warn(\"Error in safeStableStringify:\", err);\n\t\treturn \"{}\";\n\t}\n};\nconst normalizeSpaces = (value, options = {\n\twithTrim: true,\n\ttrimOnly: false\n}) => {\n\tif (!isNonEmptyString(value)) return \"\";\n\tif (!isPlainObject(options)) options = {};\n\tconst { trimOnly = false, withTrim = true } = options;\n\tif (trimOnly) return value.trim();\n\tif (withTrim) value = value.trim();\n\treturn value.replace(/\\s+/g, \" \");\n};\nconst isStringArray = (v) => isArray(v) && v.every((i) => isString(i));\nconst isStringSet = (v) => isSet(v) && [...v].every((i) => isString(i));\nconst assertValidatePatternArgs = (v, parameterKey = \"pattern\") => {\n\tif (!isString(v) && !isStringArray(v) && !isStringSet(v)) throw new TypeError(`The \\`${parameterKey}\\` argument must be a string, string[] or Set<string>.`);\n};\nconst flattenStrings = (input) => {\n\treturn input.flat(Infinity).filter((v) => typeof v === \"string\");\n};\nconst toStringSet = (pattern, options = {}) => {\n\tconst { withValidationType = true, parameterKey = \"pattern\" } = options;\n\tif (withValidationType) assertValidatePatternArgs(pattern, parameterKey);\n\treturn toObjectSet(pattern);\n};\nconst toObjectSet = (value) => {\n\tif (isSet(value)) return value;\n\treturn new Set(isArray(value) ? value : [value]);\n};\nconst toArray = (value) => {\n\treturn isArray(value) ? value : [value];\n};\nconst hasGlobalRequire = (value) => isObject(value) && isFunction(value.require);\nconst getRuntimeRequire = () => {\n\tif (!hasGlobalRequire(globalThis)) return void 0;\n\treturn globalThis.require;\n};\nconst __runtimeRequire = ((x) => {\n\tconst r = getRuntimeRequire();\n\tif (r) return r;\n\tif (typeof Proxy !== \"undefined\") return new Proxy(x, { get(target, prop) {\n\t\tconst r2 = getRuntimeRequire();\n\t\treturn r2 ? r2[prop] : target[prop];\n\t} });\n\treturn x;\n})(function(id) {\n\tconst r = getRuntimeRequire();\n\tif (r) return r.call(this, id);\n\tthrow new Error(`Calling \\`require\\` for \"${id}\" in an environment that doesn't expose the \\`require\\` function.`);\n});\nconst picocolors = pcr;\nconst NEWLINE = atob(\"Cg==\");\nconst EOL = hasGlobalRequire(globalThis) ? __runtimeRequire(\"node:os\").EOL : NEWLINE;\nfunction plural(count, word, pluralWord) {\n\tif (count === 1) return word;\n\treturn pluralWord ?? `${word}s`;\n}\nfunction padText(value, options = {}) {\n\tconst { start = true, end = true, padOnInvalid = true } = options;\n\tif (!isNonEmptyString(value)) return padOnInvalid ? \" \" : \"\";\n\treturn `${start ? \" \" : \"\"}${value}${end ? \" \" : \"\"}`;\n}\nfunction joinInline(...text) {\n\treturn text.filter(Boolean).join(\" \");\n}\nfunction joinLines(...text) {\n\treturn text.filter(Boolean).join(EOL);\n}\nfunction joinLinesLoose(...text) {\n\treturn text.filter((v) => v !== false && v !== null && v !== void 0).join(EOL);\n}\nfunction formatOptionValue(value, options) {\n\tconst { pretty = false, indent = 2, sortKeys = false, sortArray = false } = options ?? {};\n\tconst indentUnit = \" \".repeat(indent);\n\tfunction formatRecursive(input, depth = 0) {\n\t\tconst currentIndent = indentUnit.repeat(depth);\n\t\tconst nextIndent = indentUnit.repeat(depth + 1);\n\t\tconst joinInline = picocolors.dim(\", \");\n\t\tconst joinPretty = `,${EOL}`;\n\t\tif (isSet(input)) return formatRecursive([...input], depth);\n\t\tif (isMap(input)) return formatRecursive(Object.fromEntries(input), depth);\n\t\tif (isArray(input)) {\n\t\t\tconst arr = sortArray ? [...input].sort() : input;\n\t\t\tif (arr.length === 0) return picocolors.gray(\"[]\");\n\t\t\tif (!pretty) {\n\t\t\t\tconst items = arr.map((v) => formatRecursive(v, depth)).join(joinInline);\n\t\t\t\treturn picocolors.gray(\"[\") + items + picocolors.gray(\"]\");\n\t\t\t}\n\t\t\tconst items = arr.map((v) => nextIndent + formatRecursive(v, depth + 1)).join(joinPretty);\n\t\t\treturn picocolors.gray(`[${EOL}`) + items + EOL + currentIndent + picocolors.gray(\"]\");\n\t\t}\n\t\tif (isPlainObject(input)) {\n\t\t\tlet entries = Object.entries(input);\n\t\t\tif (sortKeys) entries = entries.sort(([a], [b]) => a.localeCompare(b));\n\t\t\tif (entries.length === 0) return picocolors.gray(\"{}\");\n\t\t\tif (!pretty) {\n\t\t\t\tconst props = entries.map(([key, val]) => {\n\t\t\t\t\treturn picocolors.dim(key) + picocolors.gray(\": \") + formatRecursive(val, depth);\n\t\t\t\t}).join(joinInline);\n\t\t\t\treturn picocolors.gray(\"{ \") + props + picocolors.gray(\" }\");\n\t\t\t}\n\t\t\tconst props = entries.map(([key, val]) => {\n\t\t\t\treturn nextIndent + picocolors.dim(key) + picocolors.gray(\": \") + formatRecursive(val, depth + 1);\n\t\t\t}).join(joinPretty);\n\t\t\treturn picocolors.gray(`{${EOL}`) + props + EOL + currentIndent + picocolors.gray(\"}\");\n\t\t}\n\t\tif (isRegExp(input)) return picocolors.greenBright(\"/\") + picocolors.redBright(input.source) + picocolors.greenBright(\"/\") + picocolors.magentaBright(input.flags);\n\t\tif (isString(input)) return picocolors.gray(`\"${input}\"`);\n\t\tif (isNumber(input, { includeNaN: true })) return picocolors.redBright(String(input));\n\t\tif (isBoolean(input)) return picocolors.redBright(String(input));\n\t\tif (isNil(input)) return picocolors.redBright(String(input));\n\t\tif (isObject(input)) return picocolors.cyanBright(Object.prototype.toString.call(input));\n\t\treturn picocolors.cyanBright(String(input));\n\t}\n\treturn formatRecursive(value);\n}\nexport { isString as C, toArray as D, safeStableStringify as E, toObjectSet as O, isSet as S, normalizeSpaces as T, isNonEmptyString as _, joinLines as a, isPlainObject as b, picocolors as c, flattenStrings as d, isArray as f, isNil as g, isFunction as h, joinInline as i, toStringSet as k, plural as l, isError as m, NEWLINE as n, joinLinesLoose as o, isBoolean as p, formatOptionValue as r, padText as s, EOL as t, deepFreeze as u, isNull as v, isUndefined as w, isRegExp as x, isNumber as y };\n//# sourceMappingURL=formatter-BS3omf7k.js.map\n","","","import { joinLines, EOL } from \"@rzl-zone/build-tools/utils\";\n\nimport { punycodeUtilsJS } from \"@/urls/utils/punyCode\";\nimport { assertIsPlainObject } from \"@/assertions/objects/assertIsPlainObject\";\nimport { safeStableStringify } from \"@/conversions/stringify/safeStableStringify\";\n\nimport sldMap from \"./_private/data/domain/sldMap.json\";\nimport ccTldMap from \"./_private/data/domain/ccTldMap.json\";\n\nimport { isString } from \"./isString\";\nimport { isBoolean } from \"./isBoolean\";\n\nimport { getPreciseType } from \"../type/getPreciseType\";\n\n/** ---------------------------------------------------------\n * * ***Options for `isValidDomain` predicate.***\n * ---------------------------------------------------------\n * **Customize the behavior of domain validation.**\n */\ntype IsValidDomainOptions = {\n /** * ***Enable conversion of Unicode domains (IDN) to ASCII (punycode).***\n *\n * - Example: `\"пример.рф\"` ➔ `\"xn--e1afmkfd.xn--p1ai\"`\n * - Allows validating Unicode domains correctly.\n * - Default: `false`\n *\n * @defaultValue `false`.\n */\n allowUnicode?: boolean;\n\n /** * ***If `true`, validates **only top-level domains (TLDs)** that are not part of any SLD/second-level domain.***\n *\n * - Accepts country-code TLDs like `\"ai\"` or `\"ai.\"` ✅\n * - Rejects common TLDs that are part of SLDs like `\"com\"` ❌\n * - Only the final label is checked; subdomains are ignored.\n * - Default: `false`\n *\n * @defaultValue `false`.\n */\n topLevel?: boolean;\n\n /** * ***Allow or disallow subdomains.***\n *\n * - Example: `\"sub.example.com\"` ✅ if `subdomain` is `true`, ❌ if `false`\n * - Wildcards and SLDs are considered when evaluating subdomains.\n * - Default: `true`\n *\n * @defaultValue `true`.\n */\n subdomain?: boolean;\n\n /** * ***Allow a wildcard `*` in the left-most label.***\n *\n * - Example: `\"*.example.com\"` ✅ if `wildcard` is `true`, ❌ if `false`\n * - Wildcards are only valid in the first label and require at least one additional label.\n * - Default: `false`\n *\n * @defaultValue `false`.\n */\n wildcard?: boolean;\n\n /** * ***Allow a port after the domain.***\n *\n * - Example: `\"localhost:3000\"` or `\"example.com:8080\"` ✅ if `allowPort` is `true`\n * - Validates that the port is a number between `1` and `65535`.\n * - Does not affect domain validation rules otherwise.\n * - Default: `false`\n *\n * @defaultValue `false`.\n */\n allowPort?: boolean;\n\n /** * ***Allow special domains like `localhost`.***\n *\n * - Example: `\"localhost\"` ✅ if `allowLocalhost` is `true`\n * - Works with or without a port if `allowPort` is enabled.\n * - Default: `false`\n *\n * @defaultValue `false`.\n */\n allowLocalhost?: boolean;\n\n /** * ***Allow URLs with protocol (`http`/`https`) and automatically extract the hostname.***\n *\n * - Example: `\"https://example.com/foo/bar\"` ➔ `\"example.com\"`\n * - The function will validate only the hostname part and ignore the path, query, and fragment.\n * - Default: `false`\n *\n * @defaultValue `false`.\n */\n allowProtocol?: boolean;\n};\n\n/** ---------------------------------------------------------\n * * ***Predicate: `isValidDomain`.***\n * ---------------------------------------------------------\n * **Validates whether a given string is a properly formatted domain name.**\n *\n * - **Supports options for:**\n * - `allowUnicode` ➔ allows internationalized domain names (IDN) with Unicode characters.\n * - `topLevel` ➔ validates **only top-level domains (TLDs)**; ignores subdomains and SLDs.\n * - `subdomain` ➔ allows or disallows subdomains.\n * - `wildcard` ➔ allows wildcard (`*`) in the left-most label.\n * - `allowPort` ➔ allows a port number after the domain (e.g., `example.com:8080`).\n * - `allowLocalhost` ➔ allows the special domain `\"localhost\"`.\n * - `allowProtocol` ➔ allows a URL with protocol (`http`/`https`) and extracts the hostname.\n *\n * - **Behavior:**\n * - ✅ Converts Unicode to ASCII (punycode) if `allowUnicode` is `true`.\n * - ✅ Checks label lengths (≤63 chars), valid characters, and punycode consistency.\n * - ✅ Validates port if `allowPort` is `true` (must be 1–65535).\n * - ✅ Accepts `\"localhost\"` if `allowLocalhost` is `true`.\n * - ✅ Extracts hostname from URLs if `allowProtocol` is `true`.\n * - ❌ Rejects invalid domains, labels starting/ending with `-`, double dots, malformed TLDs, or invalid port numbers.\n * - ✅ Handles both standard domains (example.com), URLs with protocols (https://example.com/foo), and IDNs (пример.рф).\n *\n * @param {*} value - The value to validate; only strings are valid domains.\n * @param {IsValidDomainOptions} [options] - Optional configuration for domain validation.\n * @param {boolean} [options.allowUnicode=false] - Enable punycode conversion for Unicode domains.\n * @param {boolean} [options.topLevel=false] - Validate only TLDs (e.g., `ai`, `uk.`); ignores SLDs like `com`.\n * @param {boolean} [options.subdomain=true] - Allow subdomains; set `false` to reject any subdomain.\n * @param {boolean} [options.wildcard=false] - Allow wildcard `*` in the left-most label (e.g., `*.example.com`).\n * @param {boolean} [options.allowPort=false] - Allow port number after domain (e.g., `:3000`); must be 1–65535.\n * @param {boolean} [options.allowLocalhost=false] - Allow special domain `\"localhost\"`.\n * @param {boolean} [options.allowProtocol=false] - Allow URLs with protocol (`http`/`https`) and extract hostname only.\n * @returns {boolean} Returns `true` if the value is a valid domain according to the rules and options; otherwise `false`.\n *\n * @example\n * isValidDomain(\"google.com\");\n * // ➔ true\n * isValidDomain(\"пример.рф\", { allowUnicode: true });\n * // ➔ true\n * isValidDomain(\"sub.example.com\", { subdomain: false });\n * // ➔ false\n * isValidDomain(\"*.example.com\", { wildcard: true });\n * // ➔ true\n * isValidDomain(\"com\", { topLevel: true });\n * // ➔ false (common TLD rejected because it's part of SLD)\n * isValidDomain(\"ai.\", { topLevel: true });\n * // ➔ true (country-code TLD accepted)\n * isValidDomain(\"localhost\", { allowLocalhost: true });\n * // ➔ true\n * isValidDomain(\"localhost:3000\", { allowLocalhost: true, allowPort: true });\n * // ➔ true\n * isValidDomain(\"example.com:8080\", { allowPort: true });\n * // ➔ true\n * isValidDomain(\"https://example.com/foo/bar\", { allowProtocol: true });\n * // ➔ true (protocol stripped and hostname validated)\n * isValidDomain(\"invalid_domain.com\");\n * // ➔ false\n */\nexport function isValidDomain(\n value: unknown,\n options: IsValidDomainOptions = {}\n): boolean {\n if (!isString(value)) return false;\n\n assertIsPlainObject(options, {\n message: ({ currentType, validType }) =>\n `Second parameter (\\`options\\`) must be of type \\`${validType}\\`, but received: \\`${currentType}\\`.`\n });\n\n const {\n subdomain = true,\n topLevel = false,\n wildcard = false,\n allowUnicode = false,\n allowPort = false,\n allowLocalhost = false,\n allowProtocol = false\n } = options;\n\n // Validate Options:\n const invalid = Object.entries({\n subdomain,\n topLevel,\n wildcard,\n allowUnicode,\n allowProtocol,\n allowPort,\n allowLocalhost\n }).filter(([, value]) => !isBoolean(value));\n\n if (invalid.length) {\n const msg = invalid\n .map(([key, value], i) => {\n return joinLines(\n ` ${i + 1}. option: \"${key}\"`,\n \" expected: boolean\",\n ` received: ${getPreciseType(value)} (${safeStableStringify(\n value,\n {\n keepUndefined: true\n }\n )})`\n );\n })\n .join(EOL);\n\n throw new TypeError(\n joinLines(\n \"\",\n \"> Invalid options detected in second parameter of `isValidDomain`:\",\n msg\n )\n );\n }\n // -----------------\n\n let _value = value.toLowerCase();\n\n if (allowProtocol) {\n try {\n const url = new URL(value); // use original input\n if (url.protocol !== \"http:\" && url.protocol !== \"https:\") return false; // reject non-http(s)\n if (!allowPort && url.port) return false; // reject port if allowPort=false\n _value = url.hostname.toLowerCase(); // extract only hostname\n\n // wildcard check\n const labels = _value.split(\".\");\n if (labels[0] === \"*\" && !wildcard) return false;\n } catch {\n // if parsing fails, leave _value unchanged\n }\n }\n\n if (value.endsWith(\".\")) {\n _value = _value.slice(0, _value.length - 1);\n }\n\n // Handle port\n let port: string;\n if (allowPort) {\n const portMatch = _value.match(/:(\\d{1,5})$/);\n if (portMatch) {\n port = portMatch[0];\n _value = _value.slice(0, -port.length);\n const portNum = Number(portMatch[1]);\n if (portNum < 1 || portNum > 65535) return false;\n }\n }\n\n // Allow localhost\n if (allowLocalhost && _value === \"localhost\") return true;\n\n if (allowUnicode) {\n try {\n _value = punycodeUtilsJS.toASCII(_value);\n } catch {\n return false;\n }\n }\n\n if (_value.length > 253) return false;\n\n const validChars = /^([\\u0E00-\\u0E7Fa-z0-9-._*]+)$/g;\n if (!validChars.test(_value)) return false;\n\n if (topLevel) {\n if (ccTldMap[_value.replace(/\\.$/, \"\") as keyof typeof ccTldMap]) {\n return true;\n }\n }\n\n const sldRegex = /(.*)\\.(([\\u0E00-\\u0E7Fa-z0-9]+)(\\.[a-z0-9]+))/;\n const matches = _value.match(sldRegex);\n // eslint-disable-next-line no-useless-assignment\n let tld: string | null = null;\n let labels: string[] | null = null;\n\n if (matches && matches.length > 2) {\n if (sldMap[matches[2] as keyof typeof sldMap]) {\n // eslint-disable-next-line no-useless-assignment\n tld = matches[2] || null;\n labels = matches[1]?.split(\".\") || null;\n }\n }\n\n if (!labels) {\n labels = _value.split(\".\");\n if (labels.length <= 1) return false;\n\n tld = labels.pop()!;\n const tldRegex = /^(?:xn--)?(?!^\\d+$)[\\u0E00-\\u0E7Fa-z0-9]+$/gi;\n if (!tldRegex.test(tld)) return false;\n }\n\n if (subdomain === false && labels.length > 1) return false;\n\n return labels.every((label, index) => {\n if (wildcard && index === 0 && label === \"*\" && labels.length > 1) {\n return true;\n }\n\n let validLabelChars = /^([\\u0E00-\\u0E7Fa-zA-Z0-9-_]+)$/g;\n if (index === labels.length - 1) {\n validLabelChars = /^([\\u0E00-\\u0E7Fa-zA-Z0-9-]+)$/g;\n }\n\n const doubleDashCount = (label.match(/--(--)?/g) || []).length;\n const xnDashCount = (label.match(/xn--/g) || []).length;\n if (index === labels.length - 1 && doubleDashCount !== xnDashCount) {\n return false;\n }\n\n return (\n validLabelChars.test(label) &&\n label.length < 64 &&\n !label.startsWith(\"-\") &&\n !label.endsWith(\"-\")\n );\n });\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgBA,MAAa,SAAS,UAAiC;CACrD,OAAO,iBAAiB;;;;;;;;;;;;;;ACiC1B,SAAS,QAAQ,OAAO;CACvB,OAAO,MAAM,QAAQ,MAAM;;AAQ5B,SAAS,SAAS,OAAO;CACxB,OAAO,OAAO,UAAU,YAAY,CAAC,MAAM,MAAM,IAAI,CAAC,QAAQ,MAAM;;AAKrE,MAAM,SAAS,UAAU;CACxB,OAAO,SAAS;;AAQj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AO,OAAO,UAAU;EACpC,IAAI,YAAY,UAAU,KAAK,UAAU,OAAO,OAAO,SAAS,GAC9D,OAAO;EAGT,IAAI,kBAAkB;EACtB,IAAI,UAAU,OAAO,SAAS,GAC5B,kBAAkB;EAGpB,MAAM,mBAAmB,MAAM,MAAM,WAAW,IAAI,EAAE,EAAE;EACxD,MAAM,eAAe,MAAM,MAAM,QAAQ,IAAI,EAAE,EAAE;EACjD,IAAI,UAAU,OAAO,SAAS,KAAK,oBAAoB,aACrD,OAAO;EAGT,OACE,gBAAgB,KAAK,MAAM,IAC3B,MAAM,SAAS,MACf,CAAC,MAAM,WAAW,IAAI,IACtB,CAAC,MAAM,SAAS,IAAI;GAEtB"}
|
|
@@ -2,14 +2,61 @@
|
|
|
2
2
|
* ========================================================================
|
|
3
3
|
* @rzl-zone/utils-js
|
|
4
4
|
* ------------------------------------------------------------------------
|
|
5
|
-
* Version: `3.
|
|
5
|
+
* Version: `3.13.0-beta.2`
|
|
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 { F as isBoolean, T as assertIsPlainObject, k as isString, r as getPreciseType } from "./assertIsBoolean-
|
|
11
|
-
import { t as safeStableStringify } from "./safeStableStringify-
|
|
12
|
-
import { t as punycodeUtilsJS } from "./punyCode-
|
|
10
|
+
import { F as isBoolean, T as assertIsPlainObject, k as isString, r as getPreciseType } from "./assertIsBoolean-Bv6gL-xe.js";
|
|
11
|
+
import { t as safeStableStringify } from "./safeStableStringify-BrOcdX9n.js";
|
|
12
|
+
import { t as punycodeUtilsJS } from "./punyCode-BeFYDjj0.js";
|
|
13
|
+
const isURL = (value) => {
|
|
14
|
+
return value instanceof URL;
|
|
15
|
+
};
|
|
16
|
+
/*!
|
|
17
|
+
* ========================================================================
|
|
18
|
+
* @rzl-zone/build-tools
|
|
19
|
+
* ------------------------------------------------------------------------
|
|
20
|
+
* Version: `0.0.12-beta.0`
|
|
21
|
+
* Author: `Rizalvin Dwiky <rizalvindwiky1998@gmail.com>`
|
|
22
|
+
* Repository: `https://github.com/rzl-zone/rzl-zone/tree/main/packages/build-tools`
|
|
23
|
+
* ========================================================================
|
|
24
|
+
*/
|
|
25
|
+
function isArray(value) {
|
|
26
|
+
return Array.isArray(value);
|
|
27
|
+
}
|
|
28
|
+
function isObject(value) {
|
|
29
|
+
return typeof value === "object" && !isNil(value) && !isArray(value);
|
|
30
|
+
}
|
|
31
|
+
const isNil = (value) => {
|
|
32
|
+
return value == null;
|
|
33
|
+
};
|
|
34
|
+
const isFunction = (value) => {
|
|
35
|
+
return typeof value === "function";
|
|
36
|
+
};
|
|
37
|
+
const hasGlobalRequire = (value) => isObject(value) && isFunction(value.require);
|
|
38
|
+
const getRuntimeRequire = () => {
|
|
39
|
+
if (!hasGlobalRequire(globalThis)) return void 0;
|
|
40
|
+
return globalThis.require;
|
|
41
|
+
};
|
|
42
|
+
const __runtimeRequire = ((x) => {
|
|
43
|
+
const r = getRuntimeRequire();
|
|
44
|
+
if (r) return r;
|
|
45
|
+
if (typeof Proxy !== "undefined") return new Proxy(x, { get(target, prop) {
|
|
46
|
+
const r2 = getRuntimeRequire();
|
|
47
|
+
return r2 ? r2[prop] : target[prop];
|
|
48
|
+
} });
|
|
49
|
+
return x;
|
|
50
|
+
})(function(id) {
|
|
51
|
+
const r = getRuntimeRequire();
|
|
52
|
+
if (r) return r.call(this, id);
|
|
53
|
+
throw new Error(`Calling \`require\` for "${id}" in an environment that doesn't expose the \`require\` function.`);
|
|
54
|
+
});
|
|
55
|
+
const NEWLINE = atob("Cg==");
|
|
56
|
+
const EOL = hasGlobalRequire(globalThis) ? __runtimeRequire("node:os").EOL : NEWLINE;
|
|
57
|
+
function joinLines(...text) {
|
|
58
|
+
return text.filter(Boolean).join(EOL);
|
|
59
|
+
}
|
|
13
60
|
var sldMap_default = {
|
|
14
61
|
"com.ac": true,
|
|
15
62
|
"net.ac": true,
|
|
@@ -1718,9 +1765,10 @@ function isValidDomain(value, options = {}) {
|
|
|
1718
1765
|
allowLocalhost
|
|
1719
1766
|
}).filter(([, value]) => !isBoolean(value));
|
|
1720
1767
|
if (invalid.length) {
|
|
1721
|
-
const msg = invalid.map(([key, value], i) =>
|
|
1722
|
-
received: ${getPreciseType(value)} (${safeStableStringify(value, { keepUndefined: true })})`)
|
|
1723
|
-
|
|
1768
|
+
const msg = invalid.map(([key, value], i) => {
|
|
1769
|
+
return joinLines(` ${i + 1}. option: "${key}"`, " expected: boolean", ` received: ${getPreciseType(value)} (${safeStableStringify(value, { keepUndefined: true })})`);
|
|
1770
|
+
}).join(EOL);
|
|
1771
|
+
throw new TypeError(joinLines("", "> Invalid options detected in second parameter of `isValidDomain`:", msg));
|
|
1724
1772
|
}
|
|
1725
1773
|
let _value = value.toLowerCase();
|
|
1726
1774
|
if (allowProtocol) try {
|
|
@@ -1778,5 +1826,5 @@ function isValidDomain(value, options = {}) {
|
|
|
1778
1826
|
return validLabelChars.test(label) && label.length < 64 && !label.startsWith("-") && !label.endsWith("-");
|
|
1779
1827
|
});
|
|
1780
1828
|
}
|
|
1781
|
-
export { isValidDomain as t };
|
|
1782
|
-
//# sourceMappingURL=isValidDomain-
|
|
1829
|
+
export { isURL as i, EOL as n, joinLines as r, isValidDomain as t };
|
|
1830
|
+
//# sourceMappingURL=isValidDomain-CTw5vZFY.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isValidDomain-CTw5vZFY.js","names":["ccTldMap","sldMap"],"sources":["../src/predicates/is/isURL.ts","../../build-tools/dist/formatter-BS3omf7k.js","../src/predicates/is/_private/data/domain/sldMap.json","../src/predicates/is/_private/data/domain/ccTldMap.json","../src/predicates/is/isValidDomain.ts"],"sourcesContent":["/** ---------------------------------------------------------\n * * ***Type guard: `isURL`.***\n * ----------------------------------------------------------\n * **Checks if a value is an instance of the\n * **[`URL`](https://developer.mozilla.org/docs/Web/API/URL)** class.**\n * - **Behavior:**\n * - Narrows type to `URL` when true.\n * - Excludes `strings`, `plain-objects`, and `other non-URL values`.\n * @param {*} value - The value to check.\n * @returns {boolean} Returns `true` if the value is an instance of `URL`, otherwise `false`.\n * @example\n * isURL(new URL(\"https://example.com\"));\n * // ➔ true\n * isURL(\"https://example.com\");\n * // ➔ false\n */\nexport const isURL = (value: unknown): value is URL => {\n return value instanceof URL;\n};\n","/*!\n* ========================================================================\n* @rzl-zone/build-tools\n* ------------------------------------------------------------------------\n* Version: `0.0.12-beta.0`\n* Author: `Rizalvin Dwiky <rizalvindwiky1998@gmail.com>`\n* Repository: `https://github.com/rzl-zone/rzl-zone/tree/main/packages/build-tools`\n* ========================================================================\n*/\n\nimport pcr from \"picocolors\";\nfunction deepFreeze(value) {\n\tif (typeof value !== \"object\" || value === null) return value;\n\tconst seen = /* @__PURE__ */ new WeakSet();\n\tconst stack = [value];\n\twhile (stack.length) {\n\t\tconst obj = stack.pop();\n\t\tif (seen.has(obj) || Object.isFrozen(obj)) continue;\n\t\tseen.add(obj);\n\t\tif (isMap(obj)) for (const [k, v] of obj) {\n\t\t\tif (typeof k === \"object\" && k !== null) stack.push(k);\n\t\t\tif (typeof v === \"object\" && v !== null) stack.push(v);\n\t\t}\n\t\telse if (isSet(obj)) {\n\t\t\tfor (const v of obj) if (typeof v === \"object\" && v !== null) stack.push(v);\n\t\t} else if (isArray(obj)) {\n\t\t\tfor (const v of obj) if (typeof v === \"object\" && v !== null) stack.push(v);\n\t\t} else {\n\t\t\tconst record = obj;\n\t\t\tfor (const key of Reflect.ownKeys(record)) {\n\t\t\t\tconst v = record[key];\n\t\t\t\tif (typeof v === \"object\" && v !== null) stack.push(v);\n\t\t\t}\n\t\t}\n\t\tObject.freeze(obj);\n\t}\n\treturn value;\n}\nconst isRegExp = (value) => {\n\treturn value instanceof RegExp;\n};\nconst isString = (value) => {\n\treturn typeof value === \"string\";\n};\nfunction isSet(value) {\n\treturn Object.prototype.toString.call(value) === \"[object Set]\" || value instanceof Set;\n}\nfunction isMap(value) {\n\treturn Object.prototype.toString.call(value) === \"[object Map]\" || value instanceof Map;\n}\nfunction isArray(value) {\n\treturn Array.isArray(value);\n}\nconst isNull = (val) => val === null;\nfunction isPlainObject(value) {\n\tif (!isObject(value)) return false;\n\tconst proto = Object.getPrototypeOf(value);\n\treturn proto === Object.prototype || proto === null;\n}\nfunction isObject(value) {\n\treturn typeof value === \"object\" && !isNil(value) && !isArray(value);\n}\nfunction isObjectOrArray(value) {\n\treturn isArray(value) || isObject(value);\n}\nconst isNil = (value) => {\n\treturn value == null;\n};\nconst isBoolean = (value) => {\n\treturn typeof value === \"boolean\";\n};\nconst isUndefined = (value) => {\n\treturn typeof value === \"undefined\";\n};\nconst isFunction = (value) => {\n\treturn typeof value === \"function\";\n};\nconst isNumberObject = (value) => {\n\treturn isObject(value) && Object.prototype.toString.call(value) === \"[object Number]\";\n};\nconst isStringObject = (value) => {\n\treturn isObject(value) && Object.prototype.toString.call(value) === \"[object String]\";\n};\nconst isBooleanObject = (value) => {\n\treturn isObject(value) && Object.prototype.toString.call(value) === \"[object Boolean]\";\n};\nconst isInfinityNumber = (value) => {\n\tif (typeof value === \"number\" || isNumberObject(value)) {\n\t\tconst num = Number(value);\n\t\treturn num === Infinity || num === -Infinity;\n\t}\n\treturn false;\n};\nconst isSymbol = (value) => {\n\treturn typeof value === \"symbol\";\n};\nconst isBigInt = (value) => {\n\treturn typeof value === \"bigint\";\n};\nconst isNaN = (value) => {\n\treturn typeof value === \"number\" ? Number.isNaN(value) : isNumberObject(value) && Number.isNaN(value.valueOf());\n};\nconst isNonEmptyString = (value, options = {}) => {\n\tif (!isString(value)) return false;\n\treturn (options.trim ?? true ? value.trim() : value).length > 0;\n};\nconst isNumber = (value, options = {}) => {\n\tconst includeNaN = isPlainObject(options) && isBoolean(options.includeNaN) ? options.includeNaN : false;\n\tconst aNumber = typeof value === \"number\";\n\treturn includeNaN ? aNumber : aNumber && !Number.isNaN(value);\n};\nconst isError = (error) => {\n\treturn Object.prototype.toString.call(error) === \"[object Error]\" || error instanceof Error;\n};\nconst isDate = (value, options = {}) => {\n\tconst skipInvalidDate = isPlainObject(options) && isBoolean(options.skipInvalidDate) ? options.skipInvalidDate : false;\n\tconst instanceDate = value instanceof Date;\n\tif (skipInvalidDate) return instanceDate;\n\treturn instanceDate && !isNaN(value.getTime());\n};\nconst safeStableStringify = (value, options = {}) => {\n\tconst pretty = options.pretty ?? false;\n\tconst sortKeys = options.sortKeys ?? true;\n\tconst sortArray = options.sortArray ?? false;\n\tconst keepUndefined = options.keepUndefined ?? false;\n\tif (isUndefined(value)) return keepUndefined ? \"undefined\" : \"null\";\n\tconst seen = /* @__PURE__ */ new WeakSet();\n\tconst isPrimitive = (val) => isNull(val) || !isObjectOrArray(val) && !isFunction(val);\n\tconst deepProcess = (val) => {\n\t\tif (isNumberObject(val)) {\n\t\t\tconst valOf = val.valueOf();\n\t\t\treturn isNaN(valOf) || isInfinityNumber(valOf) ? null : valOf;\n\t\t}\n\t\tif (isStringObject(val)) return val.valueOf();\n\t\tif (isBooleanObject(val)) return val.valueOf();\n\t\tif (isFunction(val) || isSymbol(val)) return void 0;\n\t\tif (isBigInt(val)) return val.toString();\n\t\tif (isNaN(val) || isInfinityNumber(val)) return null;\n\t\tif (isUndefined(val)) return keepUndefined ? void 0 : null;\n\t\tif (isObjectOrArray(val)) {\n\t\t\tif (seen.has(val)) return \"[Circular]\";\n\t\t\tseen.add(val);\n\t\t\tif (isDate(val)) return val.toISOString();\n\t\t\tif (isMap(val)) return { map: Array.from(val.entries()).map(([k, v]) => [k, deepProcess(v)]) };\n\t\t\tif (isSet(val)) return { set: Array.from(val.values()).map(deepProcess) };\n\t\t\tif (isArray(val)) {\n\t\t\t\tconst processedArr = val.map(deepProcess);\n\t\t\t\tif (sortArray) {\n\t\t\t\t\tconst primitives = [];\n\t\t\t\t\tconst nonPrimitives = [];\n\t\t\t\t\tfor (const item of processedArr) if (isPrimitive(item)) primitives.push(item);\n\t\t\t\t\telse nonPrimitives.push(item);\n\t\t\t\t\tprimitives.sort((a, b) => {\n\t\t\t\t\t\tif (isNumber(a) && isNumber(b)) return a - b;\n\t\t\t\t\t\treturn String(a).localeCompare(String(b));\n\t\t\t\t\t});\n\t\t\t\t\treturn [...primitives, ...nonPrimitives];\n\t\t\t\t}\n\t\t\t\treturn processedArr;\n\t\t\t}\n\t\t\tconst keys = Object.keys(val);\n\t\t\tif (sortKeys) keys.sort((a, b) => {\n\t\t\t\tconst na = Number(a);\n\t\t\t\tconst nb = Number(b);\n\t\t\t\tif (!isNaN(na) && !isNaN(nb)) return na - nb;\n\t\t\t\treturn a.localeCompare(b);\n\t\t\t});\n\t\t\tconst result = {};\n\t\t\tif (isObject(val)) for (const k of keys) {\n\t\t\t\tconst v = deepProcess(val[k]);\n\t\t\t\tif (!isUndefined(v)) result[k] = v;\n\t\t\t}\n\t\t\treturn result;\n\t\t}\n\t\treturn val;\n\t};\n\ttry {\n\t\treturn JSON.stringify(deepProcess(value), null, pretty ? 2 : 0);\n\t} catch (err) {\n\t\tconsole.warn(\"Error in safeStableStringify:\", err);\n\t\treturn \"{}\";\n\t}\n};\nconst normalizeSpaces = (value, options = {\n\twithTrim: true,\n\ttrimOnly: false\n}) => {\n\tif (!isNonEmptyString(value)) return \"\";\n\tif (!isPlainObject(options)) options = {};\n\tconst { trimOnly = false, withTrim = true } = options;\n\tif (trimOnly) return value.trim();\n\tif (withTrim) value = value.trim();\n\treturn value.replace(/\\s+/g, \" \");\n};\nconst isStringArray = (v) => isArray(v) && v.every((i) => isString(i));\nconst isStringSet = (v) => isSet(v) && [...v].every((i) => isString(i));\nconst assertValidatePatternArgs = (v, parameterKey = \"pattern\") => {\n\tif (!isString(v) && !isStringArray(v) && !isStringSet(v)) throw new TypeError(`The \\`${parameterKey}\\` argument must be a string, string[] or Set<string>.`);\n};\nconst flattenStrings = (input) => {\n\treturn input.flat(Infinity).filter((v) => typeof v === \"string\");\n};\nconst toStringSet = (pattern, options = {}) => {\n\tconst { withValidationType = true, parameterKey = \"pattern\" } = options;\n\tif (withValidationType) assertValidatePatternArgs(pattern, parameterKey);\n\treturn toObjectSet(pattern);\n};\nconst toObjectSet = (value) => {\n\tif (isSet(value)) return value;\n\treturn new Set(isArray(value) ? value : [value]);\n};\nconst toArray = (value) => {\n\treturn isArray(value) ? value : [value];\n};\nconst hasGlobalRequire = (value) => isObject(value) && isFunction(value.require);\nconst getRuntimeRequire = () => {\n\tif (!hasGlobalRequire(globalThis)) return void 0;\n\treturn globalThis.require;\n};\nconst __runtimeRequire = ((x) => {\n\tconst r = getRuntimeRequire();\n\tif (r) return r;\n\tif (typeof Proxy !== \"undefined\") return new Proxy(x, { get(target, prop) {\n\t\tconst r2 = getRuntimeRequire();\n\t\treturn r2 ? r2[prop] : target[prop];\n\t} });\n\treturn x;\n})(function(id) {\n\tconst r = getRuntimeRequire();\n\tif (r) return r.call(this, id);\n\tthrow new Error(`Calling \\`require\\` for \"${id}\" in an environment that doesn't expose the \\`require\\` function.`);\n});\nconst picocolors = pcr;\nconst NEWLINE = atob(\"Cg==\");\nconst EOL = hasGlobalRequire(globalThis) ? __runtimeRequire(\"node:os\").EOL : NEWLINE;\nfunction plural(count, word, pluralWord) {\n\tif (count === 1) return word;\n\treturn pluralWord ?? `${word}s`;\n}\nfunction padText(value, options = {}) {\n\tconst { start = true, end = true, padOnInvalid = true } = options;\n\tif (!isNonEmptyString(value)) return padOnInvalid ? \" \" : \"\";\n\treturn `${start ? \" \" : \"\"}${value}${end ? \" \" : \"\"}`;\n}\nfunction joinInline(...text) {\n\treturn text.filter(Boolean).join(\" \");\n}\nfunction joinLines(...text) {\n\treturn text.filter(Boolean).join(EOL);\n}\nfunction joinLinesLoose(...text) {\n\treturn text.filter((v) => v !== false && v !== null && v !== void 0).join(EOL);\n}\nfunction formatOptionValue(value, options) {\n\tconst { pretty = false, indent = 2, sortKeys = false, sortArray = false } = options ?? {};\n\tconst indentUnit = \" \".repeat(indent);\n\tfunction formatRecursive(input, depth = 0) {\n\t\tconst currentIndent = indentUnit.repeat(depth);\n\t\tconst nextIndent = indentUnit.repeat(depth + 1);\n\t\tconst joinInline = picocolors.dim(\", \");\n\t\tconst joinPretty = `,${EOL}`;\n\t\tif (isSet(input)) return formatRecursive([...input], depth);\n\t\tif (isMap(input)) return formatRecursive(Object.fromEntries(input), depth);\n\t\tif (isArray(input)) {\n\t\t\tconst arr = sortArray ? [...input].sort() : input;\n\t\t\tif (arr.length === 0) return picocolors.gray(\"[]\");\n\t\t\tif (!pretty) {\n\t\t\t\tconst items = arr.map((v) => formatRecursive(v, depth)).join(joinInline);\n\t\t\t\treturn picocolors.gray(\"[\") + items + picocolors.gray(\"]\");\n\t\t\t}\n\t\t\tconst items = arr.map((v) => nextIndent + formatRecursive(v, depth + 1)).join(joinPretty);\n\t\t\treturn picocolors.gray(`[${EOL}`) + items + EOL + currentIndent + picocolors.gray(\"]\");\n\t\t}\n\t\tif (isPlainObject(input)) {\n\t\t\tlet entries = Object.entries(input);\n\t\t\tif (sortKeys) entries = entries.sort(([a], [b]) => a.localeCompare(b));\n\t\t\tif (entries.length === 0) return picocolors.gray(\"{}\");\n\t\t\tif (!pretty) {\n\t\t\t\tconst props = entries.map(([key, val]) => {\n\t\t\t\t\treturn picocolors.dim(key) + picocolors.gray(\": \") + formatRecursive(val, depth);\n\t\t\t\t}).join(joinInline);\n\t\t\t\treturn picocolors.gray(\"{ \") + props + picocolors.gray(\" }\");\n\t\t\t}\n\t\t\tconst props = entries.map(([key, val]) => {\n\t\t\t\treturn nextIndent + picocolors.dim(key) + picocolors.gray(\": \") + formatRecursive(val, depth + 1);\n\t\t\t}).join(joinPretty);\n\t\t\treturn picocolors.gray(`{${EOL}`) + props + EOL + currentIndent + picocolors.gray(\"}\");\n\t\t}\n\t\tif (isRegExp(input)) return picocolors.greenBright(\"/\") + picocolors.redBright(input.source) + picocolors.greenBright(\"/\") + picocolors.magentaBright(input.flags);\n\t\tif (isString(input)) return picocolors.gray(`\"${input}\"`);\n\t\tif (isNumber(input, { includeNaN: true })) return picocolors.redBright(String(input));\n\t\tif (isBoolean(input)) return picocolors.redBright(String(input));\n\t\tif (isNil(input)) return picocolors.redBright(String(input));\n\t\tif (isObject(input)) return picocolors.cyanBright(Object.prototype.toString.call(input));\n\t\treturn picocolors.cyanBright(String(input));\n\t}\n\treturn formatRecursive(value);\n}\nexport { isString as C, toArray as D, safeStableStringify as E, toObjectSet as O, isSet as S, normalizeSpaces as T, isNonEmptyString as _, joinLines as a, isPlainObject as b, picocolors as c, flattenStrings as d, isArray as f, isNil as g, isFunction as h, joinInline as i, toStringSet as k, plural as l, isError as m, NEWLINE as n, joinLinesLoose as o, isBoolean as p, formatOptionValue as r, padText as s, EOL as t, deepFreeze as u, isNull as v, isUndefined as w, isRegExp as x, isNumber as y };\n//# sourceMappingURL=formatter-BS3omf7k.js.map\n","","","import { joinLines, EOL } from \"@rzl-zone/build-tools/utils\";\n\nimport { punycodeUtilsJS } from \"@/urls/utils/punyCode\";\nimport { assertIsPlainObject } from \"@/assertions/objects/assertIsPlainObject\";\nimport { safeStableStringify } from \"@/conversions/stringify/safeStableStringify\";\n\nimport sldMap from \"./_private/data/domain/sldMap.json\";\nimport ccTldMap from \"./_private/data/domain/ccTldMap.json\";\n\nimport { isString } from \"./isString\";\nimport { isBoolean } from \"./isBoolean\";\n\nimport { getPreciseType } from \"../type/getPreciseType\";\n\n/** ---------------------------------------------------------\n * * ***Options for `isValidDomain` predicate.***\n * ---------------------------------------------------------\n * **Customize the behavior of domain validation.**\n */\ntype IsValidDomainOptions = {\n /** * ***Enable conversion of Unicode domains (IDN) to ASCII (punycode).***\n *\n * - Example: `\"пример.рф\"` ➔ `\"xn--e1afmkfd.xn--p1ai\"`\n * - Allows validating Unicode domains correctly.\n * - Default: `false`\n *\n * @defaultValue `false`.\n */\n allowUnicode?: boolean;\n\n /** * ***If `true`, validates **only top-level domains (TLDs)** that are not part of any SLD/second-level domain.***\n *\n * - Accepts country-code TLDs like `\"ai\"` or `\"ai.\"` ✅\n * - Rejects common TLDs that are part of SLDs like `\"com\"` ❌\n * - Only the final label is checked; subdomains are ignored.\n * - Default: `false`\n *\n * @defaultValue `false`.\n */\n topLevel?: boolean;\n\n /** * ***Allow or disallow subdomains.***\n *\n * - Example: `\"sub.example.com\"` ✅ if `subdomain` is `true`, ❌ if `false`\n * - Wildcards and SLDs are considered when evaluating subdomains.\n * - Default: `true`\n *\n * @defaultValue `true`.\n */\n subdomain?: boolean;\n\n /** * ***Allow a wildcard `*` in the left-most label.***\n *\n * - Example: `\"*.example.com\"` ✅ if `wildcard` is `true`, ❌ if `false`\n * - Wildcards are only valid in the first label and require at least one additional label.\n * - Default: `false`\n *\n * @defaultValue `false`.\n */\n wildcard?: boolean;\n\n /** * ***Allow a port after the domain.***\n *\n * - Example: `\"localhost:3000\"` or `\"example.com:8080\"` ✅ if `allowPort` is `true`\n * - Validates that the port is a number between `1` and `65535`.\n * - Does not affect domain validation rules otherwise.\n * - Default: `false`\n *\n * @defaultValue `false`.\n */\n allowPort?: boolean;\n\n /** * ***Allow special domains like `localhost`.***\n *\n * - Example: `\"localhost\"` ✅ if `allowLocalhost` is `true`\n * - Works with or without a port if `allowPort` is enabled.\n * - Default: `false`\n *\n * @defaultValue `false`.\n */\n allowLocalhost?: boolean;\n\n /** * ***Allow URLs with protocol (`http`/`https`) and automatically extract the hostname.***\n *\n * - Example: `\"https://example.com/foo/bar\"` ➔ `\"example.com\"`\n * - The function will validate only the hostname part and ignore the path, query, and fragment.\n * - Default: `false`\n *\n * @defaultValue `false`.\n */\n allowProtocol?: boolean;\n};\n\n/** ---------------------------------------------------------\n * * ***Predicate: `isValidDomain`.***\n * ---------------------------------------------------------\n * **Validates whether a given string is a properly formatted domain name.**\n *\n * - **Supports options for:**\n * - `allowUnicode` ➔ allows internationalized domain names (IDN) with Unicode characters.\n * - `topLevel` ➔ validates **only top-level domains (TLDs)**; ignores subdomains and SLDs.\n * - `subdomain` ➔ allows or disallows subdomains.\n * - `wildcard` ➔ allows wildcard (`*`) in the left-most label.\n * - `allowPort` ➔ allows a port number after the domain (e.g., `example.com:8080`).\n * - `allowLocalhost` ➔ allows the special domain `\"localhost\"`.\n * - `allowProtocol` ➔ allows a URL with protocol (`http`/`https`) and extracts the hostname.\n *\n * - **Behavior:**\n * - ✅ Converts Unicode to ASCII (punycode) if `allowUnicode` is `true`.\n * - ✅ Checks label lengths (≤63 chars), valid characters, and punycode consistency.\n * - ✅ Validates port if `allowPort` is `true` (must be 1–65535).\n * - ✅ Accepts `\"localhost\"` if `allowLocalhost` is `true`.\n * - ✅ Extracts hostname from URLs if `allowProtocol` is `true`.\n * - ❌ Rejects invalid domains, labels starting/ending with `-`, double dots, malformed TLDs, or invalid port numbers.\n * - ✅ Handles both standard domains (example.com), URLs with protocols (https://example.com/foo), and IDNs (пример.рф).\n *\n * @param {*} value - The value to validate; only strings are valid domains.\n * @param {IsValidDomainOptions} [options] - Optional configuration for domain validation.\n * @param {boolean} [options.allowUnicode=false] - Enable punycode conversion for Unicode domains.\n * @param {boolean} [options.topLevel=false] - Validate only TLDs (e.g., `ai`, `uk.`); ignores SLDs like `com`.\n * @param {boolean} [options.subdomain=true] - Allow subdomains; set `false` to reject any subdomain.\n * @param {boolean} [options.wildcard=false] - Allow wildcard `*` in the left-most label (e.g., `*.example.com`).\n * @param {boolean} [options.allowPort=false] - Allow port number after domain (e.g., `:3000`); must be 1–65535.\n * @param {boolean} [options.allowLocalhost=false] - Allow special domain `\"localhost\"`.\n * @param {boolean} [options.allowProtocol=false] - Allow URLs with protocol (`http`/`https`) and extract hostname only.\n * @returns {boolean} Returns `true` if the value is a valid domain according to the rules and options; otherwise `false`.\n *\n * @example\n * isValidDomain(\"google.com\");\n * // ➔ true\n * isValidDomain(\"пример.рф\", { allowUnicode: true });\n * // ➔ true\n * isValidDomain(\"sub.example.com\", { subdomain: false });\n * // ➔ false\n * isValidDomain(\"*.example.com\", { wildcard: true });\n * // ➔ true\n * isValidDomain(\"com\", { topLevel: true });\n * // ➔ false (common TLD rejected because it's part of SLD)\n * isValidDomain(\"ai.\", { topLevel: true });\n * // ➔ true (country-code TLD accepted)\n * isValidDomain(\"localhost\", { allowLocalhost: true });\n * // ➔ true\n * isValidDomain(\"localhost:3000\", { allowLocalhost: true, allowPort: true });\n * // ➔ true\n * isValidDomain(\"example.com:8080\", { allowPort: true });\n * // ➔ true\n * isValidDomain(\"https://example.com/foo/bar\", { allowProtocol: true });\n * // ➔ true (protocol stripped and hostname validated)\n * isValidDomain(\"invalid_domain.com\");\n * // ➔ false\n */\nexport function isValidDomain(\n value: unknown,\n options: IsValidDomainOptions = {}\n): boolean {\n if (!isString(value)) return false;\n\n assertIsPlainObject(options, {\n message: ({ currentType, validType }) =>\n `Second parameter (\\`options\\`) must be of type \\`${validType}\\`, but received: \\`${currentType}\\`.`\n });\n\n const {\n subdomain = true,\n topLevel = false,\n wildcard = false,\n allowUnicode = false,\n allowPort = false,\n allowLocalhost = false,\n allowProtocol = false\n } = options;\n\n // Validate Options:\n const invalid = Object.entries({\n subdomain,\n topLevel,\n wildcard,\n allowUnicode,\n allowProtocol,\n allowPort,\n allowLocalhost\n }).filter(([, value]) => !isBoolean(value));\n\n if (invalid.length) {\n const msg = invalid\n .map(([key, value], i) => {\n return joinLines(\n ` ${i + 1}. option: \"${key}\"`,\n \" expected: boolean\",\n ` received: ${getPreciseType(value)} (${safeStableStringify(\n value,\n {\n keepUndefined: true\n }\n )})`\n );\n })\n .join(EOL);\n\n throw new TypeError(\n joinLines(\n \"\",\n \"> Invalid options detected in second parameter of `isValidDomain`:\",\n msg\n )\n );\n }\n // -----------------\n\n let _value = value.toLowerCase();\n\n if (allowProtocol) {\n try {\n const url = new URL(value); // use original input\n if (url.protocol !== \"http:\" && url.protocol !== \"https:\") return false; // reject non-http(s)\n if (!allowPort && url.port) return false; // reject port if allowPort=false\n _value = url.hostname.toLowerCase(); // extract only hostname\n\n // wildcard check\n const labels = _value.split(\".\");\n if (labels[0] === \"*\" && !wildcard) return false;\n } catch {\n // if parsing fails, leave _value unchanged\n }\n }\n\n if (value.endsWith(\".\")) {\n _value = _value.slice(0, _value.length - 1);\n }\n\n // Handle port\n let port: string;\n if (allowPort) {\n const portMatch = _value.match(/:(\\d{1,5})$/);\n if (portMatch) {\n port = portMatch[0];\n _value = _value.slice(0, -port.length);\n const portNum = Number(portMatch[1]);\n if (portNum < 1 || portNum > 65535) return false;\n }\n }\n\n // Allow localhost\n if (allowLocalhost && _value === \"localhost\") return true;\n\n if (allowUnicode) {\n try {\n _value = punycodeUtilsJS.toASCII(_value);\n } catch {\n return false;\n }\n }\n\n if (_value.length > 253) return false;\n\n const validChars = /^([\\u0E00-\\u0E7Fa-z0-9-._*]+)$/g;\n if (!validChars.test(_value)) return false;\n\n if (topLevel) {\n if (ccTldMap[_value.replace(/\\.$/, \"\") as keyof typeof ccTldMap]) {\n return true;\n }\n }\n\n const sldRegex = /(.*)\\.(([\\u0E00-\\u0E7Fa-z0-9]+)(\\.[a-z0-9]+))/;\n const matches = _value.match(sldRegex);\n // eslint-disable-next-line no-useless-assignment\n let tld: string | null = null;\n let labels: string[] | null = null;\n\n if (matches && matches.length > 2) {\n if (sldMap[matches[2] as keyof typeof sldMap]) {\n // eslint-disable-next-line no-useless-assignment\n tld = matches[2] || null;\n labels = matches[1]?.split(\".\") || null;\n }\n }\n\n if (!labels) {\n labels = _value.split(\".\");\n if (labels.length <= 1) return false;\n\n tld = labels.pop()!;\n const tldRegex = /^(?:xn--)?(?!^\\d+$)[\\u0E00-\\u0E7Fa-z0-9]+$/gi;\n if (!tldRegex.test(tld)) return false;\n }\n\n if (subdomain === false && labels.length > 1) return false;\n\n return labels.every((label, index) => {\n if (wildcard && index === 0 && label === \"*\" && labels.length > 1) {\n return true;\n }\n\n let validLabelChars = /^([\\u0E00-\\u0E7Fa-zA-Z0-9-_]+)$/g;\n if (index === labels.length - 1) {\n validLabelChars = /^([\\u0E00-\\u0E7Fa-zA-Z0-9-]+)$/g;\n }\n\n const doubleDashCount = (label.match(/--(--)?/g) || []).length;\n const xnDashCount = (label.match(/xn--/g) || []).length;\n if (index === labels.length - 1 && doubleDashCount !== xnDashCount) {\n return false;\n }\n\n return (\n validLabelChars.test(label) &&\n label.length < 64 &&\n !label.startsWith(\"-\") &&\n !label.endsWith(\"-\")\n );\n });\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgBA,MAAa,SAAS,UAAiC;CACrD,OAAO,iBAAiB;;;;;;;;;;;;;;ACiC1B,SAAS,QAAQ,OAAO;CACvB,OAAO,MAAM,QAAQ,MAAM;;AAQ5B,SAAS,SAAS,OAAO;CACxB,OAAO,OAAO,UAAU,YAAY,CAAC,MAAM,MAAM,IAAI,CAAC,QAAQ,MAAM;;AAKrE,MAAM,SAAS,UAAU;CACxB,OAAO,SAAS;;AAQjB,MAAM,cAAc,UAAU;CAC7B,OAAO,OAAO,UAAU;;AA2IzB,MAAM,oBAAoB,UAAU,SAAS,MAAM,IAAI,WAAW,MAAM,QAAQ;AAChF,MAAM,0BAA0B;CAC/B,IAAI,CAAC,iBAAiB,WAAW,EAAE,OAAO,KAAK;CAC/C,OAAO,WAAW;;AAEnB,MAAM,qBAAqB,MAAM;CAChC,MAAM,IAAI,mBAAmB;CAC7B,IAAI,GAAG,OAAO;CACd,IAAI,OAAO,UAAU,aAAa,OAAO,IAAI,MAAM,GAAG,EAAE,IAAI,QAAQ,MAAM;EACzE,MAAM,KAAK,mBAAmB;EAC9B,OAAO,KAAK,GAAG,QAAQ,OAAO;IAC5B,CAAC;CACJ,OAAO;GACL,SAAS,IAAI;CACf,MAAM,IAAI,mBAAmB;CAC7B,IAAI,GAAG,OAAO,EAAE,KAAK,MAAM,GAAG;CAC9B,MAAM,IAAI,MAAM,4BAA4B,GAAG,mEAAmE;EACjH;AAEF,MAAM,UAAU,KAAK,OAAO;AAC5B,MAAM,MAAM,iBAAiB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C,IAAI,CAAC,kCAAW,KAAK,OAAO,EAAE,OAAO;CAErC,IAAI,UACF;MAAIA,iBAAS,OAAO,QAAQ,OAAO,GAAG,GACpC,OAAO;;CAKX,MAAM,UAAU,OAAO,MAAM,gDAAS;CAEtC,IAAI,MAAqB;CACzB,IAAI,SAA0B;CAE9B,IAAI,WAAW,QAAQ,SAAS,GAC9B;MAAIC,eAAO,QAAQ,KAA4B;GAE7C,MAAM,QAAQ,MAAM;GACpB,SAAS,QAAQ,IAAI,MAAM,IAAI,IAAI;;;CAIvC,IAAI,CAAC,QAAQ;EACX,SAAS,OAAO,MAAM,IAAI;EAC1B,IAAI,OAAO,UAAU,GAAG,OAAO;EAE/B,MAAM,OAAO,KAAK;EAElB,IAAI,CAAC,+CAAS,KAAK,IAAI,EAAE,OAAO;;CAGlC,IAAI,cAAc,SAAS,OAAO,SAAS,GAAG,OAAO;CAErD,OAAO,OAAO,OAAO,OAAO,UAAU;EACpC,IAAI,YAAY,UAAU,KAAK,UAAU,OAAO,OAAO,SAAS,GAC9D,OAAO;EAGT,IAAI,kBAAkB;EACtB,IAAI,UAAU,OAAO,SAAS,GAC5B,kBAAkB;EAGpB,MAAM,mBAAmB,MAAM,MAAM,WAAW,IAAI,EAAE,EAAE;EACxD,MAAM,eAAe,MAAM,MAAM,QAAQ,IAAI,EAAE,EAAE;EACjD,IAAI,UAAU,OAAO,SAAS,KAAK,oBAAoB,aACrD,OAAO;EAGT,OACE,gBAAgB,KAAK,MAAM,IAC3B,MAAM,SAAS,MACf,CAAC,MAAM,WAAW,IAAI,IACtB,CAAC,MAAM,SAAS,IAAI;GAEtB"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* ========================================================================
|
|
3
3
|
* @rzl-zone/utils-js
|
|
4
4
|
* ------------------------------------------------------------------------
|
|
5
|
-
* Version: `3.
|
|
5
|
+
* Version: `3.13.0-beta.2`
|
|
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
|
* ========================================================================
|
|
@@ -15,4 +15,4 @@ Object.defineProperty(exports, 'noop', {
|
|
|
15
15
|
return noop;
|
|
16
16
|
}
|
|
17
17
|
});
|
|
18
|
-
//# sourceMappingURL=noop-
|
|
18
|
+
//# sourceMappingURL=noop-7KrqC9DC.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"noop-
|
|
1
|
+
{"version":3,"file":"noop-7KrqC9DC.cjs","names":[],"sources":["../src/generators/utils/noop.ts"],"sourcesContent":["/**\n * --------------------------------------------------\n * * ***Utility: `noop`.***\n * --------------------------------------------------\n * **A no-operation function that performs no action.**\n *\n * @description\n * Commonly used as a **placeholder**, **default callback**, or **stub function**.\n *\n * - **Behavior**:\n * - Does not return any meaningful value (`void`).\n * - Safely callable in any context without side effects.\n *\n * @remarks\n * Although this function returns `void`, it implicitly results in `undefined`,\n * but the return value should never be relied upon.\n *\n * @example\n * **1. Basic usage** — does nothing and returns undefined implicitly:\n * ```\n * import { noop } from \"@rzl-zone/utils-js/generators\";\n *\n * noop(); // ➔ no effect (void)\n * ```\n * @example\n * **2. Using with type-checking helpers:**\n * ```ts\n * import { noop } from \"@rzl-zone/utils-js/generators\";\n * import { isFunction, isUndefined } from \"@rzl-zone/utils-js/predicates\";\n *\n * isFunction(noop); // ➔ true — `noop` is a function\n * isUndefined(noop()); // ➔ true — calling `noop()` returns `undefined`\n * isFunction(noop()); // ➔ false — the return value is `undefined`, not a function\n * ```\n * @example\n * **3. As a default callback:**\n * ```ts\n * import { noop } from \"@rzl-zone/utils-js/generators\";\n *\n * const callback = noop;\n * callback(); // ➔ no effect (void)\n * ```\n */\nexport const noop = (): void => {};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2CA,MAAa,aAAmB"}
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
* ========================================================================
|
|
3
3
|
* @rzl-zone/utils-js
|
|
4
4
|
* ------------------------------------------------------------------------
|
|
5
|
-
* Version: `3.
|
|
5
|
+
* Version: `3.13.0-beta.2`
|
|
6
6
|
* Author: `Rizalvin Dwiky <rizalvindwiky@gmail.com>`
|
|
7
7
|
* Repository: `https://github.com/rzl-zone/rzl-zone/tree/main/packages/utils-js`
|
|
8
8
|
* ========================================================================
|
|
9
9
|
*/
|
|
10
10
|
const noop = () => {};
|
|
11
11
|
export { noop as t };
|
|
12
|
-
//# sourceMappingURL=noop-
|
|
12
|
+
//# sourceMappingURL=noop-DGg9vMSD.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"noop-
|
|
1
|
+
{"version":3,"file":"noop-DGg9vMSD.js","names":[],"sources":["../src/generators/utils/noop.ts"],"sourcesContent":["/**\n * --------------------------------------------------\n * * ***Utility: `noop`.***\n * --------------------------------------------------\n * **A no-operation function that performs no action.**\n *\n * @description\n * Commonly used as a **placeholder**, **default callback**, or **stub function**.\n *\n * - **Behavior**:\n * - Does not return any meaningful value (`void`).\n * - Safely callable in any context without side effects.\n *\n * @remarks\n * Although this function returns `void`, it implicitly results in `undefined`,\n * but the return value should never be relied upon.\n *\n * @example\n * **1. Basic usage** — does nothing and returns undefined implicitly:\n * ```\n * import { noop } from \"@rzl-zone/utils-js/generators\";\n *\n * noop(); // ➔ no effect (void)\n * ```\n * @example\n * **2. Using with type-checking helpers:**\n * ```ts\n * import { noop } from \"@rzl-zone/utils-js/generators\";\n * import { isFunction, isUndefined } from \"@rzl-zone/utils-js/predicates\";\n *\n * isFunction(noop); // ➔ true — `noop` is a function\n * isUndefined(noop()); // ➔ true — calling `noop()` returns `undefined`\n * isFunction(noop()); // ➔ false — the return value is `undefined`, not a function\n * ```\n * @example\n * **3. As a default callback:**\n * ```ts\n * import { noop } from \"@rzl-zone/utils-js/generators\";\n *\n * const callback = noop;\n * callback(); // ➔ no effect (void)\n * ```\n */\nexport const noop = (): void => {};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2CA,MAAa,aAAmB"}
|
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
* ========================================================================
|
|
3
3
|
* @rzl-zone/utils-js
|
|
4
4
|
* ------------------------------------------------------------------------
|
|
5
|
-
* Version: `3.
|
|
5
|
+
* Version: `3.13.0-beta.2`
|
|
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_assertIsBoolean = require('./assertIsBoolean-
|
|
11
|
+
const require_assertIsBoolean = require('./assertIsBoolean-amRiJHnh.cjs');
|
|
12
12
|
const normalizeSpaces = (value, options = {
|
|
13
13
|
withTrim: true,
|
|
14
14
|
trimOnly: false
|
|
@@ -26,4 +26,4 @@ Object.defineProperty(exports, 'normalizeSpaces', {
|
|
|
26
26
|
return normalizeSpaces;
|
|
27
27
|
}
|
|
28
28
|
});
|
|
29
|
-
//# sourceMappingURL=normalizeSpaces-
|
|
29
|
+
//# sourceMappingURL=normalizeSpaces-B6ZQOZRX.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"normalizeSpaces-
|
|
1
|
+
{"version":3,"file":"normalizeSpaces-B6ZQOZRX.cjs","names":["isNonEmptyString","isPlainObject"],"sources":["../src/strings/sanitizations/normalizeSpaces.ts"],"sourcesContent":["import { isPlainObject } from \"@/predicates/is/isPlainObject\";\nimport { isNonEmptyString } from \"@/predicates/is/isNonEmptyString\";\n\ntype NormalizeSpacesOptions = {\n /** If `true`, skips normalization and only trims whitespace from start & end, defaultValue: `false`.\n *\n * @default false\n */\n trimOnly?: boolean;\n /** If `false`, skips trimming value, defaultValue: `true`.\n *\n * @default true\n */\n withTrim?: boolean;\n};\n\n/** ----------------------------------------------------------\n * * ***Utility: `normalizeSpaces`.***\n * ----------------------------------------------------------\n * **Normalizes whitespace in a string by reducing multiple spaces\n * to a single space, optionally trims, or only trims based on options.**\n * - **Behavior:**\n * - Collapses all consecutive whitespace (spaces, tabs, newlines) into a single space.\n * - Can trim leading/trailing spaces (default behavior), or preserve them with `withTrim: false`.\n * - Can skip normalization entirely and only trim using `trimOnly: true`.\n * - Returns an empty string if input is `null` or `undefined`.\n * @param {string | null | undefined} value - The input string to be processed. If `null` or `undefined`, returns an empty string.\n * @param {NormalizeSpacesOptions} [options] - Configuration options.\n * @param {NormalizeSpacesOptions[\"trimOnly\"]} [options.trimOnly=false] - If `true`, skips normalization and only trims the string.\n * @param {NormalizeSpacesOptions[\"withTrim\"]} [options.withTrim=true] - If `false`, preserves leading/trailing whitespace.\n * @returns {string} The processed string.\n * @example\n * normalizeSpaces(\" Hello World\\tthis is\\n\\nok \");\n * // ➔ \"Hello World this is ok\"\n * normalizeSpaces(\" Hello World\\tthis is\\n\\nok \", { trimOnly: true });\n * // ➔ \"Hello World\tthis is\\n\\nok\"\n * normalizeSpaces(\" Hello World \", { withTrim: false });\n * // ➔ \" Hello World \"\n * normalizeSpaces(null);\n * // ➔ \"\"\n */\nexport const normalizeSpaces = (\n value: string | null | undefined,\n options: NormalizeSpacesOptions = {\n withTrim: true,\n trimOnly: false\n }\n): string => {\n if (!isNonEmptyString(value)) return \"\";\n\n if (!isPlainObject(options)) {\n options = {};\n }\n\n const { trimOnly = false, withTrim = true } = options;\n\n if (trimOnly) return value.trim();\n\n if (withTrim) {\n value = value.trim();\n }\n\n // Remove all duplicate spaces (including tabs, newlines, etc.)\n return value.replace(/\\s+/g, \" \");\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyCA,MAAa,mBACX,OACA,UAAkC;CAChC,UAAU;CACV,UAAU;CACX,KACU;CACX,IAAI,CAACA,yCAAiB,MAAM,EAAE,OAAO;CAErC,IAAI,CAACC,sCAAc,QAAQ,EACzB,UAAU,EAAE;CAGd,MAAM,EAAE,WAAW,OAAO,WAAW,SAAS;CAE9C,IAAI,UAAU,OAAO,MAAM,MAAM;CAEjC,IAAI,UACF,QAAQ,MAAM,MAAM;CAItB,OAAO,MAAM,QAAQ,QAAQ,IAAI"}
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
* ========================================================================
|
|
3
3
|
* @rzl-zone/utils-js
|
|
4
4
|
* ------------------------------------------------------------------------
|
|
5
|
-
* Version: `3.
|
|
5
|
+
* Version: `3.13.0-beta.2`
|
|
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 isPlainObject, y as isNonEmptyString } from "./assertIsBoolean-
|
|
10
|
+
import { A as isPlainObject, y as isNonEmptyString } from "./assertIsBoolean-Bv6gL-xe.js";
|
|
11
11
|
const normalizeSpaces = (value, options = {
|
|
12
12
|
withTrim: true,
|
|
13
13
|
trimOnly: false
|
|
@@ -20,4 +20,4 @@ const normalizeSpaces = (value, options = {
|
|
|
20
20
|
return value.replace(/\s+/g, " ");
|
|
21
21
|
};
|
|
22
22
|
export { normalizeSpaces as t };
|
|
23
|
-
//# sourceMappingURL=normalizeSpaces-
|
|
23
|
+
//# sourceMappingURL=normalizeSpaces-C1eLwykD.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"normalizeSpaces-
|
|
1
|
+
{"version":3,"file":"normalizeSpaces-C1eLwykD.js","names":[],"sources":["../src/strings/sanitizations/normalizeSpaces.ts"],"sourcesContent":["import { isPlainObject } from \"@/predicates/is/isPlainObject\";\nimport { isNonEmptyString } from \"@/predicates/is/isNonEmptyString\";\n\ntype NormalizeSpacesOptions = {\n /** If `true`, skips normalization and only trims whitespace from start & end, defaultValue: `false`.\n *\n * @default false\n */\n trimOnly?: boolean;\n /** If `false`, skips trimming value, defaultValue: `true`.\n *\n * @default true\n */\n withTrim?: boolean;\n};\n\n/** ----------------------------------------------------------\n * * ***Utility: `normalizeSpaces`.***\n * ----------------------------------------------------------\n * **Normalizes whitespace in a string by reducing multiple spaces\n * to a single space, optionally trims, or only trims based on options.**\n * - **Behavior:**\n * - Collapses all consecutive whitespace (spaces, tabs, newlines) into a single space.\n * - Can trim leading/trailing spaces (default behavior), or preserve them with `withTrim: false`.\n * - Can skip normalization entirely and only trim using `trimOnly: true`.\n * - Returns an empty string if input is `null` or `undefined`.\n * @param {string | null | undefined} value - The input string to be processed. If `null` or `undefined`, returns an empty string.\n * @param {NormalizeSpacesOptions} [options] - Configuration options.\n * @param {NormalizeSpacesOptions[\"trimOnly\"]} [options.trimOnly=false] - If `true`, skips normalization and only trims the string.\n * @param {NormalizeSpacesOptions[\"withTrim\"]} [options.withTrim=true] - If `false`, preserves leading/trailing whitespace.\n * @returns {string} The processed string.\n * @example\n * normalizeSpaces(\" Hello World\\tthis is\\n\\nok \");\n * // ➔ \"Hello World this is ok\"\n * normalizeSpaces(\" Hello World\\tthis is\\n\\nok \", { trimOnly: true });\n * // ➔ \"Hello World\tthis is\\n\\nok\"\n * normalizeSpaces(\" Hello World \", { withTrim: false });\n * // ➔ \" Hello World \"\n * normalizeSpaces(null);\n * // ➔ \"\"\n */\nexport const normalizeSpaces = (\n value: string | null | undefined,\n options: NormalizeSpacesOptions = {\n withTrim: true,\n trimOnly: false\n }\n): string => {\n if (!isNonEmptyString(value)) return \"\";\n\n if (!isPlainObject(options)) {\n options = {};\n }\n\n const { trimOnly = false, withTrim = true } = options;\n\n if (trimOnly) return value.trim();\n\n if (withTrim) {\n value = value.trim();\n }\n\n // Remove all duplicate spaces (including tabs, newlines, etc.)\n return value.replace(/\\s+/g, \" \");\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyCA,MAAa,mBACX,OACA,UAAkC;CAChC,UAAU;CACV,UAAU;CACX,KACU;CACX,IAAI,CAAC,iBAAiB,MAAM,EAAE,OAAO;CAErC,IAAI,CAAC,cAAc,QAAQ,EACzB,UAAU,EAAE;CAGd,MAAM,EAAE,WAAW,OAAO,WAAW,SAAS;CAE9C,IAAI,UAAU,OAAO,MAAM,MAAM;CAEjC,IAAI,UACF,QAAQ,MAAM,MAAM;CAItB,OAAO,MAAM,QAAQ,QAAQ,IAAI"}
|
|
@@ -2,19 +2,19 @@
|
|
|
2
2
|
* ========================================================================
|
|
3
3
|
* @rzl-zone/utils-js
|
|
4
4
|
* ------------------------------------------------------------------------
|
|
5
|
-
* Version: `3.
|
|
5
|
+
* Version: `3.13.0-beta.2`
|
|
6
6
|
* Author: `Rizalvin Dwiky <rizalvindwiky@gmail.com>`
|
|
7
7
|
* Repository: `https://github.com/rzl-zone/rzl-zone/tree/main/packages/utils-js`
|
|
8
8
|
* ========================================================================
|
|
9
9
|
*/
|
|
10
10
|
"use strict";
|
|
11
11
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
12
|
-
const require_assertIsBoolean = require('../assertIsBoolean-
|
|
13
|
-
const require_assertIsArray = require('../assertIsArray-
|
|
14
|
-
const require_isEmptyObject = require('../isEmptyObject-
|
|
15
|
-
const require_safeStableStringify = require('../safeStableStringify-
|
|
16
|
-
const require_isEqual = require('../isEqual-
|
|
17
|
-
const require_safeJsonParse = require('../safeJsonParse-
|
|
12
|
+
const require_assertIsBoolean = require('../assertIsBoolean-amRiJHnh.cjs');
|
|
13
|
+
const require_assertIsArray = require('../assertIsArray-BqjMoan3.cjs');
|
|
14
|
+
const require_isEmptyObject = require('../isEmptyObject-CEySmyHK.cjs');
|
|
15
|
+
const require_safeStableStringify = require('../safeStableStringify-DRYQ56Dg.cjs');
|
|
16
|
+
const require_isEqual = require('../isEqual-UsvOwrlY.cjs');
|
|
17
|
+
const require_safeJsonParse = require('../safeJsonParse-BXbtX_j7.cjs');
|
|
18
18
|
const findDuplicates = (values) => {
|
|
19
19
|
require_assertIsArray.assertIsArray(values, { message: ({ currentType, validType }) => `First parameter (\`values\`) must be of type \`${validType}\` (array literal or instance), but received: \`${currentType}\`.` });
|
|
20
20
|
const duplicates = [];
|
|
@@ -41,13 +41,13 @@ const omitKeysDeep = (object, keysToOmit) => {
|
|
|
41
41
|
const omitAtPath = (obj, pathParts) => {
|
|
42
42
|
if (!require_assertIsBoolean.isObjectOrArray(obj)) return obj;
|
|
43
43
|
const [current, ...rest] = pathParts;
|
|
44
|
-
if (require_isEmptyObject.isEmptyArray(rest)) if (require_assertIsBoolean.isArray(obj)) {
|
|
44
|
+
if (require_isEmptyObject.isEmptyArray(rest) && current) if (require_assertIsBoolean.isArray(obj)) {
|
|
45
45
|
const index = parseInt(current);
|
|
46
46
|
if (!require_assertIsBoolean.isNaN(index) && index in obj) obj.splice(index, 1);
|
|
47
47
|
} else delete obj[current];
|
|
48
48
|
else {
|
|
49
|
-
const next = obj[current];
|
|
50
|
-
if (require_assertIsBoolean.isObjectOrArray(next)) obj[current] = omitAtPath(next, rest);
|
|
49
|
+
const next = current ? obj[current] : void 0;
|
|
50
|
+
if (require_assertIsBoolean.isObjectOrArray(next) && current) obj[current] = omitAtPath(next, rest);
|
|
51
51
|
}
|
|
52
52
|
return obj;
|
|
53
53
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["isEqual","isPlainObject","isPlainObject","isNonEmptyArray","safeStableStringify","isObjectOrArray","isEmptyArray","isArray","isNaN","isUndefined","safeJsonParse"],"sources":["../../src/operations/findDuplicates.ts","../../src/operations/omitKeys.ts","../../src/operations/omitKeysDeep.ts"],"sourcesContent":["import { isEqual } from \"@/predicates/is/isEqual\";\nimport { assertIsArray } from \"@/assertions/objects/assertIsArray\";\n\n/** ----------------------------------------------------------------------\n * * ***Utility: `findDuplicates`.***\n * ----------------------------------------------------------------------\n * **Finds duplicate values in an array by deep equality comparison.**\n * - **Behavior:**\n * - Uses ***`isEqual` utility function*** to compare elements\n * (handles objects, arrays, dates, NaN, etc.).\n * - Returns a new array containing only the *first occurrences* of duplicated values.\n * - Does **not mutate** the original array.\n * - Throws ***{@link TypeError | `TypeError`}*** if input is not an array.\n * @template T Type of elements in the input array.\n * @param {T[]} values - The array to check for duplicates.\n * @returns {T[]} An array of the duplicate values found in the input,\n * preserving order of their first duplicate appearance.\n * @throws **{@link TypeError | `TypeError`}** if the provided `values` argument is not an array.\n * @example\n * findDuplicates([1, 2, 2, 3, 4, 4]);\n * // ➔ [2, 4]\n * findDuplicates([\"apple\", \"banana\", \"apple\", \"orange\"]);\n * // ➔ [\"apple\"]\n * findDuplicates([{ a: 1 }, { a: 1 }, { a: 2 }]);\n * // ➔ [{ a: 1 }]\n * findDuplicates([NaN, NaN, 1]);\n * // ➔ [NaN]\n * findDuplicates([true, false, true]);\n * // ➔ [true]\n * findDuplicates([1, 2, 3]);\n * // ➔ []\n */\nexport const findDuplicates = <T>(values: T[]): T[] => {\n assertIsArray(values, {\n message: ({ currentType, validType }) =>\n `First parameter (\\`values\\`) must be of type \\`${validType}\\` (array literal or instance), but received: \\`${currentType}\\`.`\n });\n\n const duplicates: T[] = [];\n values.forEach((item, index) => {\n for (let i = index + 1; i < values.length; i++) {\n if (isEqual(item, values[i])) {\n if (!duplicates.some((dup) => isEqual(dup, item))) {\n duplicates.push(item);\n }\n break;\n }\n }\n });\n\n return duplicates;\n};\n","import { findDuplicates } from \"./findDuplicates\";\nimport { isPlainObject } from \"@/predicates/is/isPlainObject\";\nimport { assertIsArray } from \"@/assertions/objects/assertIsArray\";\n\n/** --------------------------------\n * * ***Utility: `omitKeys`.***\n * --------------------------------\n * **This function creates a shallow copy of the given object omitting the\n * specified keys.**\n * - **Behavior:**\n * - It will return a new object without mutating the original.\n * - It also validates that ***`keysToOmit`*** does not contain duplicate keys.\n * - **ℹ️ Internally:**\n * - It uses ***`isEqual`*** to check for duplicates in\n * the ***`keysToOmit`*** array.\n * @template I The type of the input object.\n * @template K The keys to omit from the object.\n * @param {I} object - The source object to omit keys from.\n * @param {K[]} keysToOmit - An array of keys to exclude from the returned object.\n * @returns {Omit<I, K>} A new object without the specified keys.\n * @throws **{@link TypeError | `TypeError`}** if `keysToOmit` is not an array.\n * @throws **{@link Error | `Error`}** if duplicate keys are found in `keysToOmit`.\n * @example\n * omitKeys({ a: 1, b: 2, c: 3 }, [\"b\", \"c\"]);\n * //➔ { a: 1 }\n * omitKeys({ name: \"John\", age: 30 }, [\"age\"]);\n * //➔ { name: \"John\" }\n * omitKeys({ a: 1, b: 2 }, []);\n * //➔ { a: 1, b: 2 } (no changes)\n */\nexport const omitKeys = <I extends Record<string, unknown>, K extends keyof I>(\n object: I,\n keysToOmit: K[]\n): Omit<I, K> => {\n if (!isPlainObject(object)) return {} as Omit<I, K>;\n\n assertIsArray(keysToOmit, {\n message: ({ currentType, validType }) =>\n `Second parameter (\\`keysToOmit\\`) must be of type \\`${validType}\\` (array literal or instance), but received: \\`${currentType}\\`.`\n });\n\n // Check for duplicate keys\n const duplicates = findDuplicates(keysToOmit);\n if (duplicates.length > 0) {\n throw new Error(\n `Function \"omitKeys\" Error: Duplicate keys detected - \\`${duplicates}\\``\n );\n }\n\n // Remove specified keys\n return Object.fromEntries(\n Object.entries(object).filter(([key]) => !keysToOmit.includes(key as K))\n ) as Omit<I, K>;\n};\n","import type { NumberRangeUnion } from \"@rzl-zone/ts-types-plus\";\n\nimport { findDuplicates } from \"./findDuplicates\";\n\nimport { isNaN } from \"@/predicates/is/isNaN\";\nimport { isArray } from \"@/predicates/is/isArray\";\nimport { isUndefined } from \"@/predicates/is/isUndefined\";\nimport { isEmptyArray } from \"@/predicates/is/isEmptyArray\";\nimport { isPlainObject } from \"@/predicates/is/isPlainObject\";\nimport { isNonEmptyArray } from \"@/predicates/is/isNonEmptyArray\";\nimport { isObjectOrArray } from \"@/predicates/is/isObjectOrArray\";\n\nimport { assertIsArray } from \"@/assertions/objects/assertIsArray\";\n\nimport { safeJsonParse } from \"@/conversions/json/safeJsonParse\";\nimport { safeStableStringify } from \"@/conversions/stringify/safeStableStringify\";\n\ntype IndexArray = NumberRangeUnion<0, 30>;\ntype DotPath<T, Prev extends string = \"\"> =\n T extends Array<infer U>\n ? DotPath<U, `${Prev}${Prev extends \"\" ? \"\" : \".\"}${IndexArray}`>\n : T extends object\n ? {\n [K in keyof T & string]:\n | `${Prev}${Prev extends \"\" ? \"\" : \".\"}${K}`\n | DotPath<T[K], `${Prev}${Prev extends \"\" ? \"\" : \".\"}${K}`>;\n }[keyof T & string]\n : never;\n\n/** ------------------------------------------------------\n * * ***Utility: `omitKeysDeep`.***\n * ------------------------------------------------------\n * **Recursively omits properties from an object using dot notation paths.**\n * - **Behavior:**\n * - Removes resulting empty objects (`{}`) and arrays (`[]`), cascading upwards\n * to remove empty parents until root if needed.\n * - **⚠️ Be careful:**\n * - If after omission an object or array becomes empty, it will be removed entirely\n * including all the way up to the root if necessary, resulting in `{}`.\n * - **ℹ️ Note:**\n * - For array indices, TypeScript autocomplete only suggests `0`–`30`\n * (to prevent editor lag on large unions).\n * However, higher indices are still fully supported at runtime — you can\n * manually type `\"arr.99.key\"` and it will work the same.\n * @template I - Type of the input object\n * @param {I} object\n * The object to process, should be a plain nested object or array structure.\n * @param {DotPath<I>[]} keysToOmit\n * An array of string paths in dot notation indicating the properties to remove, paths\n * can include numeric indices to target array elements, e.g. `\"arr.0.x\"` to\n * remove `x` from the first object inside the `arr` array.\n * @returns {Partial<I>}\n * A new deeply cloned object with the specified keys omitted, with resulting\n * empty objects or arrays fully removed (even if it collapses to `{}`).\n * @throws **{@link TypeError | `TypeError`}** if `keysToOmit` is not an array.\n * @throws **{@link Error | `Error`}** if `keysToOmit` contains duplicate paths.\n * @example\n * omitKeysDeep({ arr: [{ a: 1 }] }, [\"arr.0.a\"]);\n * // ➔ {} (array becomes empty and removed)\n * omitKeysDeep({ a: { b: { c: 1 }, d: 2 }, e: 3 }, [\"a.b.c\"]);\n * // ➔ { a: { d: 2 }, e: 3 }\n * omitKeysDeep({ a: [{ b: 1 }, { c: 2 }] }, [\"a.0.b\"]);\n * // ➔ { a: [{ c: 2 }] }\n * omitKeysDeep({ a: [{ b: 1 }] }, [\"a.0.b\"]);\n * // ➔ {} (array becomes empty and removed)\n * omitKeysDeep({ complex: [{ deep: [{ x: 1, y: 2 }] }] }, [\"complex.0.deep.0.x\"]);\n * // ➔ { complex: [{ deep: [{ y: 2 }] }] }\n * omitKeysDeep({ complex: [{ deep: [{ x: 1 }] }] }, [\"complex.0.deep.0.x\"]);\n * // ➔ {} (deep chain emptied and collapsed)\n * omitKeysDeep({ data: [[{ foo: 1, bar: 2 }]] }, [\"data.0.0.foo\"]);\n * // ➔ { data: [[{ bar: 2 }]] }\n * omitKeysDeep({ data: [[{ foo: 1 }]] }, [\"data.0.0.foo\"]);\n * // ➔ {} (nested arrays emptied completely)\n * omitKeysDeep({ x: [{ y: [{ z: 1 }, { w: 2 }] }] }, [\"x.0.y.0.z\"]);\n * // ➔ { x: [{ y: [{ w: 2 }] }] }\n * omitKeysDeep({ x: [{ y: [{ z: 1 }] }] }, [\"x.0.y.0.z\"]);\n * // ➔ {} (entire nested arrays removed)\n * omitKeysDeep({ p: { q: { r: 5 } }, s: 6 }, [\"p.q.r\"]);\n * // ➔ { s: 6 } (`p` removed because it becomes empty)\n * omitKeysDeep({ arr: [{ a: 1, b: 2 }, { c: 3 }] }, [\"arr.0.a\"]);\n * // ➔ { arr: [{ b: 2 }, { c: 3 }] }\n * omitKeysDeep({ root: [{ sub: [{ leaf: 10 }] }] }, [\"root.0.sub.0.leaf\"]);\n * // ➔ {} (deep nested arrays emptied to root)\n * omitKeysDeep({ meta: { tags: [\"x\", \"y\"], count: 2 } }, [\"meta.count\"]);\n * // ➔ { meta: { tags: [\"x\", \"y\"] } }\n * omitKeysDeep({ arr: [[{ a: 1 }, { b: 2 }]] }, [\"arr.0.0.a\"]);\n * // ➔ { arr: [[{ b: 2 }]] }\n * omitKeysDeep({ arr: [[{ a: 1 }]] }, [\"arr.0.0.a\"]);\n * // ➔ {} (double nested emptied)\n * omitKeysDeep({ nested: [{ list: [{ id: 1, val: 2 }] }] }, [\"nested.0.list.0.val\"]);\n * // ➔ { nested: [{ list: [{ id: 1 }] }] }\n * omitKeysDeep({ nested: [{ list: [{ id: 1 }] }] }, [\"nested.0.list.0.id\"]);\n * // ➔ {} (full collapse to empty)\n * omitKeysDeep({ mixed: { a: [1, 2, 3], b: { c: 4 } } }, [\"mixed.b.c\"]);\n * // ➔ { mixed: { a: [1, 2, 3] } }\n */\nexport const omitKeysDeep = <I extends Record<string, unknown>>(\n object: I,\n keysToOmit: DotPath<I>[]\n): Partial<I> => {\n if (!isPlainObject(object)) return {} as Partial<I>;\n\n assertIsArray(keysToOmit, {\n message: ({ currentType, validType }) =>\n `Second parameter (\\`keysToOmit\\`) must be of type \\`${validType}\\` (array literal or instance), but received: \\`${currentType}\\`.`\n });\n\n const duplicates = findDuplicates(keysToOmit);\n if (isNonEmptyArray(duplicates)) {\n throw new Error(\n `Function \"omitKeysDeep\" Error: Duplicate keys detected - \\`${safeStableStringify(\n duplicates,\n {\n keepUndefined: true\n }\n )}\\`.`\n );\n }\n\n const omitAtPath = (obj: unknown, pathParts: string[]) => {\n if (!isObjectOrArray(obj)) return obj;\n\n const [current, ...rest] = pathParts;\n\n if (isEmptyArray(rest)) {\n if (isArray(obj)) {\n // Support numeric index\n const index = parseInt(current);\n if (!isNaN(index) && index in obj) {\n obj.splice(index, 1);\n }\n } else {\n delete obj[current];\n }\n } else {\n const next = obj[current];\n if (isObjectOrArray(next)) {\n obj[current] = omitAtPath(next, rest);\n }\n }\n return obj;\n };\n\n const deepRemoveEmptyObjects = (obj: unknown): unknown => {\n if (isArray(obj)) {\n return obj\n .map(deepRemoveEmptyObjects)\n .filter(\n (item) => !(isObjectOrArray(item) && Object.keys(item).length === 0)\n );\n }\n if (isObjectOrArray(obj)) {\n const cleaned = Object.fromEntries(\n Object.entries(obj)\n .map(([k, v]) => [k, deepRemoveEmptyObjects(v)])\n .filter(\n ([, v]) =>\n !isUndefined(v) &&\n !(isObjectOrArray(v) && Object.keys(v).length === 0)\n )\n );\n return cleaned;\n }\n return obj;\n };\n\n const result = safeJsonParse(safeStableStringify(object)); // clone deep to avoid mutating original\n for (const key of keysToOmit) {\n const parts = key.split(\".\");\n omitAtPath(result, parts);\n }\n\n return deepRemoveEmptyObjects(result) as Partial<I>;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgCA,MAAa,kBAAqB,WAAqB;CACrD,oCAAc,QAAQ,EACpB,UAAU,EAAE,aAAa,gBACvB,kDAAkD,UAAU,kDAAkD,YAAY,MAC7H,CAAC;CAEF,MAAM,aAAkB,EAAE;CAC1B,OAAO,SAAS,MAAM,UAAU;EAC9B,KAAK,IAAI,IAAI,QAAQ,GAAG,IAAI,OAAO,QAAQ,KACzC,IAAIA,wBAAQ,MAAM,OAAO,GAAG,EAAE;GAC5B,IAAI,CAAC,WAAW,MAAM,QAAQA,wBAAQ,KAAK,KAAK,CAAC,EAC/C,WAAW,KAAK,KAAK;GAEvB;;GAGJ;CAEF,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACpBT,MAAa,YACX,QACA,eACe;CACf,IAAI,CAACC,sCAAc,OAAO,EAAE,OAAO,EAAE;CAErC,oCAAc,YAAY,EACxB,UAAU,EAAE,aAAa,gBACvB,uDAAuD,UAAU,kDAAkD,YAAY,MAClI,CAAC;CAGF,MAAM,aAAa,eAAe,WAAW;CAC7C,IAAI,WAAW,SAAS,GACtB,MAAM,IAAI,MACR,0DAA0D,WAAW,IACtE;CAIH,OAAO,OAAO,YACZ,OAAO,QAAQ,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC,WAAW,SAAS,IAAS,CAAC,CACzE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AAO,YAEhB,WAAW,QADG,IAAI,MAAM,IACA,CAAC;CAG3B,OAAO,uBAAuB,OAAO"}
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["isEqual","isPlainObject","isPlainObject","isNonEmptyArray","safeStableStringify","isObjectOrArray","isEmptyArray","isArray","isNaN","isUndefined","safeJsonParse"],"sources":["../../src/operations/findDuplicates.ts","../../src/operations/omitKeys.ts","../../src/operations/omitKeysDeep.ts"],"sourcesContent":["import { isEqual } from \"@/predicates/is/isEqual\";\nimport { assertIsArray } from \"@/assertions/objects/assertIsArray\";\n\n/** ----------------------------------------------------------------------\n * * ***Utility: `findDuplicates`.***\n * ----------------------------------------------------------------------\n * **Finds duplicate values in an array by deep equality comparison.**\n * - **Behavior:**\n * - Uses ***`isEqual` utility function*** to compare elements\n * (handles objects, arrays, dates, NaN, etc.).\n * - Returns a new array containing only the *first occurrences* of duplicated values.\n * - Does **not mutate** the original array.\n * - Throws ***{@link TypeError | `TypeError`}*** if input is not an array.\n * @template T Type of elements in the input array.\n * @param {T[]} values - The array to check for duplicates.\n * @returns {T[]} An array of the duplicate values found in the input,\n * preserving order of their first duplicate appearance.\n * @throws **{@link TypeError | `TypeError`}** if the provided `values` argument is not an array.\n * @example\n * findDuplicates([1, 2, 2, 3, 4, 4]);\n * // ➔ [2, 4]\n * findDuplicates([\"apple\", \"banana\", \"apple\", \"orange\"]);\n * // ➔ [\"apple\"]\n * findDuplicates([{ a: 1 }, { a: 1 }, { a: 2 }]);\n * // ➔ [{ a: 1 }]\n * findDuplicates([NaN, NaN, 1]);\n * // ➔ [NaN]\n * findDuplicates([true, false, true]);\n * // ➔ [true]\n * findDuplicates([1, 2, 3]);\n * // ➔ []\n */\nexport const findDuplicates = <T>(values: T[]): T[] => {\n assertIsArray(values, {\n message: ({ currentType, validType }) =>\n `First parameter (\\`values\\`) must be of type \\`${validType}\\` (array literal or instance), but received: \\`${currentType}\\`.`\n });\n\n const duplicates: T[] = [];\n values.forEach((item, index) => {\n for (let i = index + 1; i < values.length; i++) {\n if (isEqual(item, values[i])) {\n if (!duplicates.some((dup) => isEqual(dup, item))) {\n duplicates.push(item);\n }\n break;\n }\n }\n });\n\n return duplicates;\n};\n","import { findDuplicates } from \"./findDuplicates\";\nimport { isPlainObject } from \"@/predicates/is/isPlainObject\";\nimport { assertIsArray } from \"@/assertions/objects/assertIsArray\";\n\n/** --------------------------------\n * * ***Utility: `omitKeys`.***\n * --------------------------------\n * **This function creates a shallow copy of the given object omitting the\n * specified keys.**\n * - **Behavior:**\n * - It will return a new object without mutating the original.\n * - It also validates that ***`keysToOmit`*** does not contain duplicate keys.\n * - **ℹ️ Internally:**\n * - It uses ***`isEqual`*** to check for duplicates in\n * the ***`keysToOmit`*** array.\n * @template I The type of the input object.\n * @template K The keys to omit from the object.\n * @param {I} object - The source object to omit keys from.\n * @param {K[]} keysToOmit - An array of keys to exclude from the returned object.\n * @returns {Omit<I, K>} A new object without the specified keys.\n * @throws **{@link TypeError | `TypeError`}** if `keysToOmit` is not an array.\n * @throws **{@link Error | `Error`}** if duplicate keys are found in `keysToOmit`.\n * @example\n * omitKeys({ a: 1, b: 2, c: 3 }, [\"b\", \"c\"]);\n * //➔ { a: 1 }\n * omitKeys({ name: \"John\", age: 30 }, [\"age\"]);\n * //➔ { name: \"John\" }\n * omitKeys({ a: 1, b: 2 }, []);\n * //➔ { a: 1, b: 2 } (no changes)\n */\nexport const omitKeys = <I extends Record<string, unknown>, K extends keyof I>(\n object: I,\n keysToOmit: K[]\n): Omit<I, K> => {\n if (!isPlainObject(object)) return {} as Omit<I, K>;\n\n assertIsArray(keysToOmit, {\n message: ({ currentType, validType }) =>\n `Second parameter (\\`keysToOmit\\`) must be of type \\`${validType}\\` (array literal or instance), but received: \\`${currentType}\\`.`\n });\n\n // Check for duplicate keys\n const duplicates = findDuplicates(keysToOmit);\n if (duplicates.length > 0) {\n throw new Error(\n `Function \"omitKeys\" Error: Duplicate keys detected - \\`${duplicates}\\``\n );\n }\n\n // Remove specified keys\n return Object.fromEntries(\n Object.entries(object).filter(([key]) => !keysToOmit.includes(key as K))\n ) as Omit<I, K>;\n};\n","import type { NumberRangeUnion } from \"@rzl-zone/ts-types-plus\";\n\nimport { findDuplicates } from \"./findDuplicates\";\n\nimport { isNaN } from \"@/predicates/is/isNaN\";\nimport { isArray } from \"@/predicates/is/isArray\";\nimport { isUndefined } from \"@/predicates/is/isUndefined\";\nimport { isEmptyArray } from \"@/predicates/is/isEmptyArray\";\nimport { isPlainObject } from \"@/predicates/is/isPlainObject\";\nimport { isNonEmptyArray } from \"@/predicates/is/isNonEmptyArray\";\nimport { isObjectOrArray } from \"@/predicates/is/isObjectOrArray\";\n\nimport { assertIsArray } from \"@/assertions/objects/assertIsArray\";\n\nimport { safeJsonParse } from \"@/conversions/json/safeJsonParse\";\nimport { safeStableStringify } from \"@/conversions/stringify/safeStableStringify\";\n\ntype IndexArray = NumberRangeUnion<0, 30>;\ntype DotPath<T, Prev extends string = \"\"> =\n T extends Array<infer U>\n ? DotPath<U, `${Prev}${Prev extends \"\" ? \"\" : \".\"}${IndexArray}`>\n : T extends object\n ? {\n [K in keyof T & string]:\n | `${Prev}${Prev extends \"\" ? \"\" : \".\"}${K}`\n | DotPath<T[K], `${Prev}${Prev extends \"\" ? \"\" : \".\"}${K}`>;\n }[keyof T & string]\n : never;\n\n/** ------------------------------------------------------\n * * ***Utility: `omitKeysDeep`.***\n * ------------------------------------------------------\n * **Recursively omits properties from an object using dot notation paths.**\n * - **Behavior:**\n * - Removes resulting empty objects (`{}`) and arrays (`[]`), cascading upwards\n * to remove empty parents until root if needed.\n * - **⚠️ Be careful:**\n * - If after omission an object or array becomes empty, it will be removed entirely\n * including all the way up to the root if necessary, resulting in `{}`.\n * - **ℹ️ Note:**\n * - For array indices, TypeScript autocomplete only suggests `0`–`30`\n * (to prevent editor lag on large unions).\n * However, higher indices are still fully supported at runtime — you can\n * manually type `\"arr.99.key\"` and it will work the same.\n * @template I - Type of the input object\n * @param {I} object\n * The object to process, should be a plain nested object or array structure.\n * @param {DotPath<I>[]} keysToOmit\n * An array of string paths in dot notation indicating the properties to remove, paths\n * can include numeric indices to target array elements, e.g. `\"arr.0.x\"` to\n * remove `x` from the first object inside the `arr` array.\n * @returns {Partial<I>}\n * A new deeply cloned object with the specified keys omitted, with resulting\n * empty objects or arrays fully removed (even if it collapses to `{}`).\n * @throws **{@link TypeError | `TypeError`}** if `keysToOmit` is not an array.\n * @throws **{@link Error | `Error`}** if `keysToOmit` contains duplicate paths.\n * @example\n * omitKeysDeep({ arr: [{ a: 1 }] }, [\"arr.0.a\"]);\n * // ➔ {} (array becomes empty and removed)\n * omitKeysDeep({ a: { b: { c: 1 }, d: 2 }, e: 3 }, [\"a.b.c\"]);\n * // ➔ { a: { d: 2 }, e: 3 }\n * omitKeysDeep({ a: [{ b: 1 }, { c: 2 }] }, [\"a.0.b\"]);\n * // ➔ { a: [{ c: 2 }] }\n * omitKeysDeep({ a: [{ b: 1 }] }, [\"a.0.b\"]);\n * // ➔ {} (array becomes empty and removed)\n * omitKeysDeep({ complex: [{ deep: [{ x: 1, y: 2 }] }] }, [\"complex.0.deep.0.x\"]);\n * // ➔ { complex: [{ deep: [{ y: 2 }] }] }\n * omitKeysDeep({ complex: [{ deep: [{ x: 1 }] }] }, [\"complex.0.deep.0.x\"]);\n * // ➔ {} (deep chain emptied and collapsed)\n * omitKeysDeep({ data: [[{ foo: 1, bar: 2 }]] }, [\"data.0.0.foo\"]);\n * // ➔ { data: [[{ bar: 2 }]] }\n * omitKeysDeep({ data: [[{ foo: 1 }]] }, [\"data.0.0.foo\"]);\n * // ➔ {} (nested arrays emptied completely)\n * omitKeysDeep({ x: [{ y: [{ z: 1 }, { w: 2 }] }] }, [\"x.0.y.0.z\"]);\n * // ➔ { x: [{ y: [{ w: 2 }] }] }\n * omitKeysDeep({ x: [{ y: [{ z: 1 }] }] }, [\"x.0.y.0.z\"]);\n * // ➔ {} (entire nested arrays removed)\n * omitKeysDeep({ p: { q: { r: 5 } }, s: 6 }, [\"p.q.r\"]);\n * // ➔ { s: 6 } (`p` removed because it becomes empty)\n * omitKeysDeep({ arr: [{ a: 1, b: 2 }, { c: 3 }] }, [\"arr.0.a\"]);\n * // ➔ { arr: [{ b: 2 }, { c: 3 }] }\n * omitKeysDeep({ root: [{ sub: [{ leaf: 10 }] }] }, [\"root.0.sub.0.leaf\"]);\n * // ➔ {} (deep nested arrays emptied to root)\n * omitKeysDeep({ meta: { tags: [\"x\", \"y\"], count: 2 } }, [\"meta.count\"]);\n * // ➔ { meta: { tags: [\"x\", \"y\"] } }\n * omitKeysDeep({ arr: [[{ a: 1 }, { b: 2 }]] }, [\"arr.0.0.a\"]);\n * // ➔ { arr: [[{ b: 2 }]] }\n * omitKeysDeep({ arr: [[{ a: 1 }]] }, [\"arr.0.0.a\"]);\n * // ➔ {} (double nested emptied)\n * omitKeysDeep({ nested: [{ list: [{ id: 1, val: 2 }] }] }, [\"nested.0.list.0.val\"]);\n * // ➔ { nested: [{ list: [{ id: 1 }] }] }\n * omitKeysDeep({ nested: [{ list: [{ id: 1 }] }] }, [\"nested.0.list.0.id\"]);\n * // ➔ {} (full collapse to empty)\n * omitKeysDeep({ mixed: { a: [1, 2, 3], b: { c: 4 } } }, [\"mixed.b.c\"]);\n * // ➔ { mixed: { a: [1, 2, 3] } }\n */\nexport const omitKeysDeep = <I extends Record<string, unknown>>(\n object: I,\n keysToOmit: DotPath<I>[]\n): Partial<I> => {\n if (!isPlainObject(object)) return {} as Partial<I>;\n\n assertIsArray(keysToOmit, {\n message: ({ currentType, validType }) =>\n `Second parameter (\\`keysToOmit\\`) must be of type \\`${validType}\\` (array literal or instance), but received: \\`${currentType}\\`.`\n });\n\n const duplicates = findDuplicates(keysToOmit);\n if (isNonEmptyArray(duplicates)) {\n throw new Error(\n `Function \"omitKeysDeep\" Error: Duplicate keys detected - \\`${safeStableStringify(\n duplicates,\n {\n keepUndefined: true\n }\n )}\\`.`\n );\n }\n\n const omitAtPath = (obj: unknown, pathParts: string[]) => {\n if (!isObjectOrArray(obj)) return obj;\n\n const [current, ...rest] = pathParts;\n\n if (isEmptyArray(rest) && current) {\n if (isArray(obj)) {\n // Support numeric index\n const index = parseInt(current);\n if (!isNaN(index) && index in obj) {\n obj.splice(index, 1);\n }\n } else {\n delete obj[current];\n }\n } else {\n const next = current ? obj[current] : undefined;\n if (isObjectOrArray(next) && current) {\n obj[current] = omitAtPath(next, rest);\n }\n }\n return obj;\n };\n\n const deepRemoveEmptyObjects = (obj: unknown): unknown => {\n if (isArray(obj)) {\n return obj\n .map(deepRemoveEmptyObjects)\n .filter(\n (item) => !(isObjectOrArray(item) && Object.keys(item).length === 0)\n );\n }\n if (isObjectOrArray(obj)) {\n const cleaned = Object.fromEntries(\n Object.entries(obj)\n .map(([k, v]) => [k, deepRemoveEmptyObjects(v)])\n .filter(\n ([, v]) =>\n !isUndefined(v) &&\n !(isObjectOrArray(v) && Object.keys(v).length === 0)\n )\n );\n return cleaned;\n }\n return obj;\n };\n\n const result = safeJsonParse(safeStableStringify(object)); // clone deep to avoid mutating original\n for (const key of keysToOmit) {\n const parts = key.split(\".\");\n omitAtPath(result, parts);\n }\n\n return deepRemoveEmptyObjects(result) as Partial<I>;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgCA,MAAa,kBAAqB,WAAqB;CACrD,oCAAc,QAAQ,EACpB,UAAU,EAAE,aAAa,gBACvB,kDAAkD,UAAU,kDAAkD,YAAY,MAC7H,CAAC;CAEF,MAAM,aAAkB,EAAE;CAC1B,OAAO,SAAS,MAAM,UAAU;EAC9B,KAAK,IAAI,IAAI,QAAQ,GAAG,IAAI,OAAO,QAAQ,KACzC,IAAIA,wBAAQ,MAAM,OAAO,GAAG,EAAE;GAC5B,IAAI,CAAC,WAAW,MAAM,QAAQA,wBAAQ,KAAK,KAAK,CAAC,EAC/C,WAAW,KAAK,KAAK;GAEvB;;GAGJ;CAEF,OAAO;;;;;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