full-utils 3.0.1 → 3.0.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/dist/index.d.cts CHANGED
@@ -3041,32 +3041,32 @@ declare function strNull(value: unknown): {} | null;
3041
3041
  *
3042
3042
  * @example
3043
3043
  * // International format already valid
3044
- * formatToPhone('+380501234567'); // => "+380501234567"
3044
+ * strPhone('+380501234567'); // => "+380501234567"
3045
3045
  *
3046
3046
  * @example
3047
3047
  * // European "00" prefix
3048
- * formatToPhone('00442079460729'); // => "+442079460729"
3048
+ * strPhone('00442079460729'); // => "+442079460729"
3049
3049
  *
3050
3050
  * @example
3051
3051
  * // Local 10-digit number (default country +7)
3052
- * formatToPhone('9123456789'); // => "+79123456789"
3052
+ * strPhone('9123456789'); // => "+79123456789"
3053
3053
  *
3054
3054
  * @example
3055
3055
  * // With custom default country
3056
- * formatToPhone('9876543210', '+34'); // => "+349876543210"
3056
+ * strPhone('9876543210', '+34'); // => "+349876543210"
3057
3057
  *
3058
3058
  * @example
3059
3059
  * // Strings with spaces, punctuation, parentheses
3060
- * formatToPhone('(050) 123-45-67'); // => "+70501234567"
3061
- * formatToPhone('+1 (202) 555-0183'); // => "+12025550183"
3060
+ * strPhone('(050) 123-45-67'); // => "+70501234567"
3061
+ * strPhone('+1 (202) 555-0183'); // => "+12025550183"
3062
3062
  *
3063
3063
  * @example
3064
3064
  * // Invalid or ambiguous inputs
3065
- * formatToPhone(''); // => null
3066
- * formatToPhone('000123456'); // => null
3067
- * formatToPhone('abcdefgh'); // => null
3068
- * formatToPhone(null); // => null
3069
- * formatToPhone(true); // => null
3065
+ * strPhone(''); // => null
3066
+ * strPhone('000123456'); // => null
3067
+ * strPhone('abcdefgh'); // => null
3068
+ * strPhone(null); // => null
3069
+ * strPhone(true); // => null
3070
3070
  *
3071
3071
  * @see isStr
3072
3072
  * @see strTrim
@@ -3075,7 +3075,7 @@ declare function strNull(value: unknown): {} | null;
3075
3075
  * @public
3076
3076
  * @since 2.0.0
3077
3077
  */
3078
- declare function formatToPhone(value?: unknown, defaultCountry?: string): string | null;
3078
+ declare function strPhone(value?: unknown, defaultCountry?: string): string | null;
3079
3079
 
