@rzl-zone/utils-js 2.1.0 → 3.0.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (128) hide show
  1. package/dist/NumberRangeUnion-DC-C3_Kq.d.ts +26 -0
  2. package/dist/any-BmdI8UbK.d.ts +67 -0
  3. package/dist/array-CIZRbqTF.d.ts +223 -0
  4. package/dist/arrays-normalize-recursive-CnjYJ9xg.d.ts +72 -0
  5. package/dist/assertions/index.cjs +1 -0
  6. package/dist/assertions/index.d.ts +428 -0
  7. package/dist/assertions/index.js +1 -0
  8. package/dist/chunk-2TRAPBZ7.cjs +1 -0
  9. package/dist/chunk-3D74QO5D.cjs +1 -0
  10. package/dist/chunk-4DK3RCC4.js +2 -0
  11. package/dist/chunk-4JOQ45HL.js +1 -0
  12. package/dist/chunk-55CZALRS.js +1 -0
  13. package/dist/chunk-56QBKKRE.js +1 -0
  14. package/dist/chunk-5JFV3GDE.cjs +4 -0
  15. package/dist/chunk-5SZUSNGZ.js +1 -0
  16. package/dist/chunk-62HX5Z45.cjs +1 -0
  17. package/dist/chunk-7NA6DUHR.cjs +2 -0
  18. package/dist/chunk-7YWAQOA4.cjs +1 -0
  19. package/dist/chunk-BVPMMWDL.cjs +1 -0
  20. package/dist/chunk-BYZAD3XN.cjs +1 -0
  21. package/dist/chunk-CEFYHEM4.cjs +1 -0
  22. package/dist/chunk-CN53M4QZ.cjs +1 -0
  23. package/dist/chunk-D47MHBSD.cjs +1 -0
  24. package/dist/chunk-DGH75GJD.js +1 -0
  25. package/dist/chunk-E5NUI7PN.js +1 -0
  26. package/dist/chunk-ELDDNERR.js +1 -0
  27. package/dist/chunk-EXZ47NOW.js +1 -0
  28. package/dist/chunk-FDITZ5C6.cjs +1 -0
  29. package/dist/chunk-FF76ISQ2.js +1 -0
  30. package/dist/chunk-FIEZKTAZ.cjs +1 -0
  31. package/dist/chunk-FSSV24W7.cjs +1 -0
  32. package/dist/chunk-G5LXIEFO.js +0 -0
  33. package/dist/chunk-GCGU2WB7.js +1 -0
  34. package/dist/chunk-GECI2YBP.js +1 -0
  35. package/dist/chunk-GQE4OVHC.cjs +1 -0
  36. package/dist/chunk-GRVZXQXL.cjs +1 -0
  37. package/dist/chunk-I4AVNHPA.cjs +1 -0
  38. package/dist/chunk-JFRL7NKU.js +4 -0
  39. package/dist/chunk-JWHM3WZQ.cjs +1 -0
  40. package/dist/chunk-KCQDDZJE.cjs +1 -0
  41. package/dist/chunk-L54ZPSYJ.js +1 -0
  42. package/dist/chunk-LVKAYEZ4.js +1 -0
  43. package/dist/chunk-MBDWTK54.cjs +1 -0
  44. package/dist/chunk-MMSYCIJ2.cjs +1 -0
  45. package/dist/chunk-MNGGDB2G.js +1 -0
  46. package/dist/chunk-MY7BA4GI.cjs +1 -0
  47. package/dist/chunk-N2IJPIND.cjs +1 -0
  48. package/dist/chunk-NIMNTEGV.js +1 -0
  49. package/dist/chunk-NNM7QCNB.js +1 -0
  50. package/dist/chunk-PUQXRLZH.cjs +1 -0
  51. package/dist/chunk-PVJF2JHM.js +1 -0
  52. package/dist/chunk-QCFXEUKL.js +1 -0
  53. package/dist/chunk-QFCGBBSY.js +1 -0
  54. package/dist/chunk-QQYAUPSK.cjs +1 -0
  55. package/dist/chunk-RN3TP3S3.js +1 -0
  56. package/dist/chunk-RV2VULM7.cjs +1 -0
  57. package/dist/chunk-SW6HYEW7.cjs +1 -0
  58. package/dist/chunk-SYJC7UAW.js +1 -0
  59. package/dist/chunk-TC4VBE4Y.cjs +1 -0
  60. package/dist/chunk-TUXDINHF.cjs +1 -0
  61. package/dist/chunk-U5Y2FXMN.cjs +1 -0
  62. package/dist/chunk-UUPQI6ND.cjs +1 -0
  63. package/dist/chunk-VYCGZ2S6.js +1 -0
  64. package/dist/chunk-W5EDKJK3.js +1 -0
  65. package/dist/chunk-WHAVUFEU.js +1 -0
  66. package/dist/chunk-XCFIOTCV.js +1 -0
  67. package/dist/chunk-XE27XPJR.js +1 -0
  68. package/dist/chunk-XH6MCRLP.js +1 -0
  69. package/dist/chunk-XVB3ZZEB.js +1 -0
  70. package/dist/chunk-ZBSIGJFO.cjs +1 -0
  71. package/dist/chunk-ZYAML74V.js +1 -0
  72. package/dist/conversions/index.cjs +1 -0
  73. package/dist/conversions/index.d.ts +1633 -0
  74. package/dist/conversions/index.js +1 -0
  75. package/dist/env/index.cjs +1 -0
  76. package/dist/env/index.d.ts +19 -0
  77. package/dist/env/index.js +1 -0
  78. package/dist/events/index.cjs +1 -0
  79. package/dist/events/index.d.ts +119 -0
  80. package/dist/events/index.js +1 -0
  81. package/dist/extends-Mp81Hq9-.d.ts +145 -0
  82. package/dist/formatting/index.cjs +1 -0
  83. package/dist/formatting/index.d.ts +912 -0
  84. package/dist/formatting/index.js +1 -0
  85. package/dist/generator/index.cjs +1 -0
  86. package/dist/generator/index.d.ts +163 -0
  87. package/dist/generator/index.js +1 -0
  88. package/dist/if-CvT4R7Kh.d.ts +18 -0
  89. package/dist/index.cjs +1 -1
  90. package/dist/index.d.ts +1 -4334
  91. package/dist/index.js +1 -1
  92. package/dist/is-array-Ckm_47hw.d.ts +1557 -0
  93. package/dist/isPlainObject-BKYaI6a8.d.ts +182 -0
  94. package/dist/never-BfayMBF9.d.ts +75 -0
  95. package/dist/next/index.cjs +8 -1
  96. package/dist/next/index.d.ts +169 -169
  97. package/dist/next/index.js +8 -1
  98. package/dist/next/server/index.cjs +2 -1
  99. package/dist/next/server/index.d.ts +37 -37
  100. package/dist/next/server/index.js +2 -1
  101. package/dist/nils-DMz3kU7M.d.ts +177 -0
  102. package/dist/omit-VvmIsZmX.d.ts +28 -0
  103. package/dist/operations/index.cjs +1 -0
  104. package/dist/operations/index.d.ts +182 -0
  105. package/dist/operations/index.js +1 -0
  106. package/dist/parsers/index.cjs +1 -0
  107. package/dist/parsers/index.d.ts +37 -0
  108. package/dist/parsers/index.js +1 -0
  109. package/dist/predicates/index.cjs +1 -0
  110. package/dist/predicates/index.d.ts +1839 -0
  111. package/dist/predicates/index.js +1 -0
  112. package/dist/prettify-C4xLcYOP.d.ts +353 -0
  113. package/dist/promise/index.cjs +1 -0
  114. package/dist/promise/index.d.ts +40 -0
  115. package/dist/promise/index.js +1 -0
  116. package/dist/rzl-utils.global.js +4 -1
  117. package/dist/strings/index.cjs +1 -0
  118. package/dist/strings/index.d.ts +816 -0
  119. package/dist/strings/index.js +1 -0
  120. package/dist/stylings/index.cjs +1 -0
  121. package/dist/stylings/index.d.ts +49 -0
  122. package/dist/stylings/index.js +1 -0
  123. package/dist/type-data-DDs-u2kq.d.ts +261 -0
  124. package/dist/types/index.d.ts +3589 -2090
  125. package/dist/urls/index.cjs +1 -0
  126. package/dist/urls/index.d.ts +418 -0
  127. package/dist/urls/index.js +1 -0
  128. package/package.json +147 -21
