full-utils 2.0.5 → 3.0.1
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/browser.cjs +1 -2
- package/dist/browser.cjs.map +1 -1
- package/dist/browser.d.cts +1 -1
- package/dist/browser.d.ts +1 -1
- package/dist/browser.mjs +1 -2
- package/dist/browser.mjs.map +1 -1
- package/dist/index.cjs +1 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +170 -1411
- package/dist/index.d.ts +170 -1411
- package/dist/index.mjs +1 -2
- package/dist/index.mjs.map +1 -1
- package/dist/node.cjs +1 -2
- package/dist/node.cjs.map +1 -1
- package/dist/node.d.cts +1 -1
- package/dist/node.d.ts +1 -1
- package/dist/node.mjs +1 -2
- package/dist/node.mjs.map +1 -1
- package/package.json +1 -1
package/dist/browser.cjs
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
'use strict';function ot(t){if(!a(t))return [t];let n=t.trim();if(n==="")return [];if(n.startsWith("[")&&n.endsWith("]")&&(n=n.slice(1,-1).trim(),n===""))return [];let r="",e=false,i=null,o=false,s=0,l=0,d=0,x=[],h=()=>{let u=r.trim();u!==""&&x.push(u),r="";};for(let u=0;u<n.length;u++){let c=n[u];if(e){if(r+=c,o){o=false;continue}if(c==="\\"){o=true;continue}c===i&&(e=false,i=null);continue}if(c==='"'||c==="'"){e=true,i=c,r+=c;continue}if(c==="("){s++,r+=c;continue}if(c===")"){s=Math.max(0,s-1),r+=c;continue}if(c==="["){l++,r+=c;continue}if(c==="]"){l=Math.max(0,l-1),r+=c;continue}if(c==="{"){d++,r+=c;continue}if(c==="}"){d=Math.max(0,d-1),r+=c;continue}if(c===","&&s===0&&l===0&&d===0){h();continue}r+=c;}return r.length&&h(),x.map(u=>{if(u.startsWith("$")&&u.includes("(")&&u.endsWith(")"))return u;if(u==="null")return null;if(u==="undefined")return;if(E(u))return $(u);let c=w(u);if(Number.isFinite(c))return c;if(u==="Infinity")return 1/0;if(u==="-Infinity")return -1/0;let p=String(u||"");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 B(p)}catch{}return p})}function ut(t,n){if(!Number.isInteger(n)||n<=0)return [];let r=[],e=0;for(;e<t.length;)r.push(t.slice(e,e+n)),e+=n;return r}function $(t){switch(true){case F(t):return t;case P(t):return true;case R(t):return false;case(m(t)&&["true","1","yes","on"].includes(String(t??"").trim().toLowerCase())):return true;case(m(t)&&["false","0","no","off"].includes(String(t??"").trim().toLowerCase())):return false}return false}async function mt(t=0){await new Promise(n=>setTimeout(()=>n(true),t));}function pt(t=1,n=new Date){let r=Math.min(60,Math.max(1,Math.trunc(Math.abs(t)))),e=n.getMinutes(),i=Math.floor(e/r)*r,o=new Date(n);return o.setMinutes(i,0,0),o}function gt(t=new Date){let n=d=>String(d).padStart(2,"0"),r=t.getFullYear(),e=n(t.getMonth()+1),i=n(t.getDate()),o=n(t.getHours()),s=n(t.getMinutes()),l=n(t.getSeconds());return `${r}-${e}-${i} ${o}:${s}:${l}`}function xt(t){let{days:n=0,hours:r=0,minutes:e=0,seconds:i=0}=t;return n*86400+r*3600+e*60+i}function bt(t){if(!Number.isFinite(t)||t<0)throw new Error("Invalid total seconds");let n=Math.floor(t/86400),r=Math.floor(t%86400/3600),e=Math.floor(t%3600/60),i=t%60;return {days:n,hours:r,minutes:e,seconds:i}}function M(t){let[n,r]=t.split("/"),e=b(n),i=r?Number(r):NaN;if(e===null||!Number.isInteger(i)||i<0||i>32)return null;let o=i===0?0:4294967295<<32-i>>>0,s=e&o,l=s|~o>>>0;return [N(s),N(l)]}function St(t){let n=t.split(".").map(o=>Number(o));if(n.length!==4||n.some(o=>!Number.isInteger(o)||o<0||o>255))throw new Error("Invalid IPv4 address");let r=new ArrayBuffer(4),e=new DataView(r),i=0;for(;i<4;)e.setUint8(i,n[i]),i++;return e.getUint32(0,false)}function Dt(t){if(!P(t))return "";let n=new ArrayBuffer(4),r=new DataView(n);r.setUint32(0,t,false);let e=[],i=0;for(;i<4;)e.push(r.getUint8(i)),i++;return e.join(".")}function b(t){if(!a(t))return null;let n=g(t).split(".");if(n.length!==4)return null;let r=0;for(let e=0;e<4;e++){if(!/^\d{1,3}$/.test(n[e]))return null;let i=Number(n[e]);if(i<0||i>255)return null;r=r<<8|i;}return r>>>0}function*C(t,n,r={}){let{includeNetwork:e=true,includeBroadcast:i=true}=r,o,s,l=false,d=null;if(n===void 0&&t.includes("/")){let u=M(t);if(!u)throw new Error(`Invalid CIDR: "${t}"`);let[c,p]=u,[D,K]=t.split("/");d=Number(K),o=b(c),s=b(p),l=true;}else {let u=b(t);if(u===null)throw new Error(`Invalid IPv4: "${t}"`);if(o=u,n&&n.trim()!==""){let c=b(n);if(c===null)throw new Error(`Invalid IPv4: "${n}"`);s=c;}else {let c=o>>>24&255,p=o>>>16&255,D=o>>>8&255;s=(c<<24|p<<16|D<<8|255)>>>0;}}o>s&&([o,s]=[s,o]);let x=-1,h=-1;l&&d!==null&&d<=30&&(x=o,h=s);for(let u=o;u<=s;u=u+1>>>0){if(!e&&u===x){if(u===s)break;continue}if(!i&&u===h){if(u===s)break;continue}if(yield N(u),u===4294967295)break}}function Ct(t,n,r={}){let{limit:e=1e6}=r,i=[],o=0;for(let s of C(t,n,r)){if(o>=e)throw new Error(`Range is too large (> ${e}). Use the generator version instead.`);i.push(s),o++;}return i}function N(t){if(!Number.isInteger(t)||t<0||t>4294967295)throw new Error(`Invalid IPv4 number: ${t}`);return [t>>>24&255,t>>>16&255,t>>>8&255,t&255].join(".")}function k(t){return Array.isArray(t)}function L(t){return k(t)&&t.length>0}function F(t){return typeof t=="boolean"}function _t(t){if(t instanceof Date)return !Number.isNaN(t.getTime());if(a(t)||f(t)){let n=new Date(t);return !Number.isNaN(n.getTime())}return false}var q=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z]{2,})+$/;function Vt(t){return m(t)?q.test(t):false}function Kt(t){return t!=null}function j(t){return typeof t=="function"}var Y=/^(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 vt(t){if(!a(t))return false;let n=t.trim();return Y.test(n)}function rn(t){return a(t)&&/^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$/.test(t)}function f(t){return typeof t=="number"&&Number.isFinite(t)}function un(t){return f(t)&&!Number.isInteger(t)}function fn(t){return f(t)&&t<0}function R(t){return f(t)&&t<=0}function P(t){return f(t)&&t>0}function z(t){return f(t)&&t>=0}function T(t){return typeof t=="object"&&t!==null&&Object.prototype.toString.call(t)==="[object Object]"&&!Array.isArray(t)}function W(t){return T(t)&&Object.keys(t).length>0}function Nn(t,{minLength:n=8,maxLength:r=256,requireUppercase:e=true,requireLowercase:i=true,requireDigit:o=true,requireSpecial:s=true}={}){return !(!a(t)||t.length<n||t.length>r||e&&!/[A-ZА-Я]/.test(t)||i&&!/[a-zа-я]/.test(t)||o&&!/\d/.test(t)||s&&!/[~!?@#$%^&*_\-+()\[\]{}><\\\/|"'.,:;=]/.test(t))}function Pn(t){if(!m(t)&&!f(t))return false;let n=String(t).trim();return !(n.startsWith("-")||(n.match(/\+/g)||[]).length>1||n.includes("+")&&!n.startsWith("+")||!/^\+?[0-9-]+$/.test(n)||n.length<3||n.length>20||!/[0-9]$/.test(n)||n.includes("--"))}function a(t){return typeof t=="string"}function E(t){if(!m(t))return false;let n=t.trim().toLowerCase();return n==="true"||n==="false"}function m(t){return a(t)&&t.trim().length>0}function Bn(t){if(!m(t))return false;let n=t.trim().toLowerCase();return n==="asc"||n==="desc"}function Cn(t){return a(t)&&/^[A-Za-z_][A-Za-z0-9_]*$/.test(t)}function zn(t){return j(t)&&/^class\s/.test(Function.prototype.toString.call(t))}var X=/^(['"`])([\s\S]*)\1$/;function y(t,n){let r=t.trim(),e=J(r);if(e.ok)return e.value;let i=X.exec(r);return i?i[2]:n?r:null}function J(t){try{return {ok:!0,value:JSON.parse(t)}}catch{}return {ok:false}}function B(t,n=false){if(t===null||f(t)||F(t))return t;if(L(t)){let r=t,e=[];for(let i of r)m(i)?e.push(y(String(i),n)):e.push(i);return e}if(W(t)){let r=t,e={};for(let i of Object.keys(r)){let o=r[i];m(o)?e[i]=y(String(o),n):e[i]=o;}return e}return k(t)||T(t)?t:m(t)?y(String(t),n):null}function Kn(t){try{return T(t)||k(t)?JSON.stringify(t):""}catch{}return ""}function Yn(t,n){let r=Math.trunc(n);if(r===0)return {...t};if(r>0)return {sign:t.sign,digitsInteger:t.digitsInteger,scale:t.scale+r};let e=10n**BigInt(-r);return {sign:t.sign,digitsInteger:t.digitsInteger*e,scale:t.scale+r}}function A(t,n){let r=/^([0-9]+)(?:\.([0-9]*))?e([+\-]?[0-9]+)$/i.exec((()=>{let[o,s]=n.split(/e/i),[l,d=""]=o.split("."),x=l.replace(/^0+/,"")+d,h=parseInt(s,10)-d.length;return `${x||"0"}e${h}`})());if(!r)throw new Error("Failed to parse exponential notation.");let e=r[1],i=parseInt(r[3],10);if(z(i))return e=e+"0".repeat(i),{sign:t,integerPart:e||"0",fractionalPart:""};{let o=-i;if(o>=e.length){let s="0".repeat(o-e.length);return {sign:t,integerPart:"0",fractionalPart:s+e}}else {let s=e.length-o;return {sign:t,integerPart:e.slice(0,s),fractionalPart:e.slice(s)}}}}function U(t){return Number(Z(t))}function Z(t){let n=t.sign<0?"-":"",r=t.digitsInteger.toString();if(t.scale===0)return n+r;let e=t.scale-r.length;if(e>=0)return n+"0."+"0".repeat(e)+r;let i=r.length-t.scale,o=r.slice(0,i),s=r.slice(i);return n+o+"."+s}function w(t,n=1,r=false){try{return U(n>1?_(O(t),n,"half-up"):O(t))}catch(e){if(r)throw e}return 0}function G(t){if(typeof t=="bigint"){let n=t<0n?-1:1,r=(t<0n?-t:t).toString();return {sign:n,integerPart:r,fractionalPart:""}}if(typeof t=="number"){if(!Number.isFinite(t))throw new Error("Input number is not finite.");let n=t<0?-1:1,e=Math.abs(t).toExponential(30);return A(n,e)}if(typeof t=="string"){let n=t.trim().replace(",",".");if(!n)throw new Error("Input string is empty.");let r=1;if((n.startsWith("+")||n.startsWith("-"))&&(r=n.startsWith("-")?-1:1,n=n.slice(1)),/^[0-9]*\.?[0-9]*(e[+\-]?[0-9]+)?$/i.test(n)){if(/e/i.test(n))return A(r,n);let[e="0",i=""]=n.split(".");return {sign:r,integerPart:e,fractionalPart:i}}throw new Error("Invalid numeric string.")}throw new Error("Unsupported input type.")}function O(t){let{sign:n,integerPart:r,fractionalPart:e}=G(t),i=r.replace(/^0+/,"")||"0",o=e.replace(/0+$/,""),s=i+o||"0";return {sign:n,digitsInteger:BigInt(s),scale:o.length}}function _(t,n,r="half-up"){let e=Math.max(0,Math.trunc(n));if(t.scale<=e)return {...t};let i=t.scale-e,o=10n**BigInt(i),s=t.digitsInteger/o,l=t.digitsInteger%o;if(r==="trunc"||l===0n)return {sign:t.sign,digitsInteger:s,scale:e};let d=o/2n,h=l>=d?s+1n:s;return {sign:t.sign,digitsInteger:h,scale:e}}function H(t){if(!a(t))return "";let n=g(t);return m(n)?n.toLowerCase():""}function dr(t){if(!a(t))return "";let n=H(t);return m(n)?n[0].toUpperCase()+n.slice(1):""}function wr(t){return a(t)&&g(t)===""||t===void 0?null:t}function Tr(t,n="+7"){if(!a(t))return null;let r=g(t).replace(/[\s\-().]/g,"");return /^00\d{8,15}$/.test(r)?r="+"+r.slice(2):/^\d{10}$/.test(r)?r=n+r:/^\d{9,15}$/.test(r)&&!r.startsWith("0")&&(r="+"+r),/^\+\d{10,15}$/.test(r)?r:null}function g(t){return String(a(t)?t.trim().normalize("NFKC").replace(/[\u200B-\u200D\uFEFF]/g,""):"")}function Ir(t){return a(t)&&g(t)===""||t===null?void 0:t}var v=1024,V=v*1024,S=V*1024,Q=S*1024,tt=Q*1024;function Or(t,n=""){let r=w(t);if(!f(r))throw new Error(`toGB: value "${t}" is not numeric`);let e=String(n).trim().toLowerCase().replace(/\s+/g,""),i=e?e[0]:"g",o;switch(i){case "b":o=r/S;break;case "k":o=r/V;break;case "m":o=r/S;break;case "g":o=r;break;case "t":o=r*(Q/S);break;case "p":o=r*(tt/S);break;default:o=r;break}if(!f(o))throw new Error(`toGB: result is not finite (value="${t}", unit="${n}")`);return Object.is(o,-0)?0:o}function I(t){return String(t).trim().toLowerCase().replace(/\s+/g,"").replace(/(?:\/?s|hash(?:es)?)$/i,"")}var nt={h:1e-9,k:1e-6,m:.001,g:1,t:1e3,p:1e6,e:1e9};function Mr(t,n=""){let r=w(t);if(!f(r))return 0;let e=I(n),i=e?e[0]:"g",o=nt[i]??1,s=r*o;if(!f(s))throw new Error(`toGH: result is not finite (value="${r}", unit="${e}")`);return Object.is(s,-0)?0:s}var rt={h:1,k:1e3,m:1e6,g:1e9,t:1e12,p:1e15,e:1e18};function zr(t,n=""){let r=w(t);if(!f(r))return 0;let e=I(n),i=e?e[0]:"h",o=rt[i]??1,s=r*o;if(!f(s))throw new Error(`toH: result is not finite (value="${r}", unit="${e}")`);return Object.is(s,-0)?0:s}var et=/^[a-zA-Z][a-zA-Z\d+\-.]*:/;function Ur(t=""){if(!m(t))return "";let n=t.trim(),r=et.test(n)?n:`http://${n}`;try{return new URL(r).hostname}catch{let i=(n.split("@").pop()||n).split(/[/?#]/,1)[0],o=i.match(/^\[([^\]]+)\]/);return o?o[1]:i.split(":",1)[0]||""}}
|
|
2
|
-
exports.changeFixedDecimalScale=Yn;exports.cidrToRange=M;exports.convertExponentialToParts=A;exports.extractHost=Ur;exports.fixedDecimalToNum=U;exports.fixedDecimalToStr=Z;exports.floorDateToMinutes=pt;exports.formatDateToString=gt;exports.formatStrToFuncArgsArr=ot;exports.formatToBool=$;exports.formatToLowerCase=H;exports.formatToNormalCase=dr;exports.formatToNull=wr;exports.formatToNum=w;exports.formatToPhone=Tr;exports.formatToTrim=g;exports.formatToUndefined=Ir;exports.ipAddrToNum=St;exports.isArr=k;exports.isArrFilled=L;exports.isBool=F;exports.isClass=zn;exports.isDate=_t;exports.isEmail=Vt;exports.isExists=Kt;exports.isFunc=j;exports.isIpAddr=vt;exports.isMacAddr=rn;exports.isNum=f;exports.isNumFloat=un;exports.isNumN=fn;exports.isNumNZ=R;exports.isNumP=P;exports.isNumPZ=z;exports.isObj=T;exports.isObjFilled=W;exports.isPassword=Nn;exports.isPhone=Pn;exports.isStr=a;exports.isStrAscDesc=Bn;exports.isStrBool=E;exports.isStrFilled=m;exports.isVar=Cn;exports.jsonDecode=B;exports.jsonEncode=Kn;exports.normalizeToDecimalComponents=G;exports.numToIpAddr=Dt;exports.parseIPv4=b;exports.parseStringLike=y;exports.parseToFixedDecimal=O;exports.partsToSeconds=xt;exports.rangeIPv4=C;exports.rangeIPv4ToArr=Ct;exports.roundFixedDecimal=_;exports.secondsToParts=bt;exports.splitArrToPortions=ut;exports.toGB=Or;exports.toGH=Mr;exports.toH=zr;exports.toIPv4=N;exports.tryParseJSON=J;exports.wait=mt;//# sourceMappingURL=browser.cjs.map
|
|
1
|
+
'use strict';function Q(t){if(!s(t))return [t];let n=t.trim();if(n==="")return [];if(n.startsWith("[")&&n.endsWith("]")&&(n=n.slice(1,-1).trim(),n===""))return [];let r="",e=false,i=null,o=false,f=0,p=0,d=0,k=[],x=()=>{let c=r.trim();c!==""&&k.push(c),r="";};for(let c=0;c<n.length;c++){let u=n[c];if(e){if(r+=u,o){o=false;continue}if(u==="\\"){o=true;continue}u===i&&(e=false,i=null);continue}if(u==='"'||u==="'"){e=true,i=u,r+=u;continue}if(u==="("){f++,r+=u;continue}if(u===")"){f=Math.max(0,f-1),r+=u;continue}if(u==="["){p++,r+=u;continue}if(u==="]"){p=Math.max(0,p-1),r+=u;continue}if(u==="{"){d++,r+=u;continue}if(u==="}"){d=Math.max(0,d-1),r+=u;continue}if(u===","&&f===0&&p===0&&d===0){x();continue}r+=u;}return r.length&&x(),k.map(c=>{if(c.startsWith("$")&&c.includes("(")&&c.endsWith(")"))return c;if(c==="null")return null;if(c==="undefined")return;if(F(c))return P(c);let u=O(c);if(Number.isFinite(u))return u;if(c==="Infinity")return 1/0;if(c==="-Infinity")return -1/0;let l=String(c||"");if(l.length>=2&&(l.startsWith("'")&&l.endsWith("'")||l.startsWith('"')&&l.endsWith('"')))return l.slice(1,-1).replace(/\\\\/g,"\\").replace(/\\'/g,"'").replace(/\\"/g,'"');if(l.startsWith("{")&&l.endsWith("}")||l.startsWith("[")&&l.endsWith("]"))try{return D(l)}catch{}return l})}function q(t,n){if(!Number.isInteger(n)||n<=0)return [];let r=[],e=0;for(;e<t.length;)r.push(t.slice(e,e+n)),e+=n;return r}function P(t){switch(true){case S(t):return t;case b(t):return true;case A(t):return false;case(a(t)&&["true","1","yes","on"].includes(String(t??"").trim().toLowerCase())):return true;case(a(t)&&["false","0","no","off"].includes(String(t??"").trim().toLowerCase())):return false}return false}async function G(t=0){await new Promise(n=>setTimeout(()=>n(true),t));}function v(t=1,n=new Date){let r=Math.min(60,Math.max(1,Math.trunc(Math.abs(t)))),e=n.getMinutes(),i=Math.floor(e/r)*r,o=new Date(n);return o.setMinutes(i,0,0),o}function nt(t=new Date){let n=d=>String(d).padStart(2,"0"),r=t.getFullYear(),e=n(t.getMonth()+1),i=n(t.getDate()),o=n(t.getHours()),f=n(t.getMinutes()),p=n(t.getSeconds());return `${r}-${e}-${i} ${o}:${f}:${p}`}function et(t){let{days:n=0,hours:r=0,minutes:e=0,seconds:i=0}=t;return n*86400+r*3600+e*60+i}function ot(t){if(!Number.isFinite(t)||t<0)throw new Error("Invalid total seconds");let n=Math.floor(t/86400),r=Math.floor(t%86400/3600),e=Math.floor(t%3600/60),i=t%60;return {days:n,hours:r,minutes:e,seconds:i}}function ut(t){let n=t.split(".").map(o=>Number(o));if(n.length!==4||n.some(o=>!Number.isInteger(o)||o<0||o>255))throw new Error("Invalid IPv4 address");let r=new ArrayBuffer(4),e=new DataView(r),i=0;for(;i<4;)e.setUint8(i,n[i]),i++;return e.getUint32(0,false)}function mt(t){if(!b(t))return "";let n=new ArrayBuffer(4),r=new DataView(n);r.setUint32(0,t,false);let e=[],i=0;for(;i<4;)e.push(r.getUint8(i)),i++;return e.join(".")}function h(t){return Array.isArray(t)}function I(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)||m(t)){let n=new Date(t);return !Number.isNaN(n.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 bt(t){return a(t)?U.test(t):false}function yt(t){return t!=null}function j(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 n=t.trim();return Z.test(n)}function It(t){return s(t)&&/^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$/.test(t)}function m(t){return typeof t=="number"&&Number.isFinite(t)}function Mt(t){return m(t)&&!Number.isInteger(t)}function Wt(t){return m(t)&&t<0}function A(t){return m(t)&&t<=0}function b(t){return m(t)&&t>0}function $(t){return m(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:n=8,maxLength:r=256,requireUppercase:e=true,requireLowercase:i=true,requireDigit:o=true,requireSpecial:f=true}={}){return !(!s(t)||t.length<n||t.length>r||e&&!/[A-ZА-Я]/.test(t)||i&&!/[a-zа-я]/.test(t)||o&&!/\d/.test(t)||f&&!/[~!?@#$%^&*_\-+()\[\]{}><\\\/|"'.,:;=]/.test(t))}function Xt(t){if(!a(t)&&!m(t))return false;let n=String(t).trim();return !(n.startsWith("-")||(n.match(/\+/g)||[]).length>1||n.includes("+")&&!n.startsWith("+")||!/^\+?[0-9-]+$/.test(n)||n.length<3||n.length>20||!/[0-9]$/.test(n)||n.includes("--"))}function s(t){return typeof t=="string"}function F(t){if(!a(t))return false;let n=t.trim().toLowerCase();return n==="true"||n==="false"}function a(t){return s(t)&&t.trim().length>0}function un(t){if(!a(t))return false;let n=t.trim().toLowerCase();return n==="asc"||n==="desc"}function an(t){return s(t)&&/^[A-Za-z_][A-Za-z0-9_]*$/.test(t)}function pn(t){return j(t)&&/^class\s/.test(Function.prototype.toString.call(t))}var B=/^(['"`])([\s\S]*)\1$/;function N(t,n){let r=t.trim(),e=M(r);if(e.ok)return e.value;let i=B.exec(r);return i?i[2]:n?r:null}function M(t){try{return {ok:!0,value:JSON.parse(t)}}catch{}return {ok:false}}function D(t,n=false){if(t===null||m(t)||S(t))return t;if(I(t)){let r=t,e=[];for(let i of r)a(i)?e.push(N(String(i),n)):e.push(i);return e}if(L(t)){let r=t,e={};for(let i of Object.keys(r)){let o=r[i];a(o)?e[i]=N(String(o),n):e[i]=o;}return e}return h(t)||w(t)?t:a(t)?N(String(t),n):null}function yn(t){try{return w(t)||h(t)?JSON.stringify(t):""}catch{}return ""}function z(t){let n=t.sign<0?"-":"",r=t.digitsInteger.toString();if(t.scale===0)return n+r;let e=t.scale-r.length;if(e>=0)return n+"0."+"0".repeat(e)+r;let i=r.length-t.scale,o=r.slice(0,i),f=r.slice(i);return n+o+"."+f}function E(t){return Number(z(t))}function y(t,n){let r=/^([0-9]+)(?:\.([0-9]*))?e([+\-]?[0-9]+)$/i.exec((()=>{let[o,f]=n.split(/e/i),[p,d=""]=o.split("."),k=p.replace(/^0+/,"")+d,x=parseInt(f,10)-d.length;return `${k||"0"}e${x}`})());if(!r)throw new Error("Failed to parse exponential notation.");let e=r[1],i=parseInt(r[3],10);if($(i))return e=e+"0".repeat(i),{sign:t,integerPart:e||"0",fractionalPart:""};{let o=-i;if(o>=e.length){let f="0".repeat(o-e.length);return {sign:t,integerPart:"0",fractionalPart:f+e}}else {let f=e.length-o;return {sign:t,integerPart:e.slice(0,f),fractionalPart:e.slice(f)}}}}function W(t){if(typeof t=="bigint"){let n=t<0n?-1:1,r=(t<0n?-t:t).toString();return {sign:n,integerPart:r,fractionalPart:""}}if(typeof t=="number"){if(!Number.isFinite(t))throw new Error("Input number is not finite.");let n=t<0?-1:1,e=Math.abs(t).toExponential(30);return y(n,e)}if(typeof t=="string"){let n=t.trim().replace(",",".");if(!n)throw new Error("Input string is empty.");let r=1;if((n.startsWith("+")||n.startsWith("-"))&&(r=n.startsWith("-")?-1:1,n=n.slice(1)),/^[0-9]*\.?[0-9]*(e[+\-]?[0-9]+)?$/i.test(n)){if(/e/i.test(n))return y(r,n);let[e="0",i=""]=n.split(".");return {sign:r,integerPart:e,fractionalPart:i}}throw new Error("Invalid numeric string.")}throw new Error("Unsupported input type.")}function T(t){let{sign:n,integerPart:r,fractionalPart:e}=W(t),i=r.replace(/^0+/,"")||"0",o=e.replace(/0+$/,""),f=i+o||"0";return {sign:n,digitsInteger:BigInt(f),scale:o.length}}function C(t,n,r="half-up"){let e=Math.max(0,Math.trunc(n));if(t.scale<=e)return {...t};let i=t.scale-e,o=10n**BigInt(i),f=t.digitsInteger/o,p=t.digitsInteger%o;if(r==="trunc"||p===0n)return {sign:t.sign,digitsInteger:f,scale:e};let d=o/2n,x=p>=d?f+1n:f;return {sign:t.sign,digitsInteger:x,scale:e}}function O(t,n=1,r=false){try{return E(n>1?C(T(t),n,"half-up"):T(t))}catch(e){if(r)throw e}return 0}function J(t){if(!s(t))return "";let n=g(t);return a(n)?n.toLowerCase():""}function Bn(t){if(!s(t))return "";let n=J(t);return a(n)?n[0].toUpperCase()+n.slice(1):""}function _n(t){return s(t)&&g(t)===""||t===void 0?null:t}function Kn(t,n="+7"){if(!s(t))return null;let r=g(t).replace(/[\s\-().]/g,"");return /^00\d{8,15}$/.test(r)?r="+"+r.slice(2):/^\d{10}$/.test(r)?r=n+r:/^\d{9,15}$/.test(r)&&!r.startsWith("0")&&(r="+"+r),/^\+\d{10,15}$/.test(r)?r:null}function g(t){return String(s(t)?t.trim().normalize("NFKC").replace(/[\u200B-\u200D\uFEFF]/g,""):"")}function nr(t){return s(t)&&g(t)===""||t===null?void 0:t}var ir=t=>{if(!s(t))return t;let n=String(g(t)||"");return n===""?null:n.toLowerCase()};function sr(t=""){return {}}exports.arrFuncArgs=Q;exports.arrSplitPortions=q;exports.boolNormalize=P;exports.dateFloorMin=v;exports.datePartsSec=et;exports.dateSecParts=ot;exports.dateStr=nt;exports.formatToPhone=Kn;exports.ipNumStr=mt;exports.ipStrNum=ut;exports.isArr=h;exports.isArrFilled=I;exports.isBool=S;exports.isClass=pn;exports.isDate=wt;exports.isEmail=bt;exports.isExists=yt;exports.isFunc=j;exports.isIpAddr=Dt;exports.isMacAddr=It;exports.isNum=m;exports.isNumFloat=Mt;exports.isNumN=Wt;exports.isNumNZ=A;exports.isNumP=b;exports.isNumPZ=$;exports.isObj=w;exports.isObjFilled=L;exports.isPassword=Kt;exports.isPhone=Xt;exports.isStr=s;exports.isStrAscDesc=un;exports.isStrBool=F;exports.isStrFilled=a;exports.isVar=an;exports.jsonDecode=D;exports.jsonEncode=yn;exports.jsonParse=M;exports.jsonStrLike=N;exports.numNormalize=O;exports.strLowerCase=J;exports.strNormalCase=Bn;exports.strNormalize=ir;exports.strNull=_n;exports.strTrim=g;exports.strUndefined=nr;exports.urlObj=sr;exports.wait=G;//# sourceMappingURL=browser.cjs.map
|
|
3
2
|
//# sourceMappingURL=browser.cjs.map
|