3080
3080
  /**
3081
3081
  * Trims, normalizes, and cleans up invisible characters from a string.
@@ -3255,4 +3255,4 @@ type UrlObj = {
3255
3255
 
3256
3256
  declare function urlObj(value?: string): UrlObj;
3257
3257
 
3258
- export { type JSONLike, type PasswordOptions, type TimeParts, arrFuncArgs, arrSplitPortions, boolNormalize, dateFloorMin, datePartsSec, dateSecParts, dateStr, formatToPhone, ipNumStr, ipStrNum, isArr, isArrFilled, isBool, isClass, isDate, isEmail, isExists, isFunc, isIpAddr, isMacAddr, isNum, isNumFloat, isNumN, isNumNZ, isNumP, isNumPZ, isObj, isObjFilled, isPassword, isPhone, isStr, isStrAscDesc, isStrBool, isStrFilled, isVar, jsonDecode, jsonEncode, jsonParse, jsonStrLike, numNormalize, strLowerCase, strNormalCase, strNormalize, strNull, strTrim, strUndefined, urlObj, wait };
3258
+ export { type JSONLike, type PasswordOptions, type TimeParts, arrFuncArgs, arrSplitPortions, boolNormalize, dateFloorMin, datePartsSec, dateSecParts, dateStr, ipNumStr, ipStrNum, isArr, isArrFilled, isBool, isClass, isDate, isEmail, isExists, isFunc, isIpAddr, isMacAddr, isNum, isNumFloat, isNumN, isNumNZ, isNumP, isNumPZ, isObj, isObjFilled, isPassword, isPhone, isStr, isStrAscDesc, isStrBool, isStrFilled, isVar, jsonDecode, jsonEncode, jsonParse, jsonStrLike, numNormalize, strLowerCase, strNormalCase, strNormalize, strNull, strPhone, strTrim, strUndefined, urlObj, wait };
package/dist/index.d.ts CHANGED
@@ -3041,32 +3041,32 @@ declare function strNull(value: unknown): {} | null;
3041
3041
  *
3042
3042
  * @example
3043
3043
  * // International format already valid
3044
- * formatToPhone('+380501234567'); // => "+380501234567"
3044
+ * strPhone('+380501234567'); // => "+380501234567"
3045
3045
  *
3046
3046
  * @example
3047
3047
  * // European "00" prefix
3048
- * formatToPhone('00442079460729'); // => "+442079460729"
3048
+ * strPhone('00442079460729'); // => "+442079460729"
3049
3049
  *
3050
3050
  * @example
3051
3051
  * // Local 10-digit number (default country +7)
3052
- * formatToPhone('9123456789'); // => "+79123456789"
3052
+ * strPhone('9123456789'); // => "+79123456789"
3053
3053
  *
3054
3054
  * @example
3055
3055
  * // With custom default country
3056
- * formatToPhone('9876543210', '+34'); // => "+349876543210"
3056
+ * strPhone('9876543210', '+34'); // => "+349876543210"
3057
3057
  *
3058
3058
  * @example
3059
3059
  * // Strings with spaces, punctuation, parentheses
3060
- * formatToPhone('(050) 123-45-67'); // => "+70501234567"
3061
- * formatToPhone('+1 (202) 555-0183'); // => "+12025550183"
3060
+ * strPhone('(050) 123-45-67'); // => "+70501234567"
3061
+ * strPhone('+1 (202) 555-0183'); // => "+12025550183"
3062
3062
  *
3063
3063
  * @example
3064
3064
  * // Invalid or ambiguous inputs
3065
- * formatToPhone(''); // => null
3066
- * formatToPhone('000123456'); // => null
3067
- * formatToPhone('abcdefgh'); // => null
3068
- * formatToPhone(null); // => null
3069
- * formatToPhone(true); // => null
3065
+ * strPhone(''); // => null
3066
+ * strPhone('000123456'); // => null
3067
+ * strPhone('abcdefgh'); // => null
3068
+ * strPhone(null); // => null
3069
+ * strPhone(true); // => null
3070
3070
  *
3071
3071
  * @see isStr
3072
3072
  * @see strTrim
@@ -3075,7 +3075,7 @@ declare function strNull(value: unknown): {} | null;
3075
3075
  * @public
3076
3076
  * @since 2.0.0
3077
3077
  */
3078
- declare function formatToPhone(value?: unknown, defaultCountry?: string): string | null;
3078
+ declare function strPhone(value?: unknown, defaultCountry?: string): string | null;
3079
3079
 