@@ -1 +1,8 @@
1
- function E(r){return Array.isArray(r)}var o=r=>typeof r=="string";var h=(r,e)=>{if(!o(r))return true;s(e)||(e={});let{trim:n=true}=e;return n&&(r=r.trim()),r===""};var d=r=>typeof r=="boolean";var $=r=>r instanceof Error;function T(r){return Array.isArray(r)&&r.length>0}function s(r){return typeof r=="object"&&!v(r)&&!E(r)}var p=(r,e)=>{if(!o(r))return false;s(e)||(e={});let{trim:n=true}=e;return(n?r.trim():r).length>0};var u=r=>typeof r>"u";function v(r){return r==null}var c=(r,e={trimOnly:false})=>{if(!p(r))return "";s(e)||(e={});let{trimOnly:n=false}=e;return n?r.trim():r.replace(/\s+/g,"")};var w=(r,e="/")=>{if(!p(e))throw new TypeError(`Invalid parameter:'defaultPath' must be a string and string is non-empty string. Received:${typeof e}(${e})`);if(!p(r))return e;try{if(r=c(r,{trimOnly:!0}),r=r.replace(/\s+/g,""),r.startsWith("http://")||r.startsWith("https://")){let n=new URL(r);return `${n.pathname}${n.search}${n.hash}`.replace(/^\/+/,"/")}return "/"+r.replace(/^\/+/,"").replace(/\/{2,}/g,"/")}catch(n){let t=$(n)?n:new Error("Unknown error from function `normalizePathname()`");throw new x(`Failed to normalize pathname in function \`normalizePathname()\`:${t.message}`,t)}};var y=(r,e)=>{if(!p(r))return "";if(!u(e)){if(!s(e))throw new TypeError("Options must be an object.");if("prefixColon"in e&&!d(e.prefixColon))throw new TypeError("Option `prefixColon` must be a boolean.")}let n=r.replace(/\D+/g,"");return n?e?.prefixColon??false?`:${n}`:n:""};var x=class r extends Error{constructor(n,t){super(n);this.originalError=t;this.name="NormalizePathnameError",Error.captureStackTrace&&Error.captureStackTrace(this,r);}};function G(r,e){if(!o(r)||h(r))throw new TypeError(`\u{1F6A8}'generateRoute' Failed:- Invalid 'route' value.- Expected a non-empty string,but received ${typeof r}:${JSON.stringify(r)}`);if(!r.includes("["))return r;if(!s(e))throw new Error(`\u{1F6A8}'generateRoute' Failed cause in route "${r}":- Missing or invalid parameters object for route:"${r}",expected an object mapping parameters.`);if(!e)throw new Error(`\u{1F6A8}'generateRoute' Failed cause in route "${r}":- Missing parameters object for route:"${r}"`);let n=["?","&","#","=","/"," ","'",'"',"(",")","+",";","%","@",":"],t=[],i=Array.from(r.matchAll(/\[(\w+)\]/g)).map(a=>a[1]);for(let a of i){let l=e[a];if(u(l)){t.push(`- Missing parameter:"${a}".`);continue}let f=l.trim();if(!f){t.push(`- Parameter "${a}" cannot be empty.`);continue}f.includes("/")&&t.push(`- Parameter "${a}" contains slashes "/" which is not allowed.`);let g=n.filter(m=>m!=="/").filter(m=>f.includes(m));g.length>0&&t.push(`- Parameter "${a}" contains invalid characters(${g.length>1?g.join(","):g}). These characters are not allowed because they could cause issues in URL structure. The following characters are forbidden in route parameters:(${n.join(",")}).`);}if(T(t))throw new Error(`\u{1F6A8}'generateRoute' Failed cause in route "${r}":${t.join(``)}`);return r.replace(/\[(\w+)\]/g,(a,l)=>e[l].trim().replace(/^\/+|\/+$/g,"")).replace(/\/+/g,"/")}var rr=(r="",e)=>{try{let f=function(m,P){return `${m.replace(/\/+$/,"")}/${P.replace(/^\/+/,"")}`};var n=f;if(!o(r))throw new TypeError(`Invalid type for 'pathname'. Expected 'string',received:${typeof r}`);s(e)||(e={});let{prefix:t="/api",withOrigin:i=!0}=e;if(!u(t)&&!o(t))throw new TypeError(`Invalid type for 'prefix'. Expected 'string',received:${typeof t}`);if(!d(i))throw new TypeError(`Invalid type for 'withOrigin'. Expected 'boolean',received:${typeof i}`);r=w(r),t=w(t);let a=t.endsWith("/")?t:t+"/";(r===t||r===t+"/"||r.startsWith(a))&&(r=r.slice(t.length),r=w(r));let l=b({suffix:t});return f(i?l:new URL(l).pathname,r).replace(/\/+$/,"")}catch(t){throw new Error("Failed to generate backend API URL in `createBeApiUrl()`,Error:"+t)}};var b=({suffix:r="/"}={})=>{if(!o(r))throw new TypeError(`Invalid type for 'suffix'. Expected string,received:${typeof r}`);try{let e=process.env.NEXT_PUBLIC_BACKEND_API_URL?.trim();if(e){e=c(e);let i=new URL(e);!!!i.port&&process.env.NEXT_PUBLIC_PORT_BE&&(e=i.origin+y(process.env.NEXT_PUBLIC_PORT_BE,{prefixColon:!0}));}else e="http://localhost"+y(process.env.NEXT_PUBLIC_PORT_BE||"8000",{prefixColon:!0});r=c(r).length?c(r):"/";let n=new URL(e.replace(/\/+$/,"")).origin,t=r==="/"?"/":`${r.startsWith("/")?"":"/"}${r.replace(/\/+$/,"")}`;return `${n}${t}`}catch(e){throw new Error("Invalid `NEXT_PUBLIC_BACKEND_API_URL`,failed to generate from `getBeApiUrl()`,Error:"+e)}};var or=()=>{try{let r=process.env.NEXT_PUBLIC_BASE_URL?.trim(),e=process.env.NEXT_PUBLIC_PORT_FE?.trim(),n=r||"http://localhost";n=c(n).replace(/\/+$/,"");let t=/:\/\/[^/]+:\d+/.test(n);!t&&e?n+=y(e,{prefixColon:!0}):!t&&!r&&(n+=":3000");let i=new URL(n);return `${i.protocol}//${i.hostname}${i.port?`:${i.port}`:""}`}catch(r){throw new Error("Invalid `NEXT_PUBLIC_BASE_URL`,failed to generate from `getBaseUrl()`,Error:"+r)}};export{rr as createBeApiUrl,G as generateRoute,or as getBaseUrl,b as getBeApiUrl};
1
+ import {c as c$2,d}from'../chunk-JFRL7NKU.js';import {c as c$3}from'../chunk-GECI2YBP.js';import {a}from'../chunk-NIMNTEGV.js';import {a as a$1}from'../chunk-XVB3ZZEB.js';import'../chunk-ELDDNERR.js';import {c}from'../chunk-MNGGDB2G.js';import'../chunk-5SZUSNGZ.js';import {h,E,m,c as c$1,r,p,f,k,G}from'../chunk-XCFIOTCV.js';function C(e,t){if(!h(e)||a(e))throw new TypeError(`\u274C 'generateRoute' Failed:
2
+ - Invalid 'route' value.
3
+ - Must be of type \`string\` and non-empty string, but received: "${E(e)}": \`${c(e)}\`.`);if(!/[\\[\]]/.test(e))return e;if(m(t,{message:({validType:o})=>`\u274C 'generateRoute' Failed cause in route "${e}":
4
+ - Missing or invalid parameters \`${o}\` for route: "${e}", must be of type \`${o}\` mapping parameters.`}),c$1(t))throw new TypeError(`\u274C 'generateRoute' Failed cause in route "${e}":
5
+ - Missing parameters \`plain-object\` for route: "${e}".`);let n=["?","&","#","=","/","'",'"',"(",")","+",";","%","@",":"],r$1=[],s=Array.from(e.matchAll(/\[(\w+)\]/g)).map(o=>o[1]);for(let o of s){let i=t[o];if(!h(i)){r$1.push(`- Invalid parameter: "${o}" must be of type \`string\`, but received: \`${E(i)}\`.`);continue}if(a(i)){r$1.push(`- Parameter "${o}" cannot be empty string.`);continue}let p=n.filter(g=>i.includes(g));if(/\s/.test(i)&&p.push("white-space(s)"),p.length>0){let g=p.map(a=>a==="`"?"backtick - (`)":`\`${a}\``);n.includes("white-space(s)")||n.push("white-space(s)");let c=n.map(a=>a==="`"?"backtick - (`)":`\`${a}\``);r$1.push(`- Parameter "${o}" contains invalid characters (${g.join(", ")}). These characters are not allowed because they could cause issues in URL structure. The following characters are forbidden in route parameters: (${c.join(", ")}).`);}}if(r(r$1))throw new Error(`\u274C 'generateRoute' Failed cause in route "${e}":
6
+ ${r$1.join(`
7
+ `)}.`);return e.replace(/\[(\w+)\]/g,(o,i)=>(p(t[i])?t[i]:"").trim().replace(/^\/+|\/+$/g,"")).replace(/\/+/g,"/")}var M=(e="",t)=>{try{let p=function(c,a){return `${c.replace(/\/+$/,"")}/${a.replace(/^\/+/,"")}`};var n=p;a$1(e,{message({currentType:c,validType:a}){return `First parameter \`pathname\` must be of type \`${a}\`, but received: \`${c}\`.`}}),f(t)||(t={});let{prefix:r="/api",withOrigin:s=!0}=t;if(!k(r)&&!h(r))throw new TypeError(`Parameter \`prefix\` property of the \`options\` (second parameter) must be of type \`string\`, but received: ${E(r)}.`);G(s,{message:({currentType:c,validType:a})=>`Parameter \`withOrigin\` property of the \`options\` (second parameter) must be of type \`${a}\`, but received: \`${c}\`.`}),e=c$2(e),r=c$2(r);let o=r.endsWith("/")?r:r+"/";(e===r||e===r+"/"||e.startsWith(o))&&(e=e.slice(r.length),e=c$2(e));let i=U({suffix:r});return p(s?i:new URL(i).pathname,e).replace(/\/+$/,"")}catch(r){throw new Error("Failed to generate backend API URL in `createBeApiUrl()`, Error:"+r)}};var U=({suffix:e="/"}={})=>{a$1(e,{message({currentType:t,validType:n}){return `Parameter \`suffix\` property of the first parameter must be of type \`${n}\`, but received: \`${t}\`.`}});try{let t=process.env.NEXT_PUBLIC_BACKEND_API_URL?.trim();if(t){t=c$3(t);let s=new URL(t);!!!s.port&&process.env.NEXT_PUBLIC_PORT_BE&&(t=s.origin+d(process.env.NEXT_PUBLIC_PORT_BE,{prefixColon:!0}));}else t="http://localhost"+d(process.env.NEXT_PUBLIC_PORT_BE||"8000",{prefixColon:!0});e=c$3(e).length?c$3(e):"/";let n=new URL(t.replace(/\/+$/,"")).origin,r=e==="/"?"/":`${e.startsWith("/")?"":"/"}${e.replace(/\/+$/,"")}`;return `${n}${r}`}catch(t){throw new Error("Invalid `NEXT_PUBLIC_BACKEND_API_URL`, failed to generate from `getBeApiUrl()`, Error:"+t)}};var Z=()=>{try{let e=process.env.NEXT_PUBLIC_BASE_URL?.trim(),t=process.env.NEXT_PUBLIC_PORT_FE?.trim(),n=e||"http://localhost";n=c$3(n).replace(/\/+$/,"");let r=/:\/\/[^/]+:\d+/.test(n);!r&&t?n+=d(t,{prefixColon:!0}):!r&&!e&&(n+=":3000");let s=new URL(n);return `${s.protocol}//${s.hostname}${s.port?`:${s.port}`:""}`}catch(e){throw new Error("Invalid `NEXT_PUBLIC_BASE_URL`, failed to generate from `getBaseUrl()`, Error:"+e)}};
8
+ export{M as createBeApiUrl,C as generateRoute,Z as getBaseUrl,U as getBeApiUrl};
@@ -1 +1,2 @@
1
- 'use strict';require('server-only');var server=require('next/server');var n=t=>typeof t=="boolean";var i=t=>typeof t=="function";var m=(t,o=true)=>{if(!i(server.NextRequest))throw new Error("`getClientIpOrUrl` is designed to be used in a `Next.js` environment.");if(!(t instanceof server.NextRequest))throw new TypeError("Argument `request` must be an instance of NextRequest.");if(!n(o))throw new TypeError("Expected `includeFullUrl` to be a boolean.");let e=(t.headers.get("x-forwarded-for")??"127.0.0.1").trim().split(",");(e[0]==="::ffff:127.0.0.1"||e[0]==="::1")&&(e[0]="127.0.0.1");let r=e.length>1?e[e.length-1].trim():e[0];if(!o)return r;let p=t.headers.get("x-forwarded-proto")||"http",f=t.headers.get("x-forwarded-port")||"3000";return `${process.env.NODE_ENV=="production"?p:"http"}://${r}:${f}`};exports.getClientIpOrUrl=m;
1
+ 'use strict';var chunkCN53M4QZ_cjs=require('../../chunk-CN53M4QZ.cjs');require('server-only');var server=require('next/server');var g=(t,r=true)=>{if(!chunkCN53M4QZ_cjs.b(server.NextRequest))throw new Error("Function `getClientIpOrUrl` is designed to be used in a `Next.js` environment.");if(!(t instanceof server.NextRequest))throw new TypeError("First parameter `request` must be an instance of NextRequest.");chunkCN53M4QZ_cjs.G(r,{message:({currentType:a,validType:d})=>`Second parameter \`includeFullUrl\` must be of type \`${d}\`, but received: \`${a}\`.`});let e=(t.headers.get("x-forwarded-for")??"127.0.0.1").trim().split(",");(e[0]==="::ffff:127.0.0.1"||e[0]==="::1")&&(e[0]="127.0.0.1");let o=e.length>1?e[e.length-1].trim():e[0];if(!r)return o;let p=t.headers.get("x-forwarded-proto")||"http",f=t.headers.get("x-forwarded-port")||"3000";return `${process.env.NODE_ENV==="production"?p:"http"}://${o}:${f}`};
2
+ exports.getClientIpOrUrl=g;
@@ -1,42 +1,42 @@
1
- import{NextRequest}from 'next/server';
1
+ import{NextRequest}from'next/server';
2
2
  /** ---------------------------------
3
- * * ***Retrieves the real client IP address and constructs the full URL using headers like***
4
- * ***`x-forwarded-for`, `x-forwarded-proto`, and `x-forwarded-port`.***
5
- * ---------------------------------
6
- *
7
- * * ⚠️ **Notes:**
8
- * - Only supported in **Next.js** environments (specifically in `server-only` contexts).
9
- * - Should be used in **middleware** or **server actions** that have access to `NextRequest`.
10
- *
11
- *
12
- * @param {NextRequest} request - The incoming Next.js request object.
13
- * @param {boolean} [includeFullUrl=true] - Whether to return the full URL (`protocol://ip:port`) or just the IP address.
14
- *
15
- * @returns {string} The extracted client IP address or the full constructed URL.
16
- *
17
- * @throws {Error} If the function is used outside a Next.js server environment.
18
- * @throws {TypeError} If the arguments do not match the expected types.
19
- *
20
- * @example
21
- * // Basic usage in Next.js middleware
22
- * import { NextRequest } from "next/server";
23
- * import { getClientIpOrUrl } from "@rzl-zone/utils-js/next/server";
24
- *
25
- * export function middleware(request: NextRequest) {
26
- * const clientIp = getClientIpOrUrl(request, false);
27
- * console.log("Client IP:", clientIp);
28
- * }
29
- *
30
- * @example
31
- * // Get full URL
32
- * const url = getClientIpOrUrl(request);
33
- * console.log("Client full URL:", url);
34
- */
3
+ * * ***Retrieves the real client IP address and constructs the full URL using headers like***
4
+ * ***`x-forwarded-for`, `x-forwarded-proto`, and `x-forwarded-port`.***
5
+ * ---------------------------------
6
+ *
7
+ * * ⚠️ **Notes:**
8
+ * - Only supported in **Next.js** environments (specifically in `server-only` contexts).
9
+ * - Should be used in **middleware** or **server actions** that have access to `NextRequest`.
10
+ *
11
+ *
12
+ * @param {NextRequest} request - The incoming Next.js request object.
13
+ * @param {boolean} [includeFullUrl=true] - Whether to return the full URL (`protocol://ip:port`) or just the IP address.
14
+ *
15
+ * @returns {string} The extracted client IP address or the full constructed URL.
16
+ *
17
+ * @throws {Error} If the function is used outside a Next.js server environment.
18
+ * @throws {TypeError} If the arguments do not match the expected types.
19
+ *
20
+ * @example
21
+ * // Basic usage in Next.js middleware
22
+ * import { NextRequest } from "next/server";
23
+ * import { getClientIpOrUrl } from "@rzl-zone/utils-js/next/server";
24
+ *
25
+ * export function middleware(request: NextRequest) {
26
+ * const clientIp = getClientIpOrUrl(request, false);
27
+ * console.log("Client IP:", clientIp);
28
+ * }
29
+ *
30
+ * @example
31
+ * // Get full URL
32
+ * const url = getClientIpOrUrl(request);
33
+ * console.log("Client full URL:", url);
34
+ */
35
35
  declare const getClientIpOrUrl:(
36
36
  /** * The incoming Next.js request object. */
37
37
  request:NextRequest,
38
38
  /** * Whether to return the full URL (protocol, IP, and port) or just the IP address.
39
- *
40
- * @default true
41
- */
42
- includeFullUrl?:boolean)=>string;export{getClientIpOrUrl};
39
+ *
40
+ * @default true
41
+ */
42
+ includeFullUrl?:boolean)=>string;export{getClientIpOrUrl};
@@ -1 +1,2 @@
1
- import'server-only';import{NextRequest}from'next/server';var n=t=>typeof t=="boolean";var i=t=>typeof t=="function";var m=(t,o=true)=>{if(!i(NextRequest))throw new Error("`getClientIpOrUrl` is designed to be used in a `Next.js` environment.");if(!(t instanceof NextRequest))throw new TypeError("Argument `request` must be an instance of NextRequest.");if(!n(o))throw new TypeError("Expected `includeFullUrl` to be a boolean.");let e=(t.headers.get("x-forwarded-for")??"127.0.0.1").trim().split(",");(e[0]==="::ffff:127.0.0.1"||e[0]==="::1")&&(e[0]="127.0.0.1");let r=e.length>1?e[e.length-1].trim():e[0];if(!o)return r;let p=t.headers.get("x-forwarded-proto")||"http",f=t.headers.get("x-forwarded-port")||"3000";return `${process.env.NODE_ENV=="production"?p:"http"}://${r}:${f}`};export{m as getClientIpOrUrl};
1
+ import {b,G}from'../../chunk-XCFIOTCV.js';import'server-only';import {NextRequest}from'next/server';var g=(t,r=true)=>{if(!b(NextRequest))throw new Error("Function `getClientIpOrUrl` is designed to be used in a `Next.js` environment.");if(!(t instanceof NextRequest))throw new TypeError("First parameter `request` must be an instance of NextRequest.");G(r,{message:({currentType:a,validType:d})=>`Second parameter \`includeFullUrl\` must be of type \`${d}\`, but received: \`${a}\`.`});let e=(t.headers.get("x-forwarded-for")??"127.0.0.1").trim().split(",");(e[0]==="::ffff:127.0.0.1"||e[0]==="::1")&&(e[0]="127.0.0.1");let o=e.length>1?e[e.length-1].trim():e[0];if(!r)return o;let p=t.headers.get("x-forwarded-proto")||"http",f=t.headers.get("x-forwarded-port")||"3000";return `${process.env.NODE_ENV==="production"?p:"http"}://${o}:${f}`};
2
+ export{g as getClientIpOrUrl};
@@ -0,0 +1,177 @@
1
+ /** --------------------------------------------------
2
+ * * ***Nullish.***
3
+ * --------------------------------------------------
4
+ * Represents all values considered **"nullish"**:
5
+ * - `null`
6
+ * - `undefined`
7
+ *
8
+ * Useful as a shorthand when working with optional or missing values.
9
+ */
10
+ type Nullish=null|undefined;
11
+ /** --------------------------------------------------
12
+ * * ***Nullable.***
13
+ * --------------------------------------------------
14
+ * Represents a type that can be either `T` or `null`.
15
+ *
16
+ * @template T - The base type.
17
+ *
18
+ * @example
19
+ * ```ts
20
+ * type A = Nullable<string>; // ➔ string | null
21
+ * ```
22
+ */
23
+ type Nullable<T>=T|null;
24
+ /** --------------------------------------------------
25
+ * * ***Nilable.***
26
+ * --------------------------------------------------
27
+ * Represents a type that can be either `T`, `null`, or `undefined`.
28
+ *
29
+ * @template T - The base type.
30
+ *
31
+ * @example
32
+ * ```ts
33
+ * type A = Nilable<number>; // ➔ number | null | undefined
34
+ * ```
35
+ */
36
+ type Nilable<T>=T|null|undefined;
37
+ /** --------------------------------------------------
38
+ * * ***Undefinedable.***
39
+ * --------------------------------------------------
40
+ * Represents a type that can be either `T` or `undefined`.
41
+ *
42
+ * @template T - The base type.
43
+ *
44
+ * @example
45
+ * ```ts
46
+ * type A = Undefinedable<boolean>; // ➔ boolean | undefined
47
+ * ```
48
+ */
49
+ type Undefinedable<T>=T|undefined;
50
+ /** -------------------------------------------------------
51
+ * * ***NonNil.***
52
+ * -------------------------------------------------------
53
+ * Removes both `null` and `undefined` from the given type `T`.
54
+ *
55
+ * @template T - The type to filter.
56
+ *
57
+ * @example
58
+ * ```ts
59
+ * type A = NonNil<string | null | undefined>;
60
+ * // ➔ string
61
+ *
62
+ * type B = NonNil<number | null>;
63
+ * // ➔ number
64
+ *
65
+ * type C = NonNil<undefined | null>;
66
+ * // ➔ never
67
+ *
68
+ * type D = NonNil<boolean | undefined>;
69
+ * // ➔ boolean
70
+ * ```
71
+ */
72
+ type NonNil<T>=T extends null|undefined?never:T;
73
+ /** -------------------------------------------------------
74
+ * * ***NonNull.***
75
+ * -------------------------------------------------------
76
+ * Removes `null` from the given type `T`.
77
+ *
78
+ * @template T - The type to filter.
79
+ *
80
+ * @example
81
+ * ```ts
82
+ * type A = NonNull<string | null>;
83
+ * // ➔ string
84
+ *
85
+ * type B = NonNull<number | null | undefined>;
86
+ * // ➔ number | undefined
87
+ *
88
+ * type C = NonNull<null>;
89
+ * // ➔ never
90
+ * ```
91
+ */
92
+ type NonNull<T>=T extends null?never:T;
93
+ /** -------------------------------------------------------
94
+ * * ***NonUndefined.***
95
+ * -------------------------------------------------------
96
+ * Remove `undefined` from the given type `T`.
97
+ *
98
+ * @template T - The type to filter.
99
+ *
100
+ * @example
101
+ * ```ts
102
+ * type A = NonUndefined<string | undefined>;
103
+ * // ➔ string
104
+ *
105
+ * type B = NonUndefined<number | null | undefined>;
106
+ * // ➔ number | null
107
+ *
108
+ * type C = NonUndefined<undefined>;
109
+ * // ➔ never
110
+ * ```
111
+ */
112
+ type NonUndefined<T>=T extends undefined?never:T;
113
+ /** --------------------------------------------------
114
+ * * ***KeepNil.***
115
+ * --------------------------------------------------
116
+ *
117
+ * Keeps `null` and/or `undefined` in the output type
118
+ * **only if** they exist in the input type `T`.
119
+ * Otherwise, resolves to `never`.
120
+ *
121
+ * @template T - Input type to check for `null` and `undefined`.
122
+ *
123
+ * @example
124
+ * ```ts
125
+ * type A = KeepNil<string | null>; // ➔ null
126
+ * type B = KeepNil<number | undefined>; // ➔ undefined
127
+ * type C = KeepNil<string | null | undefined>; // ➔ null | undefined
128
+ * type D = KeepNil<boolean>; // ➔ never
129
+ * ```
130
+ */
131
+ type KeepNil<T>=(null extends T?null:never)|(undefined extends T?undefined:never);
132
+ /** --------------------------------------------------
133
+ * * ***KeepNull.***
134
+ * --------------------------------------------------
135
+ * Keeps `null` in the output type **only if** the input type `T` includes `null`.
136
+ * Otherwise resolves to `never`.
137
+ *
138
+ * @template T - Input type to check for `null`.
139
+ *
140
+ * @example
141
+ * ```ts
142
+ * type A = KeepNull<string | null>; // ➔ null
143
+ * type B = KeepNull<string>; // ➔ never
144
+ * ```
145
+ */
146
+ type KeepNull<T>=null extends T?null:never;
147
+ /** --------------------------------------------------
148
+ * * ***KeepUndef.***
149
+ * --------------------------------------------------
150
+ * Keeps `undefined` in the output type **only if** the input type `T` includes `undefined`.
151
+ * Otherwise resolves to `never`.
152
+ *
153
+ * @template T - Input type to check for `undefined`.
154
+ *
155
+ * @example
156
+ * ```ts
157
+ * type A = KeepUndef<number | undefined>; // ➔ undefined
158
+ * type B = KeepUndef<number>; // ➔ never
159
+ * ```
160
+ */
161
+ type KeepUndef<T>=undefined extends T?undefined:never;
162
+ /** -------------------------------------------------------
163
+ * * ***NullToUndefined.***
164
+ * -------------------------------------------------------
165
+ * Transforms `null` or `undefined` types into `undefined`, otherwise, returns the original type `T` unchanged.
166
+ *
167
+ * @template T - The input type to transform.
168
+ * @example
169
+ * ```ts
170
+ * type A = NullToUndefined<null>; // ➔ undefined
171
+ * type B = NullToUndefined<undefined>; // ➔ undefined
172
+ * type C = NullToUndefined<string>; // ➔ string
173
+ * type D = NullToUndefined<null[]>; // ➔ null[]
174
+ * type E = NullToUndefined<(string | null)[]>; // ➔ (string | null)[]
175
+ * ```
176
+ */
177
+ type NullToUndefined<T>=T extends null?undefined:T extends undefined?undefined:T;export type{KeepNil as K,NonUndefined as N,Undefinedable as U,KeepNull as a,KeepUndef as b,Nilable as c,NonNil as d,NonNull as e,Nullable as f,NullToUndefined as g,Nullish as h};
@@ -0,0 +1,28 @@
1
+ import{P as Prettify}from'./prettify-C4xLcYOP.js';
2
+ /** --------------------------------------------------
3
+ * * ***OmitStrict.***
4
+ * --------------------------------------------------
5
+ * Strictly omits keys `K` from type `T`, with optional flattening for readability using `Prettify`.
6
+ *
7
+ * ✅ Enhances autocomplete and type inspection clarity in editors.
8
+ * ✅ Optionally flattens nested intersections or mapped types into a cleaner shape.
9
+ *
10
+ * @template T - The original object type.
11
+ * @template K - The keys to omit from `T`.
12
+ * @template WithPrettify - Whether to prettify the result (default is `true`).
13
+ * @template WithPrettifyRecursive - Whether to prettify nested object properties recursively (default is `true`).
14
+ *
15
+ * @example
16
+ * ```ts
17
+ * type A = { a: number; b: string; c: boolean };
18
+ * type B = OmitStrict<A, 'b'>;
19
+ * // ➔ { a: number; c: boolean }
20
+ *
21
+ * type C = OmitStrict<A, 'b', false>;
22
+ * // ➔ Omit without prettifying, keeps intersection structure
23
+ *
24
+ * type D = OmitStrict<A, 'b', true, false>;
25
+ * // ➔ Prettifies only top level, does not recurse into nested objects
26
+ * ```
27
+ */
28
+ type OmitStrict<T,K extends keyof T,WithPrettify extends boolean=true,WithPrettifyRecursive extends boolean=true>=WithPrettify extends true?Prettify<Omit<T,K>,{recursive:WithPrettifyRecursive;}>:WithPrettify extends false?Omit<T,K>:never;export type{OmitStrict as O};
@@ -0,0 +1 @@
1
+ 'use strict';var chunkFSSV24W7_cjs=require('../chunk-FSSV24W7.cjs');require('../chunk-GRVZXQXL.cjs'),require('../chunk-KCQDDZJE.cjs'),require('../chunk-62HX5Z45.cjs'),require('../chunk-RV2VULM7.cjs'),require('../chunk-U5Y2FXMN.cjs'),require('../chunk-7YWAQOA4.cjs'),require('../chunk-CN53M4QZ.cjs');Object.defineProperty(exports,"findDuplicates",{enumerable:true,get:function(){return chunkFSSV24W7_cjs.a}});Object.defineProperty(exports,"omitKeys",{enumerable:true,get:function(){return chunkFSSV24W7_cjs.b}});Object.defineProperty(exports,"omitKeysDeep",{enumerable:true,get:function(){return chunkFSSV24W7_cjs.c}});Object.defineProperty(exports,"omitProps",{enumerable:true,get:function(){return chunkFSSV24W7_cjs.d}});
@@ -0,0 +1,182 @@
1
+ import{N as NumberRangeUnion}from'../NumberRangeUnion-DC-C3_Kq.js';
2
+ /** ----------------------------------------------------------------------
3
+ * * ***Finds duplicate values in an array by deep equality comparison.***
4
+ * ----------------------------------------------------------------------
5
+ *
6
+ * - ✔ Uses `isEqual` to compare elements (handles objects, arrays, dates, NaN, etc.)
7
+ * - ✔ Returns a new array containing only the *first occurrences* of duplicated values.
8
+ * - ✔ Does **not mutate** the original array.
9
+ * - ✔ Throws `TypeError` if input is not an array.
10
+ *
11
+ * @template T Type of elements in the input array.
12
+ * @param {T[]} values - The array to check for duplicates.
13
+ * @returns {T[]} An array of the duplicate values found in the input,
14
+ * preserving order of their first duplicate appearance.
15
+ *
16
+ * @throws {TypeError} If the provided `values` argument is not an array.
17
+ *
18
+ * @example
19
+ * findDuplicates([1, 2, 2, 3, 4, 4]); // => [2, 4]
20
+ * findDuplicates(["apple", "banana", "apple", "orange"]); // => ["apple"]
21
+ * findDuplicates([{ a: 1 }, { a: 1 }, { a: 2 }]); // => [{ a: 1 }]
22
+ * findDuplicates([NaN, NaN, 1]); // => [NaN]
23
+ * findDuplicates([true, false, true]); // => [true]
24
+ * findDuplicates([1, 2, 3]); // => []
25
+ */
26
+ declare const findDuplicates:<T>(values:T[])=>T[];
27
+ /** --------------------------------
28
+ * * ***Creates a new object excluding specified keys.***
29
+ * --------------------------------
30
+ * This function creates a shallow copy of the given object
31
+ * omitting the specified keys. It will return a new object
32
+ * without mutating the original.
33
+ *
34
+ * It also validates that `keysToOmit` does not contain duplicate keys.
35
+ *
36
+ * Internally, it uses `isEqual` to check for duplicates in the `keysToOmit` array.
37
+ *
38
+ * @template I The type of the input object.
39
+ * @template K The keys to omit from the object.
40
+ * @param {I} object - The source object to omit keys from.
41
+ * @param {K[]} keysToOmit - An array of keys to exclude from the returned object.
42
+ * @returns {Omit<I, K>} A new object without the specified keys.
43
+ *
44
+ * @throws {TypeError} If `keysToOmit` is not an array.
45
+ * @throws {Error} If duplicate keys are found in `keysToOmit`.
46
+ *
47
+ * @example
48
+ * omitKeys({ a: 1, b: 2, c: 3 }, ["b", "c"]);
49
+ * // => { a: 1 }
50
+ *
51
+ * @example
52
+ * omitKeys({ name: "John", age: 30 }, ["age"]);
53
+ * // => { name: "John" }
54
+ *
55
+ * @example
56
+ * omitKeys({ a: 1, b: 2 }, []);
57
+ * // => { a: 1, b: 2 } (no changes)
58
+ */
59
+ declare const omitKeys:<I extends Record<string,unknown>,K extends keyof I>(object:I,keysToOmit:K[])=>Omit<I,K>;type IndexArray=NumberRangeUnion<0,30>;type DotPath<T,Prev extends string="">=T extends Array<infer U>?DotPath<U,`${Prev}${Prev extends "" ? "" : "."}${IndexArray}`>:T extends object?{[K in keyof T & string]:`${Prev}${Prev extends "" ? "" : "."}${K}`|DotPath<T[K],`${Prev}${Prev extends "" ? "" : "."}${K}`>;}[keyof T & string]:never;
60
+ /** ------------------------------------------------------
61
+ * * Recursively omits properties from an object using dot notation paths.
62
+ * * Also removes resulting empty objects (`{}`) and arrays (`[]`),
63
+ * * cascading upwards to remove empty parents until root if needed.
64
+ * ------------------------------------------------------
65
+ *
66
+ * @template I - Type of the input object
67
+ *
68
+ * @param {I} object
69
+ * The object to process. Should be a plain nested object or array structure.
70
+ *
71
+ * @param {DotPath<I>[]} keysToOmit
72
+ * An array of string paths in dot notation indicating the properties to remove.
73
+ * Paths can include numeric indices to target array elements, e.g. `"arr.0.x"` to remove `x`
74
+ * from the first object inside the `arr` array.
75
+ *
76
+ * @returns {Partial<I>}
77
+ * A new deeply cloned object with the specified keys omitted,
78
+ * with resulting empty objects or arrays fully removed (even if it collapses to `{}`).
79
+ *
80
+ * @throws {TypeError}
81
+ * If `keysToOmit` is not an array will throw TypeError.
82
+ *
83
+ * @throws {Error}
84
+ * If `keysToOmit` contains duplicate paths will throw Error.
85
+ *
86
+ * @remarks
87
+ * ⚠️ Be careful: if after omission an object or array becomes empty, it will be removed entirely
88
+ * including all the way up to the root if necessary, resulting in `{}`.
89
+ *
90
+ * ⚠️ Note: For array indices, TypeScript autocomplete only suggests `0`–`30`
91
+ * (to prevent editor lag on large unions).
92
+ * However, higher indices are still fully supported at runtime — you can
93
+ * manually type `"arr.99.key"` and it will work the same.
94
+ *
95
+ * @example
96
+ * omitKeysDeep({ arr: [{ a: 1 }] }, ["arr.0.a"]);
97
+ * // → {} (array becomes empty and removed)
98
+ *
99
+ * @example
100
+ * omitKeysDeep({ a: { b: { c: 1 }, d: 2 }, e: 3 }, ["a.b.c"]);
101
+ * // → { a: { d: 2 }, e: 3 }
102
+ *
103
+ * @example
104
+ * omitKeysDeep({ a: [{ b: 1 }, { c: 2 }] }, ["a.0.b"]);
105
+ * // → { a: [{ c: 2 }] }
106
+ *
107
+ * @example
108
+ * omitKeysDeep({ a: [{ b: 1 }] }, ["a.0.b"]);
109
+ * // → {} (array becomes empty and removed)
110
+ *
111
+ * @example
112
+ * omitKeysDeep({ complex: [{ deep: [{ x: 1, y: 2 }] }] }, ["complex.0.deep.0.x"]);
113
+ * // → { complex: [{ deep: [{ y: 2 }] }] }
114
+ *
115
+ * @example
116
+ * omitKeysDeep({ complex: [{ deep: [{ x: 1 }] }] }, ["complex.0.deep.0.x"]);
117
+ * // → {} (deep chain emptied and collapsed)
118
+ *
119
+ * @example
120
+ * omitKeysDeep({ data: [[{ foo: 1, bar: 2 }]] }, ["data.0.0.foo"]);
121
+ * // → { data: [[{ bar: 2 }]] }
122
+ *
123
+ * @example
124
+ * omitKeysDeep({ data: [[{ foo: 1 }]] }, ["data.0.0.foo"]);
125
+ * // → {} (nested arrays emptied completely)
126
+ *
127
+ * @example
128
+ * omitKeysDeep({ x: [{ y: [{ z: 1 }, { w: 2 }] }] }, ["x.0.y.0.z"]);
129
+ * // → { x: [{ y: [{ w: 2 }] }] }
130
+ *
131
+ * @example
132
+ * omitKeysDeep({ x: [{ y: [{ z: 1 }] }] }, ["x.0.y.0.z"]);
133
+ * // → {} (entire nested arrays removed)
134
+ *
135
+ * @example
136
+ * omitKeysDeep({ p: { q: { r: 5 } }, s: 6 }, ["p.q.r"]);
137
+ * // → { s: 6 } (`p` removed because it becomes empty)
138
+ *
139
+ * @example
140
+ * omitKeysDeep({ arr: [{ a: 1, b: 2 }, { c: 3 }] }, ["arr.0.a"]);
141
+ * // → { arr: [{ b: 2 }, { c: 3 }] }
142
+ *
143
+ * @example
144
+ * omitKeysDeep({ root: [{ sub: [{ leaf: 10 }] }] }, ["root.0.sub.0.leaf"]);
145
+ * // → {} (deep nested arrays emptied to root)
146
+ *
147
+ * @example
148
+ * omitKeysDeep({ meta: { tags: ["x", "y"], count: 2 } }, ["meta.count"]);
149
+ * // → { meta: { tags: ["x", "y"] } }
150
+ *
151
+ * @example
152
+ * omitKeysDeep({ arr: [[{ a: 1 }, { b: 2 }]] }, ["arr.0.0.a"]);
153
+ * // → { arr: [[{ b: 2 }]] }
154
+ *
155
+ * @example
156
+ * omitKeysDeep({ arr: [[{ a: 1 }]] }, ["arr.0.0.a"]);
157
+ * // → {} (double nested emptied)
158
+ *
159
+ * @example
160
+ * omitKeysDeep({ nested: [{ list: [{ id: 1, val: 2 }] }] }, ["nested.0.list.0.val"]);
161
+ * // → { nested: [{ list: [{ id: 1 }] }] }
162
+ *
163
+ * @example
164
+ * omitKeysDeep({ nested: [{ list: [{ id: 1 }] }] }, ["nested.0.list.0.id"]);
165
+ * // → {} (full collapse to empty)
166
+ *
167
+ * @example
168
+ * omitKeysDeep({ mixed: { a: [1, 2, 3], b: { c: 4 } } }, ["mixed.b.c"]);
169
+ * // → { mixed: { a: [1, 2, 3] } }
170
+ */
171
+ declare const omitKeysDeep:<I extends Record<string,unknown>>(object:I,keysToOmit:DotPath<I>[])=>Partial<I>;
172
+ /** --------------------------------
173
+ * * Removes Property from PROPS Collection
174
+ * --------------------------------
175
+ * @description Becarefull put array in arrayException, If array is duplicated it will be throw an exception error
176
+ * @param object is Record as object (string,any)
177
+ * @param arrayExcept is Array exception []
178
+ * @returns
179
+ *
180
+ * @deprecated - Use `omitKeys` instead, this function will remove a next update.
181
+ */
182
+ declare const omitProps:<I extends Record<string,unknown>,S extends(keyof I)[]>(object:I,arrayExcept:S)=>Omit<I,S[number]>|undefined;export{findDuplicates,omitKeys,omitKeysDeep,omitProps};
@@ -0,0 +1 @@
1
+ export{a as findDuplicates,b as omitKeys,c as omitKeysDeep,d as omitProps}from'../chunk-GCGU2WB7.js';import'../chunk-PVJF2JHM.js';import'../chunk-W5EDKJK3.js';import'../chunk-QFCGBBSY.js';import'../chunk-SYJC7UAW.js';import'../chunk-MNGGDB2G.js';import'../chunk-5SZUSNGZ.js';import'../chunk-XCFIOTCV.js';
@@ -0,0 +1 @@
1
+ 'use strict';var chunkBYZAD3XN_cjs=require('../chunk-BYZAD3XN.cjs');require('../chunk-CN53M4QZ.cjs');Object.defineProperty(exports,"extractFileName",{enumerable:true,get:function(){return chunkBYZAD3XN_cjs.a}});
@@ -0,0 +1,37 @@
1
+ /** ----------------------------------------------------------
2
+ * * ***Extracts the base file name (without extension) from a given URL, file path, or file name.***
3
+ * ----------------------------------------------------------
4
+ *
5
+ * - ✅ Strips known extensions (including multi-part extensions such as `.tar.gz`, `.tar.bz2`, etc.).
6
+ * - ✅ Handles plain file names, local file paths, and full URLs seamlessly.
7
+ * - ✅ If the path ends with a `/`, returns an empty string `""` (represents a directory or empty segment).
8
+ * - ✅ If the input is empty, whitespace, or not a string, returns `undefined`.
9
+ * - ✅ Leaves unknown or unrecognized extensions intact (does not attempt to strip unknown file extensions).
10
+ *
11
+ * Behavior summary:
12
+ * - `extractFileName("https://example.com/file.txt")` → `"file"`
13
+ * - `extractFileName("/local/path/image.jpeg")` → `"image"`
14
+ * - `extractFileName("backup.archive.tar.gz")` → `"backup.archive"`
15
+ * - `extractFileName("folder/")` → `""`
16
+ * - `extractFileName("")` → `undefined`
17
+ * - `extractFileName("unknownfile.weirdext")` → `"unknownfile.weirdext"` (keeps unknown extension)
18
+ *
19
+ * This is particularly useful for displaying or logging file names
20
+ * without cluttering them with redundant extensions, while being careful
21
+ * not to accidentally truncate unfamiliar formats.
22
+ *
23
+ * @param {string} url - The URL, file system path, or plain file name to process.
24
+ * @returns {string | undefined} The file name without its extension(s),
25
+ * or `undefined` if input is invalid,
26
+ * or an empty string `""` if the path ends with `/`.
27
+ *
28
+ * @example
29
+ * extractFileName("document.pdf"); // "document"
30
+ * extractFileName("/files/archive.tar.gz"); // "archive"
31
+ * extractFileName("https://cdn.site.com/video.mp4"); // "video"
32
+ * extractFileName("folder/"); // ""
33
+ * extractFileName("strangefile.unknownext"); // "strangefile.unknownext"
34
+ * extractFileName(""); // undefined
35
+ * extractFileName(123); // undefined
36
+ */
37
+ declare const extractFileName:(url?:string|null)=>string|undefined;export{extractFileName};
@@ -0,0 +1 @@
1
+ export{a as extractFileName}from'../chunk-EXZ47NOW.js';import'../chunk-XCFIOTCV.js';
@@ -0,0 +1 @@
1
+ 'use strict';var chunk7NA6DUHR_cjs=require('../chunk-7NA6DUHR.cjs'),chunkFIEZKTAZ_cjs=require('../chunk-FIEZKTAZ.cjs'),chunkD47MHBSD_cjs=require('../chunk-D47MHBSD.cjs'),chunkUUPQI6ND_cjs=require('../chunk-UUPQI6ND.cjs'),chunkKCQDDZJE_cjs=require('../chunk-KCQDDZJE.cjs');require('../chunk-JWHM3WZQ.cjs');var chunkFDITZ5C6_cjs=require('../chunk-FDITZ5C6.cjs'),chunk2TRAPBZ7_cjs=require('../chunk-2TRAPBZ7.cjs');require('../chunk-BVPMMWDL.cjs');var chunkPUQXRLZH_cjs=require('../chunk-PUQXRLZH.cjs'),chunkU5Y2FXMN_cjs=require('../chunk-U5Y2FXMN.cjs'),chunk7YWAQOA4_cjs=require('../chunk-7YWAQOA4.cjs'),chunkCN53M4QZ_cjs=require('../chunk-CN53M4QZ.cjs');Object.defineProperty(exports,"areArraysEqual",{enumerable:true,get:function(){return chunk7NA6DUHR_cjs.a}});Object.defineProperty(exports,"areObjectsEqual",{enumerable:true,get:function(){return chunk7NA6DUHR_cjs.b}});Object.defineProperty(exports,"areURLsEqualPath",{enumerable:true,get:function(){return chunk7NA6DUHR_cjs.c}});Object.defineProperty(exports,"areURLsIdentical",{enumerable:true,get:function(){return chunk7NA6DUHR_cjs.d}});Object.defineProperty(exports,"arrayHasAnyMatch",{enumerable:true,get:function(){return chunk7NA6DUHR_cjs.h}});Object.defineProperty(exports,"doesKeyExist",{enumerable:true,get:function(){return chunk7NA6DUHR_cjs.g}});Object.defineProperty(exports,"isArguments",{enumerable:true,get:function(){return chunk7NA6DUHR_cjs.i}});Object.defineProperty(exports,"isArrayLike",{enumerable:true,get:function(){return chunk7NA6DUHR_cjs.k}});Object.defineProperty(exports,"isArrayLikeObject",{enumerable:true,get:function(){return chunk7NA6DUHR_cjs.l}});Object.defineProperty(exports,"isCurrencyLike",{enumerable:true,get:function(){return chunk7NA6DUHR_cjs.m}});Object.defineProperty(exports,"isDeepEqual",{enumerable:true,get:function(){return chunk7NA6DUHR_cjs.n}});Object.defineProperty(exports,"isElement",{enumerable:true,get:function(){return chunk7NA6DUHR_cjs.o}});Object.defineProperty(exports,"isEmpty",{enumerable:true,get:function(){return chunk7NA6DUHR_cjs.p}});Object.defineProperty(exports,"isEmptyDeep",{enumerable:true,get:function(){return chunk7NA6DUHR_cjs.q}});Object.defineProperty(exports,"isEqualWith",{enumerable:true,get:function(){return chunk7NA6DUHR_cjs.r}});Object.defineProperty(exports,"isLength",{enumerable:true,get:function(){return chunk7NA6DUHR_cjs.j}});Object.defineProperty(exports,"isMatch",{enumerable:true,get:function(){return chunk7NA6DUHR_cjs.t}});Object.defineProperty(exports,"isMatchWith",{enumerable:true,get:function(){return chunk7NA6DUHR_cjs.s}});Object.defineProperty(exports,"isNative",{enumerable:true,get:function(){return chunk7NA6DUHR_cjs.u}});Object.defineProperty(exports,"isObjectLoose",{enumerable:true,get:function(){return chunk7NA6DUHR_cjs.v}});Object.defineProperty(exports,"isSafeInteger",{enumerable:true,get:function(){return chunk7NA6DUHR_cjs.w}});Object.defineProperty(exports,"isValidURL",{enumerable:true,get:function(){return chunk7NA6DUHR_cjs.x}});Object.defineProperty(exports,"isWeakMap",{enumerable:true,get:function(){return chunk7NA6DUHR_cjs.y}});Object.defineProperty(exports,"textContainsAll",{enumerable:true,get:function(){return chunk7NA6DUHR_cjs.e}});Object.defineProperty(exports,"textContainsAny",{enumerable:true,get:function(){return chunk7NA6DUHR_cjs.f}});Object.defineProperty(exports,"isURL",{enumerable:true,get:function(){return chunkFIEZKTAZ_cjs.a}});Object.defineProperty(exports,"isNonEmptyValue",{enumerable:true,get:function(){return chunkD47MHBSD_cjs.a}});Object.defineProperty(exports,"isTypedArray",{enumerable:true,get:function(){return chunkD47MHBSD_cjs.b}});Object.defineProperty(exports,"isEmptyValue",{enumerable:true,get:function(){return chunkUUPQI6ND_cjs.a}});Object.defineProperty(exports,"isArrayBuffer",{enumerable:true,get:function(){return chunkKCQDDZJE_cjs.b}});Object.defineProperty(exports,"isEmptyArray",{enumerable:true,get:function(){return chunkKCQDDZJE_cjs.e}});Object.defineProperty(exports,"isEmptyObject",{enumerable:true,get:function(){return chunkKCQDDZJE_cjs.f}});Object.defineProperty(exports,"isEqual",{enumerable:true,get:function(){return chunkKCQDDZJE_cjs.d}});Object.defineProperty(exports,"isRegExp",{enumerable:true,get:function(){return chunkKCQDDZJE_cjs.a}});Object.defineProperty(exports,"isFinite",{enumerable:true,get:function(){return chunkFDITZ5C6_cjs.a}});Object.defineProperty(exports,"isEmptyString",{enumerable:true,get:function(){return chunk2TRAPBZ7_cjs.a}});Object.defineProperty(exports,"isInteger",{enumerable:true,get:function(){return chunkPUQXRLZH_cjs.a}});Object.defineProperty(exports,"isDate",{enumerable:true,get:function(){return chunkU5Y2FXMN_cjs.b}});Object.defineProperty(exports,"isMap",{enumerable:true,get:function(){return chunkU5Y2FXMN_cjs.a}});Object.defineProperty(exports,"isBigInt",{enumerable:true,get:function(){return chunk7YWAQOA4_cjs.a}});Object.defineProperty(exports,"getPreciseType",{enumerable:true,get:function(){return chunkCN53M4QZ_cjs.E}});Object.defineProperty(exports,"hasOwnProp",{enumerable:true,get:function(){return chunkCN53M4QZ_cjs.o}});Object.defineProperty(exports,"isArray",{enumerable:true,get:function(){return chunkCN53M4QZ_cjs.d}});Object.defineProperty(exports,"isBoolean",{enumerable:true,get:function(){return chunkCN53M4QZ_cjs.a}});Object.defineProperty(exports,"isBuffer",{enumerable:true,get:function(){return chunkCN53M4QZ_cjs.C}});Object.defineProperty(exports,"isError",{enumerable:true,get:function(){return chunkCN53M4QZ_cjs.D}});Object.defineProperty(exports,"isFunction",{enumerable:true,get:function(){return chunkCN53M4QZ_cjs.b}});Object.defineProperty(exports,"isNaN",{enumerable:true,get:function(){return chunkCN53M4QZ_cjs.n}});Object.defineProperty(exports,"isNil",{enumerable:true,get:function(){return chunkCN53M4QZ_cjs.c}});Object.defineProperty(exports,"isNonEmptyArray",{enumerable:true,get:function(){return chunkCN53M4QZ_cjs.r}});Object.defineProperty(exports,"isNonEmptyString",{enumerable:true,get:function(){return chunkCN53M4QZ_cjs.p}});Object.defineProperty(exports,"isNull",{enumerable:true,get:function(){return chunkCN53M4QZ_cjs.g}});Object.defineProperty(exports,"isNumber",{enumerable:true,get:function(){return chunkCN53M4QZ_cjs.i}});Object.defineProperty(exports,"isObject",{enumerable:true,get:function(){return chunkCN53M4QZ_cjs.e}});Object.defineProperty(exports,"isObjectOrArray",{enumerable:true,get:function(){return chunkCN53M4QZ_cjs.l}});Object.defineProperty(exports,"isPlainObject",{enumerable:true,get:function(){return chunkCN53M4QZ_cjs.f}});Object.defineProperty(exports,"isSet",{enumerable:true,get:function(){return chunkCN53M4QZ_cjs.q}});Object.defineProperty(exports,"isString",{enumerable:true,get:function(){return chunkCN53M4QZ_cjs.h}});Object.defineProperty(exports,"isSymbol",{enumerable:true,get:function(){return chunkCN53M4QZ_cjs.j}});Object.defineProperty(exports,"isUndefined",{enumerable:true,get:function(){return chunkCN53M4QZ_cjs.k}});