3080
3080
  /**
3081
3081
  * Trims, normalizes, and cleans up invisible characters from a string.
@@ -3255,4 +3255,4 @@ type UrlObj = {
3255
3255
 
3256
3256
  declare function urlObj(value?: string): UrlObj;
3257
3257
 
3258
- export { type JSONLike, type PasswordOptions, type TimeParts, arrFuncArgs, arrSplitPortions, boolNormalize, dateFloorMin, datePartsSec, dateSecParts, dateStr, formatToPhone, ipNumStr, ipStrNum, isArr, isArrFilled, isBool, isClass, isDate, isEmail, isExists, isFunc, isIpAddr, isMacAddr, isNum, isNumFloat, isNumN, isNumNZ, isNumP, isNumPZ, isObj, isObjFilled, isPassword, isPhone, isStr, isStrAscDesc, isStrBool, isStrFilled, isVar, jsonDecode, jsonEncode, jsonParse, jsonStrLike, numNormalize, strLowerCase, strNormalCase, strNormalize, strNull, strTrim, strUndefined, urlObj, wait };
3258
+ export { type JSONLike, type PasswordOptions, type TimeParts, arrFuncArgs, arrSplitPortions, boolNormalize, dateFloorMin, datePartsSec, dateSecParts, dateStr, ipNumStr, ipStrNum, isArr, isArrFilled, isBool, isClass, isDate, isEmail, isExists, isFunc, isIpAddr, isMacAddr, isNum, isNumFloat, isNumN, isNumNZ, isNumP, isNumPZ, isObj, isObjFilled, isPassword, isPhone, isStr, isStrAscDesc, isStrBool, isStrFilled, isVar, jsonDecode, jsonEncode, jsonParse, jsonStrLike, numNormalize, strLowerCase, strNormalCase, strNormalize, strNull, strPhone, strTrim, strUndefined, urlObj, wait };
package/dist/index.mjs CHANGED
@@ -1,2 +1,2 @@
1
- function Q(t){if(!s(t))return [t];let r=t.trim();if(r==="")return [];if(r.startsWith("[")&&r.endsWith("]")&&(r=r.slice(1,-1).trim(),r===""))return [];let n="",e=false,o=null,i=false,f=0,l=0,d=0,k=[],g=()=>{let m=n.trim();m!==""&&k.push(m),n="";};for(let m=0;m<r.length;m++){let u=r[m];if(e){if(n+=u,i){i=false;continue}if(u==="\\"){i=true;continue}u===o&&(e=false,o=null);continue}if(u==='"'||u==="'"){e=true,o=u,n+=u;continue}if(u==="("){f++,n+=u;continue}if(u===")"){f=Math.max(0,f-1),n+=u;continue}if(u==="["){l++,n+=u;continue}if(u==="]"){l=Math.max(0,l-1),n+=u;continue}if(u==="{"){d++,n+=u;continue}if(u==="}"){d=Math.max(0,d-1),n+=u;continue}if(u===","&&f===0&&l===0&&d===0){g();continue}n+=u;}return n.length&&g(),k.map(m=>{if(m.startsWith("$")&&m.includes("(")&&m.endsWith(")"))return m;if(m==="null")return null;if(m==="undefined")return;if(F(m))return P(m);let u=O(m);if(Number.isFinite(u))return u;if(m==="Infinity")return 1/0;if(m==="-Infinity")return -1/0;let p=String(m||"");if(p.length>=2&&(p.startsWith("'")&&p.endsWith("'")||p.startsWith('"')&&p.endsWith('"')))return p.slice(1,-1).replace(/\\\\/g,"\\").replace(/\\'/g,"'").replace(/\\"/g,'"');if(p.startsWith("{")&&p.endsWith("}")||p.startsWith("[")&&p.endsWith("]"))try{return D(p)}catch{}return p})}function q(t,r){if(!Number.isInteger(r)||r<=0)return [];let n=[],e=0;for(;e<t.length;)n.push(t.slice(e,e+r)),e+=r;return n}function P(t){switch(true){case S(t):return t;case y(t):return true;case j(t):return false;case(c(t)&&["true","1","yes","on"].includes(String(t??"").trim().toLowerCase())):return true;case(c(t)&&["false","0","no","off"].includes(String(t??"").trim().toLowerCase())):return false}return false}async function G(t=0){await new Promise(r=>setTimeout(()=>r(true),t));}function v(t=1,r=new Date){let n=Math.min(60,Math.max(1,Math.trunc(Math.abs(t)))),e=r.getMinutes(),o=Math.floor(e/n)*n,i=new Date(r);return i.setMinutes(o,0,0),i}function rt(t=new Date){let r=d=>String(d).padStart(2,"0"),n=t.getFullYear(),e=r(t.getMonth()+1),o=r(t.getDate()),i=r(t.getHours()),f=r(t.getMinutes()),l=r(t.getSeconds());return `${n}-${e}-${o} ${i}:${f}:${l}`}function et(t){let{days:r=0,hours:n=0,minutes:e=0,seconds:o=0}=t;return r*86400+n*3600+e*60+o}function it(t){if(!Number.isFinite(t)||t<0)throw new Error("Invalid total seconds");let r=Math.floor(t/86400),n=Math.floor(t%86400/3600),e=Math.floor(t%3600/60),o=t%60;return {days:r,hours:n,minutes:e,seconds:o}}function ut(t){let r=t.split(".").map(i=>Number(i));if(r.length!==4||r.some(i=>!Number.isInteger(i)||i<0||i>255))throw new Error("Invalid IPv4 address");let n=new ArrayBuffer(4),e=new DataView(n),o=0;for(;o<4;)e.setUint8(o,r[o]),o++;return e.getUint32(0,false)}function at(t){if(!y(t))return "";let r=new ArrayBuffer(4),n=new DataView(r);n.setUint32(0,t,false);let e=[],o=0;for(;o<4;)e.push(n.getUint8(o)),o++;return e.join(".")}function h(t){return Array.isArray(t)}function A(t){return h(t)&&t.length>0}function S(t){return typeof t=="boolean"}function wt(t){if(t instanceof Date)return !Number.isNaN(t.getTime());if(s(t)||a(t)){let r=new Date(t);return !Number.isNaN(r.getTime())}return false}var U=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z]{2,})+$/;function yt(t){return c(t)?U.test(t):false}function Nt(t){return t!=null}function I(t){return typeof t=="function"}var Z=/^(25[0-5]|2[0-4]\d|[01]?\d\d?)\.(25[0-5]|2[0-4]\d|[01]?\d\d?)\.(25[0-5]|2[0-4]\d|[01]?\d\d?)\.(25[0-5]|2[0-4]\d|[01]?\d\d?)$/;function Dt(t){if(!s(t))return false;let r=t.trim();return Z.test(r)}function At(t){return s(t)&&/^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$/.test(t)}function a(t){return typeof t=="number"&&Number.isFinite(t)}function Mt(t){return a(t)&&!Number.isInteger(t)}function Wt(t){return a(t)&&t<0}function j(t){return a(t)&&t<=0}function y(t){return a(t)&&t>0}function $(t){return a(t)&&t>=0}function w(t){return typeof t=="object"&&t!==null&&Object.prototype.toString.call(t)==="[object Object]"&&!Array.isArray(t)}function L(t){return w(t)&&Object.keys(t).length>0}function Kt(t,{minLength:r=8,maxLength:n=256,requireUppercase:e=true,requireLowercase:o=true,requireDigit:i=true,requireSpecial:f=true}={}){return !(!s(t)||t.length<r||t.length>n||e&&!/[A-ZА-Я]/.test(t)||o&&!/[a-zа-я]/.test(t)||i&&!/\d/.test(t)||f&&!/[~!?@#$%^&*_\-+()\[\]{}><\\\/|"'.,:;=]/.test(t))}function Xt(t){if(!c(t)&&!a(t))return false;let r=String(t).trim();return !(r.startsWith("-")||(r.match(/\+/g)||[]).length>1||r.includes("+")&&!r.startsWith("+")||!/^\+?[0-9-]+$/.test(r)||r.length<3||r.length>20||!/[0-9]$/.test(r)||r.includes("--"))}function s(t){return typeof t=="string"}function F(t){if(!c(t))return false;let r=t.trim().toLowerCase();return r==="true"||r==="false"}function c(t){return s(t)&&t.trim().length>0}function sr(t){if(!c(t))return false;let r=t.trim().toLowerCase();return r==="asc"||r==="desc"}function mr(t){return s(t)&&/^[A-Za-z_][A-Za-z0-9_]*$/.test(t)}function pr(t){return I(t)&&/^class\s/.test(Function.prototype.toString.call(t))}var B=/^(['"`])([\s\S]*)\1$/;function b(t,r){let n=t.trim(),e=M(n);if(e.ok)return e.value;let o=B.exec(n);return o?o[2]:r?n:null}function M(t){try{return {ok:!0,value:JSON.parse(t)}}catch{}return {ok:false}}function D(t,r=false){if(t===null||a(t)||S(t))return t;if(A(t)){let n=t,e=[];for(let o of n)c(o)?e.push(b(String(o),r)):e.push(o);return e}if(L(t)){let n=t,e={};for(let o of Object.keys(n)){let i=n[o];c(i)?e[o]=b(String(i),r):e[o]=i;}return e}return h(t)||w(t)?t:c(t)?b(String(t),r):null}function br(t){try{return w(t)||h(t)?JSON.stringify(t):""}catch{}return ""}function z(t){let r=t.sign<0?"-":"",n=t.digitsInteger.toString();if(t.scale===0)return r+n;let e=t.scale-n.length;if(e>=0)return r+"0."+"0".repeat(e)+n;let o=n.length-t.scale,i=n.slice(0,o),f=n.slice(o);return r+i+"."+f}function E(t){return Number(z(t))}function N(t,r){let n=/^([0-9]+)(?:\.([0-9]*))?e([+\-]?[0-9]+)$/i.exec((()=>{let[i,f]=r.split(/e/i),[l,d=""]=i.split("."),k=l.replace(/^0+/,"")+d,g=parseInt(f,10)-d.length;return `${k||"0"}e${g}`})());if(!n)throw new Error("Failed to parse exponential notation.");let e=n[1],o=parseInt(n[3],10);if($(o))return e=e+"0".repeat(o),{sign:t,integerPart:e||"0",fractionalPart:""};{let i=-o;if(i>=e.length){let f="0".repeat(i-e.length);return {sign:t,integerPart:"0",fractionalPart:f+e}}else {let f=e.length-i;return {sign:t,integerPart:e.slice(0,f),fractionalPart:e.slice(f)}}}}function W(t){if(typeof t=="bigint"){let r=t<0n?-1:1,n=(t<0n?-t:t).toString();return {sign:r,integerPart:n,fractionalPart:""}}if(typeof t=="number"){if(!Number.isFinite(t))throw new Error("Input number is not finite.");let r=t<0?-1:1,e=Math.abs(t).toExponential(30);return N(r,e)}if(typeof t=="string"){let r=t.trim().replace(",",".");if(!r)throw new Error("Input string is empty.");let n=1;if((r.startsWith("+")||r.startsWith("-"))&&(n=r.startsWith("-")?-1:1,r=r.slice(1)),/^[0-9]*\.?[0-9]*(e[+\-]?[0-9]+)?$/i.test(r)){if(/e/i.test(r))return N(n,r);let[e="0",o=""]=r.split(".");return {sign:n,integerPart:e,fractionalPart:o}}throw new Error("Invalid numeric string.")}throw new Error("Unsupported input type.")}function T(t){let{sign:r,integerPart:n,fractionalPart:e}=W(t),o=n.replace(/^0+/,"")||"0",i=e.replace(/0+$/,""),f=o+i||"0";return {sign:r,digitsInteger:BigInt(f),scale:i.length}}function C(t,r,n="half-up"){let e=Math.max(0,Math.trunc(r));if(t.scale<=e)return {...t};let o=t.scale-e,i=10n**BigInt(o),f=t.digitsInteger/i,l=t.digitsInteger%i;if(n==="trunc"||l===0n)return {sign:t.sign,digitsInteger:f,scale:e};let d=i/2n,g=l>=d?f+1n:f;return {sign:t.sign,digitsInteger:g,scale:e}}function O(t,r=1,n=false){try{return E(r>1?C(T(t),r,"half-up"):T(t))}catch(e){if(n)throw e}return 0}function J(t){if(!s(t))return "";let r=x(t);return c(r)?r.toLowerCase():""}function Zr(t){if(!s(t))return "";let r=J(t);return c(r)?r[0].toUpperCase()+r.slice(1):""}function Qr(t){return s(t)&&x(t)===""||t===void 0?null:t}function Hr(t,r="+7"){if(!s(t))return null;let n=x(t).replace(/[\s\-().]/g,"");return /^00\d{8,15}$/.test(n)?n="+"+n.slice(2):/^\d{10}$/.test(n)?n=r+n:/^\d{9,15}$/.test(n)&&!n.startsWith("0")&&(n="+"+n),/^\+\d{10,15}$/.test(n)?n:null}function x(t){return String(s(t)?t.trim().normalize("NFKC").replace(/[\u200B-\u200D\uFEFF]/g,""):"")}function tn(t){return s(t)&&x(t)===""||t===null?void 0:t}var en=t=>{if(!s(t))return t;let r=String(x(t)||"");return r===""?null:r.toLowerCase()};function sn(t=""){return {}}export{Q as arrFuncArgs,q as arrSplitPortions,P as boolNormalize,v as dateFloorMin,et as datePartsSec,it as dateSecParts,rt as dateStr,Hr as formatToPhone,at as ipNumStr,ut as ipStrNum,h as isArr,A as isArrFilled,S as isBool,pr as isClass,wt as isDate,yt as isEmail,Nt as isExists,I as isFunc,Dt as isIpAddr,At as isMacAddr,a as isNum,Mt as isNumFloat,Wt as isNumN,j as isNumNZ,y as isNumP,$ as isNumPZ,w as isObj,L as isObjFilled,Kt as isPassword,Xt as isPhone,s as isStr,sr as isStrAscDesc,F as isStrBool,c as isStrFilled,mr as isVar,D as jsonDecode,br as jsonEncode,M as jsonParse,b as jsonStrLike,O as numNormalize,J as strLowerCase,Zr as strNormalCase,en as strNormalize,Qr as strNull,x as strTrim,tn as strUndefined,sn as urlObj,G as wait};//# sourceMappingURL=index.mjs.map
1
+ function Q(t){if(!s(t))return [t];let r=t.trim();if(r==="")return [];if(r.startsWith("[")&&r.endsWith("]")&&(r=r.slice(1,-1).trim(),r===""))return [];let n="",e=false,o=null,i=false,f=0,l=0,d=0,k=[],g=()=>{let m=n.trim();m!==""&&k.push(m),n="";};for(let m=0;m<r.length;m++){let u=r[m];if(e){if(n+=u,i){i=false;continue}if(u==="\\"){i=true;continue}u===o&&(e=false,o=null);continue}if(u==='"'||u==="'"){e=true,o=u,n+=u;continue}if(u==="("){f++,n+=u;continue}if(u===")"){f=Math.max(0,f-1),n+=u;continue}if(u==="["){l++,n+=u;continue}if(u==="]"){l=Math.max(0,l-1),n+=u;continue}if(u==="{"){d++,n+=u;continue}if(u==="}"){d=Math.max(0,d-1),n+=u;continue}if(u===","&&f===0&&l===0&&d===0){g();continue}n+=u;}return n.length&&g(),k.map(m=>{if(m.startsWith("$")&&m.includes("(")&&m.endsWith(")"))return m;if(m==="null")return null;if(m==="undefined")return;if(F(m))return P(m);let u=O(m);if(Number.isFinite(u))return u;if(m==="Infinity")return 1/0;if(m==="-Infinity")return -1/0;let p=String(m||"");if(p.length>=2&&(p.startsWith("'")&&p.endsWith("'")||p.startsWith('"')&&p.endsWith('"')))return p.slice(1,-1).replace(/\\\\/g,"\\").replace(/\\'/g,"'").replace(/\\"/g,'"');if(p.startsWith("{")&&p.endsWith("}")||p.startsWith("[")&&p.endsWith("]"))try{return D(p)}catch{}return p})}function q(t,r){if(!Number.isInteger(r)||r<=0)return [];let n=[],e=0;for(;e<t.length;)n.push(t.slice(e,e+r)),e+=r;return n}function P(t){switch(true){case S(t):return t;case y(t):return true;case j(t):return false;case(c(t)&&["true","1","yes","on"].includes(String(t??"").trim().toLowerCase())):return true;case(c(t)&&["false","0","no","off"].includes(String(t??"").trim().toLowerCase())):return false}return false}async function G(t=0){await new Promise(r=>setTimeout(()=>r(true),t));}function v(t=1,r=new Date){let n=Math.min(60,Math.max(1,Math.trunc(Math.abs(t)))),e=r.getMinutes(),o=Math.floor(e/n)*n,i=new Date(r);return i.setMinutes(o,0,0),i}function rt(t=new Date){let r=d=>String(d).padStart(2,"0"),n=t.getFullYear(),e=r(t.getMonth()+1),o=r(t.getDate()),i=r(t.getHours()),f=r(t.getMinutes()),l=r(t.getSeconds());return `${n}-${e}-${o} ${i}:${f}:${l}`}function et(t){let{days:r=0,hours:n=0,minutes:e=0,seconds:o=0}=t;return r*86400+n*3600+e*60+o}function it(t){if(!Number.isFinite(t)||t<0)throw new Error("Invalid total seconds");let r=Math.floor(t/86400),n=Math.floor(t%86400/3600),e=Math.floor(t%3600/60),o=t%60;return {days:r,hours:n,minutes:e,seconds:o}}function ut(t){let r=t.split(".").map(i=>Number(i));if(r.length!==4||r.some(i=>!Number.isInteger(i)||i<0||i>255))throw new Error("Invalid IPv4 address");let n=new ArrayBuffer(4),e=new DataView(n),o=0;for(;o<4;)e.setUint8(o,r[o]),o++;return e.getUint32(0,false)}function at(t){if(!y(t))return "";let r=new ArrayBuffer(4),n=new DataView(r);n.setUint32(0,t,false);let e=[],o=0;for(;o<4;)e.push(n.getUint8(o)),o++;return e.join(".")}function h(t){return Array.isArray(t)}function A(t){return h(t)&&t.length>0}function S(t){return typeof t=="boolean"}function wt(t){if(t instanceof Date)return !Number.isNaN(t.getTime());if(s(t)||a(t)){let r=new Date(t);return !Number.isNaN(r.getTime())}return false}var U=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z]{2,})+$/;function yt(t){return c(t)?U.test(t):false}function Nt(t){return t!=null}function I(t){return typeof t=="function"}var Z=/^(25[0-5]|2[0-4]\d|[01]?\d\d?)\.(25[0-5]|2[0-4]\d|[01]?\d\d?)\.(25[0-5]|2[0-4]\d|[01]?\d\d?)\.(25[0-5]|2[0-4]\d|[01]?\d\d?)$/;function Dt(t){if(!s(t))return false;let r=t.trim();return Z.test(r)}function At(t){return s(t)&&/^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$/.test(t)}function a(t){return typeof t=="number"&&Number.isFinite(t)}function Mt(t){return a(t)&&!Number.isInteger(t)}function Wt(t){return a(t)&&t<0}function j(t){return a(t)&&t<=0}function y(t){return a(t)&&t>0}function $(t){return a(t)&&t>=0}function w(t){return typeof t=="object"&&t!==null&&Object.prototype.toString.call(t)==="[object Object]"&&!Array.isArray(t)}function L(t){return w(t)&&Object.keys(t).length>0}function Kt(t,{minLength:r=8,maxLength:n=256,requireUppercase:e=true,requireLowercase:o=true,requireDigit:i=true,requireSpecial:f=true}={}){return !(!s(t)||t.length<r||t.length>n||e&&!/[A-ZА-Я]/.test(t)||o&&!/[a-zа-я]/.test(t)||i&&!/\d/.test(t)||f&&!/[~!?@#$%^&*_\-+()\[\]{}><\\\/|"'.,:;=]/.test(t))}function Xt(t){if(!c(t)&&!a(t))return false;let r=String(t).trim();return !(r.startsWith("-")||(r.match(/\+/g)||[]).length>1||r.includes("+")&&!r.startsWith("+")||!/^\+?[0-9-]+$/.test(r)||r.length<3||r.length>20||!/[0-9]$/.test(r)||r.includes("--"))}function s(t){return typeof t=="string"}function F(t){if(!c(t))return false;let r=t.trim().toLowerCase();return r==="true"||r==="false"}function c(t){return s(t)&&t.trim().length>0}function sr(t){if(!c(t))return false;let r=t.trim().toLowerCase();return r==="asc"||r==="desc"}function mr(t){return s(t)&&/^[A-Za-z_][A-Za-z0-9_]*$/.test(t)}function pr(t){return I(t)&&/^class\s/.test(Function.prototype.toString.call(t))}var B=/^(['"`])([\s\S]*)\1$/;function b(t,r){let n=t.trim(),e=M(n);if(e.ok)return e.value;let o=B.exec(n);return o?o[2]:r?n:null}function M(t){try{return {ok:!0,value:JSON.parse(t)}}catch{}return {ok:false}}function D(t,r=false){if(t===null||a(t)||S(t))return t;if(A(t)){let n=t,e=[];for(let o of n)c(o)?e.push(b(String(o),r)):e.push(o);return e}if(L(t)){let n=t,e={};for(let o of Object.keys(n)){let i=n[o];c(i)?e[o]=b(String(i),r):e[o]=i;}return e}return h(t)||w(t)?t:c(t)?b(String(t),r):null}function br(t){try{return w(t)||h(t)?JSON.stringify(t):""}catch{}return ""}function z(t){let r=t.sign<0?"-":"",n=t.digitsInteger.toString();if(t.scale===0)return r+n;let e=t.scale-n.length;if(e>=0)return r+"0."+"0".repeat(e)+n;let o=n.length-t.scale,i=n.slice(0,o),f=n.slice(o);return r+i+"."+f}function E(t){return Number(z(t))}function N(t,r){let n=/^([0-9]+)(?:\.([0-9]*))?e([+\-]?[0-9]+)$/i.exec((()=>{let[i,f]=r.split(/e/i),[l,d=""]=i.split("."),k=l.replace(/^0+/,"")+d,g=parseInt(f,10)-d.length;return `${k||"0"}e${g}`})());if(!n)throw new Error("Failed to parse exponential notation.");let e=n[1],o=parseInt(n[3],10);if($(o))return e=e+"0".repeat(o),{sign:t,integerPart:e||"0",fractionalPart:""};{let i=-o;if(i>=e.length){let f="0".repeat(i-e.length);return {sign:t,integerPart:"0",fractionalPart:f+e}}else {let f=e.length-i;return {sign:t,integerPart:e.slice(0,f),fractionalPart:e.slice(f)}}}}function W(t){if(typeof t=="bigint"){let r=t<0n?-1:1,n=(t<0n?-t:t).toString();return {sign:r,integerPart:n,fractionalPart:""}}if(typeof t=="number"){if(!Number.isFinite(t))throw new Error("Input number is not finite.");let r=t<0?-1:1,e=Math.abs(t).toExponential(30);return N(r,e)}if(typeof t=="string"){let r=t.trim().replace(",",".");if(!r)throw new Error("Input string is empty.");let n=1;if((r.startsWith("+")||r.startsWith("-"))&&(n=r.startsWith("-")?-1:1,r=r.slice(1)),/^[0-9]*\.?[0-9]*(e[+\-]?[0-9]+)?$/i.test(r)){if(/e/i.test(r))return N(n,r);let[e="0",o=""]=r.split(".");return {sign:n,integerPart:e,fractionalPart:o}}throw new Error("Invalid numeric string.")}throw new Error("Unsupported input type.")}function T(t){let{sign:r,integerPart:n,fractionalPart:e}=W(t),o=n.replace(/^0+/,"")||"0",i=e.replace(/0+$/,""),f=o+i||"0";return {sign:r,digitsInteger:BigInt(f),scale:i.length}}function C(t,r,n="half-up"){let e=Math.max(0,Math.trunc(r));if(t.scale<=e)return {...t};let o=t.scale-e,i=10n**BigInt(o),f=t.digitsInteger/i,l=t.digitsInteger%i;if(n==="trunc"||l===0n)return {sign:t.sign,digitsInteger:f,scale:e};let d=i/2n,g=l>=d?f+1n:f;return {sign:t.sign,digitsInteger:g,scale:e}}function O(t,r=1,n=false){try{return E(r>1?C(T(t),r,"half-up"):T(t))}catch(e){if(n)throw e}return 0}function J(t){if(!s(t))return "";let r=x(t);return c(r)?r.toLowerCase():""}function Zr(t){if(!s(t))return "";let r=J(t);return c(r)?r[0].toUpperCase()+r.slice(1):""}function Qr(t){return s(t)&&x(t)===""||t===void 0?null:t}function Hr(t,r="+7"){if(!s(t))return null;let n=x(t).replace(/[\s\-().]/g,"");return /^00\d{8,15}$/.test(n)?n="+"+n.slice(2):/^\d{10}$/.test(n)?n=r+n:/^\d{9,15}$/.test(n)&&!n.startsWith("0")&&(n="+"+n),/^\+\d{10,15}$/.test(n)?n:null}function x(t){return String(s(t)?t.trim().normalize("NFKC").replace(/[\u200B-\u200D\uFEFF]/g,""):"")}function tn(t){return s(t)&&x(t)===""||t===null?void 0:t}var en=t=>{if(!s(t))return t;let r=String(x(t)||"");return r===""?null:r.toLowerCase()};function sn(t=""){return {}}export{Q as arrFuncArgs,q as arrSplitPortions,P as boolNormalize,v as dateFloorMin,et as datePartsSec,it as dateSecParts,rt as dateStr,at as ipNumStr,ut as ipStrNum,h as isArr,A as isArrFilled,S as isBool,pr as isClass,wt as isDate,yt as isEmail,Nt as isExists,I as isFunc,Dt as isIpAddr,At as isMacAddr,a as isNum,Mt as isNumFloat,Wt as isNumN,j as isNumNZ,y as isNumP,$ as isNumPZ,w as isObj,L as isObjFilled,Kt as isPassword,Xt as isPhone,s as isStr,sr as isStrAscDesc,F as isStrBool,c as isStrFilled,mr as isVar,D as jsonDecode,br as jsonEncode,M as jsonParse,b as jsonStrLike,O as numNormalize,J as strLowerCase,Zr as strNormalCase,en as strNormalize,Qr as strNull,Hr as strPhone,x as strTrim,tn as strUndefined,sn as urlObj,G as wait};//# sourceMappingURL=index.mjs.map
2
2
  //# sourceMappingURL=index.mjs.map