@rzl-zone/utils-js 3.1.0 → 3.1.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/{chunk-Z4DXK7A6.cjs → chunk-4VCRMMAH.cjs} +1 -1
- package/dist/{chunk-FUS3DVLB.cjs → chunk-5Y52H4VH.cjs} +1 -1
- package/dist/{chunk-TVXADXCC.cjs → chunk-7H7IODCQ.cjs} +1 -1
- package/dist/chunk-7PG6YKIY.cjs +1 -0
- package/dist/{chunk-WBWTXKMC.cjs → chunk-7YVINA3U.cjs} +1 -1
- package/dist/{chunk-PXDRHFIE.js → chunk-AXWJJXJC.js} +1 -1
- package/dist/chunk-DQFU3KLE.cjs +1 -0
- package/dist/{chunk-GGRMHIFJ.cjs → chunk-EXWCTDC3.cjs} +1 -1
- package/dist/{chunk-LBMEEJWA.js → chunk-G2B35D5W.js} +1 -1
- package/dist/{chunk-3KBHD3BS.cjs → chunk-GLUYWYOA.cjs} +1 -1
- package/dist/{chunk-BSVZRN7C.js → chunk-GRSCNTOK.js} +1 -1
- package/dist/{chunk-735HJXBT.cjs → chunk-I6NOFGAK.cjs} +1 -1
- package/dist/{chunk-APHDUCVQ.js → chunk-IRBPXCMR.js} +1 -1
- package/dist/chunk-L73TOPX5.js +1 -0
- package/dist/{chunk-7U44T63D.cjs → chunk-MHXVVDRQ.cjs} +1 -1
- package/dist/{chunk-I7YGXQPI.cjs → chunk-NHNBV5VS.cjs} +1 -1
- package/dist/{chunk-HQ5GQTEE.js → chunk-NXWPZDDX.js} +1 -1
- package/dist/{chunk-SMADKXZE.js → chunk-QVRTHAM2.js} +1 -1
- package/dist/{chunk-4HD2O5A4.js → chunk-RF34NETZ.js} +1 -1
- package/dist/{chunk-6HQDHIOD.js → chunk-SAW7XS4K.js} +1 -1
- package/dist/{chunk-IREHUBF7.js → chunk-URGK5UQT.js} +1 -1
- package/dist/{chunk-EGNZCW4K.js → chunk-WFPQO7KN.js} +1 -1
- package/dist/{chunk-S6Z6I2EG.cjs → chunk-WZE3XLKY.cjs} +1 -1
- package/dist/{chunk-FEKDB32T.js → chunk-X4PD3I5U.js} +1 -1
- package/dist/{chunk-YRM7IJLX.js → chunk-XSFPU3YT.js} +1 -1
- package/dist/{chunk-C6JFHUR2.cjs → chunk-XVHPXRUH.cjs} +1 -1
- package/dist/chunk-Y44ZD3GG.js +1 -0
- package/dist/{chunk-NU3N4WHD.cjs → chunk-ZR7GTJQX.cjs} +1 -1
- package/dist/conversions/index.cjs +1 -1
- package/dist/conversions/index.d.ts +116 -31
- package/dist/conversions/index.js +1 -1
- package/dist/formatting/index.cjs +1 -1
- package/dist/formatting/index.js +1 -1
- package/dist/generator/index.cjs +1 -1
- package/dist/generator/index.js +1 -1
- package/dist/next/index.cjs +1 -1
- package/dist/next/index.js +1 -1
- package/dist/operations/index.cjs +1 -1
- package/dist/operations/index.js +1 -1
- package/dist/predicates/index.cjs +1 -1
- package/dist/predicates/index.js +1 -1
- package/dist/promise/index.cjs +1 -1
- package/dist/promise/index.js +1 -1
- package/dist/rzl-utils.global.js +1 -1
- package/dist/urls/index.cjs +1 -1
- package/dist/urls/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-AJ65QFV2.js +0 -1
- package/dist/chunk-CTBRLEOG.js +0 -1
- package/dist/chunk-E63WVPZE.cjs +0 -1
- package/dist/chunk-YXHCULSO.cjs +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e=require("./chunk-
|
|
1
|
+
"use strict";var e=require("./chunk-DQFU3KLE.cjs"),r=require("./chunk-INUFZJLX.cjs"),t=e=>e instanceof RegExp;function n(e){return e instanceof ArrayBuffer}function s(i,f,o,u=new WeakMap){if(i===f)return!0;if(i!=i&&f!=f)return!0;if(!r.isObjectOrArray(i)||!r.isObjectOrArray(f))return!1;if(u.get(i)===f)return!0;u.set(i,f);const a=(e,t,n,i,f)=>{if(o){const s=o(e,t,n,i,f,u);if(!r.isUndefined(s))return s}return s(e,t,o,u)};if(e.isDate(i)&&e.isDate(f))return i.getTime()===f.getTime();if(t(i)&&t(f))return i.source===f.source&&i.flags===f.flags;if(r.isError(i)&&r.isError(f))return i.name===f.name&&i.message===f.message;if(ArrayBuffer.isView(i)&&ArrayBuffer.isView(f)){const e=new Uint8Array(i.buffer,i.byteOffset,i.byteLength),r=new Uint8Array(f.buffer,f.byteOffset,f.byteLength);if(e.length!==r.length)return!1;for(let t=0;t<e.length;t++)if(e[t]!==r[t])return!1;return!0}if(n(i)&&n(f)){if(i.byteLength!==f.byteLength)return!1;const e=new Uint8Array(i),r=new Uint8Array(f);for(let t=0;t<e.length;t++)if(e[t]!==r[t])return!1;return!0}if(e.isMap(i)&&e.isMap(f)){if(i.size!==f.size)return!1;for(const[e,r]of i){if(!f.has(e))return!1;if(!s(r,f.get(e),o,u))return!1}return!0}if(r.isSet(i)&&r.isSet(f)){if(i.size!==f.size)return!1;for(const e of i){let r=!1;for(const t of f)if(s(e,t,o,u)){r=!0;break}if(!r)return!1}return!0}if(r.isArray(i)&&r.isArray(f)){if(i.length!==f.length)return!1;for(let e=0;e<i.length;e++)if(!a(i[e],f[e],e,i,f))return!1;return!0}if(Object.getPrototypeOf(i)!==Object.getPrototypeOf(f))return!1;const c=Reflect.ownKeys(i),y=Reflect.ownKeys(f);if(c.length!==y.length)return!1;for(const e of c){if(!a(i[e],f[e],e,i,f))return!1}return!0}exports.baseDeepEqual=s,exports.isArrayBuffer=n,exports.isEmptyArray=e=>!r.isArray(e)||0===e.length,exports.isEmptyObject=function(e,t={}){if(!r.isObject(e))return!0;r.assertIsPlainObject(t,{message:({currentType:e,validType:r})=>`Second parameter (\`options\`) must be of type \`${r}\`, but received: \`${e}\`.`});const n=!!r.hasOwnProp(t,"checkSymbols")&&t.checkSymbols;r.assertIsBoolean(n,{message:({currentType:e,validType:r})=>`Parameter \`checkSymbols\` property of the \`options\` (second parameter) must be of type \`${r}\`, but received: \`${e}\`.`});const s=0===Object.keys(e).length;return n?s&&0===Object.getOwnPropertySymbols(e).length:s},exports.isEqual=function(e,r){return s(e,r,void 0,new WeakMap)},exports.isRegExp=t;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e=require("./chunk-7BXIZM57.cjs"),t=require("./chunk-YZR5OGJA.cjs"),r=require("./chunk-XC2PYCT4.cjs"),n=require("./chunk-EBMHQW7X.cjs"),i=require("./chunk-Y4O5KZF6.cjs"),a=require("./chunk-DVMHRLKP.cjs"),s=require("./chunk-E63WVPZE.cjs"),o=require("./chunk-INUFZJLX.cjs"),p=require("date-fns/locale"),c=require("date-fns"),l=(e,t)=>{const r=e.slice(-3),n=e.slice(0,-3);return n?n.replace(/\B(?=(\d{2})+(?!\d))/g,t)+t+r:r};var u=(e,t)=>"fixed"===e?(()=>{let e=0;for(let r=0;r<t.length;r++)e=(e<<5)-e+t.charCodeAt(r),e|=0;return Math.abs(e)})():void 0,m=(e,t,r,n)=>{if(e.length<=t)return"*".repeat(e.length);const i=e.split(""),a=Math.max(t,Math.ceil(e.length*r)),s=new Set;let p=0;for(;s.size<a;){const t=o.isUndefined(n)?Math.floor(Math.random()*e.length):(n+e.length+31*p)%e.length;s.add(t),p++}for(const e of s)i[e]="*";return i.join("")};exports.censorEmail=(e,t={})=>{if(!o.isNonEmptyString(e))return"";o.assertIsPlainObject(t,{message:({currentType:e,validType:t})=>`Second parameter (\`options\`) must be of type \`${t}\`, but received: \`${e}\`.`});const r=o.hasOwnProp(t,"mode")?t.mode:"fixed";if("random"!==r&&"fixed"!==r)throw new TypeError(`Parameter \`mode\` property of the \`options\` (second parameter) must be one of "fixed" or "random", but received: \`${o.getPreciseType(r)}\`, with value: \`${s.safeStableStringify(r)}\`.`);if(!/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/.test(e))return"";const[n,i]=e.split("@"),a=i.split(".");if(a.length<2)return"";const[p,...c]=a,l=c.join("."),f=u(r,e),d=n.length<4?1:2,g=p.length<4?1:2;return`${m(n,d,.6,f)}@${m(p,g,.5,f)}.${l.length<=2?l:m(l,1,.4,f)}`},exports.chunkString=function(e,t,n={}){if(o.isNil(e)||t<=0)return e;if(i.assertIsString(e,{message:({currentType:e,validType:t})=>`First parameter (\`subject\`) must be of type \`${t}\`, but received: \`${e}\`.`}),!a.isInteger(t))throw new TypeError(`Second parameter (\`limiter\`) must be of type \`integer-number\`, but received: \`${o.getPreciseType(t)}\`, with value: \`${s.safeStableStringify(t)}\`.`);o.assertIsPlainObject(n,{message:({currentType:e,validType:t})=>`Third parameter (\`options\`) must be of type \`${t}\`, but received: \`${e}\`.`});const p=o.hasOwnProp(n,"separator")?n.separator:" ",c=!!o.hasOwnProp(n,"reCountAfterSpace")&&n.reCountAfterSpace;if(i.assertIsString(p,{message:({currentType:e,validType:t})=>`Parameter \`separator\` property of the \`options\` (third parameter) must be of type \`${t}\`, but received: \`${e}\`.`}),o.assertIsBoolean(c,{message:({currentType:e,validType:t})=>`Parameter \`reCountAfterSpace\` property of the \`options\` (third parameter) must be of type \`${t}\`, but received: \`${e}\`.`}),e=r.normalizeSpaces(e),!c){let r="",n=0;for(let i=0;i<e.length;i++){n===t&&(r+=p,n=0),r+=e[i],n++}return r}const l=e.split(" "),u=[];let m=[],f=0;for(let e=0;e<l.length;e++){const r=l[e];let n="",i=0;for(let e=0;e<r.length;e++)n+=r[e],i++,i===t&&e<r.length-1&&(n+=p,i=0);m.push(n),f++,f!==t&&e!==l.length-1||(u.push(m.join(p)),m=[],f=0)}return u.join(" ")},exports.formatCurrency=(r,n={})=>{if(!o.isString(r)&&!t.isFinite(r))throw new TypeError(`First parameter (\`value\`) must be of type \`string\` or \`primitive-number\`, but received: \`${o.getPreciseType(r)}\`, with value: \`${s.safeStableStringify(r)}\`.`);o.assertIsPlainObject(n,{message:({currentType:e,validType:t})=>`Second parameter (\`options\`) must be of type \`${t}\`, but received: \`${e}\`.`});const p=!!o.hasOwnProp(n,"decimal")&&n.decimal,c=o.hasOwnProp(n,"totalDecimal")?n.totalDecimal:2,u=!o.hasOwnProp(n,"endDecimal")||n.endDecimal,m=!!o.hasOwnProp(n,"indianFormat")&&n.indianFormat,f=o.hasOwnProp(n,"suffixCurrency")?n.suffixCurrency:"",d=o.hasOwnProp(n,"suffixDecimal")?n.suffixDecimal:"",g=o.hasOwnProp(n,"roundedDecimal")?n.roundedDecimal:"round",y=o.hasOwnProp(n,"negativeFormat")?n.negativeFormat:"dash";let h=o.hasOwnProp(n,"separatorDecimals")?n.separatorDecimals:",",b=o.hasOwnProp(n,"separator")?n.separator:".";if(!(o.isString(b)&&o.isString(h)&&o.isString(f)&&o.isString(d)))throw new TypeError(`Parameter \`separator\`, \`separatorDecimals\`, \`suffixCurrency\` and \`suffixDecimal\` property of the \`options\` (second parameter) must be of type \`string\`, but received: ['separator': \`${o.getPreciseType(b)}\`, 'separatorDecimals': \`${o.getPreciseType(h)}\`, 'suffixCurrency': \`${o.getPreciseType(f)}\`, 'suffixDecimal': \`${o.getPreciseType(d)}\`].`);if(!o.isBoolean(p)||!o.isBoolean(u)||!o.isBoolean(m))throw new TypeError(`Parameter \`decimal\`, \`endDecimal\` and \`indianFormat\` property of the \`options\` (second parameter) must be of type \`boolean\`, but received: ['decimal': \`${o.getPreciseType(p)}\`, 'endDecimal': \`${o.getPreciseType(u)}\`, 'indianFormat': \`${o.getPreciseType(m)}\`].`);if(!a.isInteger(c))throw new TypeError(`Parameter \`totalDecimal\` property of the \`options\` (second parameter) must be of type \`integer-number\`, but received: \`${o.getPreciseType(c)}\`, with value: \`${s.safeStableStringify(length)}\`.`);if(!1!==g&&"round"!==g&&"ceil"!==g&&"floor"!==g)throw new TypeError(`Parameter \`roundedDecimal\` property of the \`options\` (second parameter) must be of type \`false\` or \`string\` must be one of "round" | "ceil" | "floor", but received: \`${o.getPreciseType(g)}\`, with value: \`${s.safeStableStringify(g)}\`.`);if("abs"!==y&&"brackets"!==y&&"dash"!==y&&!o.isPlainObject(y))throw new TypeError(`Parameter \`negativeFormat\` property of the \`options\` (second parameter) must be of type \`string\` must be one of "abs" | "brackets" | "dash" or \`plain-object\` type, but received: \`${o.getPreciseType(y)}\`, with value: \`${s.safeStableStringify(y)}\`.`);const $=o.isString(r)?e.parseCurrencyString(r):r;if(o.isNaN($))throw new TypeError("First parameter (`value`) could not be parsed into a valid `number`.");let P="",S="",w=Math.abs($);const T=Math.pow(10,c);if(g){const e=w*T;switch(g){case"round":w=Math.round(e)/T;break;case"ceil":w=Math.ceil(e)/T;break;case"floor":w=Math.floor(e)/T}}if(g)[P,S]=w.toFixed(c).split("."),S=S??"".padEnd(c,"0");else{const e=String(w).split(".");P=e[0],S=(e[1]||"").slice(0,c).padEnd(c,"0")}let v;if(m?(b=",",h=".",v=(f.trim().length?f:"")+l(P,b)):v=(f.trim().length?f:"")+P.replace(/\B(?=(\d{3})+(?!\d))/g,b),p&&!o.isUndefined(S)&&c>0){let e=h+S;u&&(e+=d),v+=e}if($<0)if("dash"===y)v="-"+v;else if("brackets"===y)v="("+v+")";else if("abs"===y);else if(o.isPlainObject(y))if(o.hasOwnProp(y,"custom")){const e=y.custom;if(!o.isFunction(e))throw new TypeError(`Parameter \`negativeFormat.custom\` property of the \`options\` (second parameter) must be of type function: \`(formatted: string) => string\`, but received: \`${o.getPreciseType(e)}\`.`);const t=e(v);i.assertIsString(t,{message:({currentType:e,validType:t})=>`Parameter \`negativeFormat.custom\` property of the \`options\` (second parameter) expected return a \`${t}\` type value, but received: \`${e}\`.`}),v=t}else{const e=y.style||"dash",t=!o.isUndefined(y.space)&&y.space;if(o.assertIsBoolean(t,{message:({currentType:e,validType:t})=>`Parameter \`negativeFormat.space\` property of the \`options\` (second parameter) must be of type \`${t} or undefined\`, but received: \`${e}\`.`}),"abs"!==e&&"brackets"!==e&&"dash"!==e)throw new TypeError(`Parameter \`negativeFormat.style\` property of the \`options\` (second parameter) must be of type \`string\` must be of type "abs" | "brackets" | "dash", but received: \`${o.getPreciseType(e)}\`, with value: \`${s.safeStableStringify(e)}\`.`);switch(e){case"dash":v="-"+(t?" ":"")+v;break;case"brackets":v=t?`( ${v} )`:`(${v})`}}return v},exports.formatDateFns=(e,t={})=>{if(o.isNil(e)||!c.isDate(e)&&!o.isNonEmptyString(e))return null;o.isPlainObject(t)||(t={});const{inputFormat:r,locale:n="en",inputLocale:i="en",...a}=t,s=o.hasOwnProp(t,"format")&&o.isNonEmptyString(t.format)?t.format:"dd MMM yyyy - HH:mm:ss";let l;try{if(o.isNonEmptyString(e)&&r&&i){const t=o.isNonEmptyString(i)?"id"===i?p.id:p.enUS:i;l=c.parse(e,r,new Date,{locale:t})}else l=new Date(e);if(o.isNaN(l.getTime()))return null;const t=o.isNonEmptyString(n)?"id"===n?p.id:p.enUS:n;return c.format(l,s,{...a,locale:t})}catch{return null}},exports.formatDateIntl=(e,t)=>{if(o.isNil(e)||!c.isDate(e)&&!o.isNonEmptyString(e))return null;const r=new Date(e);if(o.isNaN(r.getTime()))return null;o.isPlainObject(t)||(t={});const{locale:n="en-US",...i}=t;try{return new Intl.DateTimeFormat(o.isNonEmptyString(n)?n.trim():"en-US",i).format(r)}catch{return null}},exports.formatDateTime=(e,t)=>{if(o.isNil(t)&&(t="YYYY-MM-DD hh:mm:ss"),!o.isString(t))return null;if(o.isNil(e)||!c.isDate(e)&&!o.isNonEmptyString(e))return null;try{const r=new Date(e);if(o.isNaN(r.getTime()))return null;const n=e=>e.toString().padStart(2,"0"),i={YYYY:r.getFullYear().toString(),MM:n(r.getMonth()+1),DD:n(r.getDate()),hh:n(r.getHours()),mm:n(r.getMinutes()),ss:n(r.getSeconds())},a=Object.entries(i).reduce((e,[t,r])=>e.split(t).join(r),t);return a.includes("NaN")?null:a}catch{return null}},exports.formatNumber=(e,r=",")=>{if(!o.isString(e)&&!t.isFinite(e))throw new TypeError(`First parameter (\`value\`) must be of type \`string\` or \`primitive number\`, but received: \`${o.getPreciseType(e)}\`.`);if(!o.isString(r))throw new TypeError(`Second parameter (\`separator\`) must be of type \`string\` or empty as \`undefined\`, but received: \`${o.getPreciseType(r)}\`.`);const n="."===(r=o.isString(r)?r:",")?",":".",i=e.toString().trim(),a=i.lastIndexOf("."),s=i.lastIndexOf(",");let p="";a>s?p=".":s>a&&(p=",");let c=i,l="";if(p){const e=i.split(p);c=e.slice(0,-1).join(p),l=e.slice(-1)[0]}c=c.replace(/[^\d]/g,"");const u=c.replace(/\B(?=(\d{3})+(?!\d))/g,r);return l?`${u}${n}${l}`:u},exports.formatPhoneNumber=function(e,t={}){if(o.isNil(e))return"";if(!o.isString(e)&&!o.isNumber(e))throw new TypeError(`First parameter (\`value\`) must be of type \`string\`, \`number\`, \`null\` or \`undefined\`, but received: \`${o.getPreciseType(e)}\`.`);o.assertIsPlainObject(t,{message:({currentType:e,validType:t})=>`Second parameter (\`options\`) must be of type \`${t}\`, but received: \`${e}\`.`});const r=o.hasOwnProp(t,"separator")?t.separator:" ",n=!!o.hasOwnProp(t,"takeNumberOnly")&&t.takeNumberOnly,i=!!o.hasOwnProp(t,"checkValidOnly")&&t.checkValidOnly,a=o.hasOwnProp(t,"plusNumberCountry")?t.plusNumberCountry:"",s=o.hasOwnProp(t,"openingNumberCountry")?t.openingNumberCountry:"",p=o.hasOwnProp(t,"closingNumberCountry")?t.closingNumberCountry:"";if(!o.isBoolean(n)||!o.isBoolean(i))throw new TypeError(`Parameter \`takeNumberOnly\` and \`checkValidOnly\` property of the \`options\` (second parameter) must be of type \`boolean\` or unset as \`undefined\` value, but received: ['takeNumberOnly': \`${o.getPreciseType(n)}\`, 'checkValidOnly': \`${o.getPreciseType(i)}\`].`);if(!(o.isString(r)&&o.isString(a)&&o.isString(s)&&o.isString(p)))throw new TypeError(`Parameter \`separator\`, \`plusNumberCountry\`, \`openingNumberCountry\` and \`closingNumberCountry\` property of the \`options\` (second parameter) must be of type \`string\` or unset as \`undefined\` value, but received: ['separator': \`${o.getPreciseType(r)}\`, 'plusNumberCountry': \`${o.getPreciseType(a)}\`, 'openingNumberCountry': \`${o.getPreciseType(s)}\`, 'closingNumberCountry': \`${o.getPreciseType(p)}\`].`);if(o.isString(e)||(e=String(e)),n)return e.replace(/\D/g,"");if(i)return/^(\+)?[0-9\s().-]+$/.test(e)&&e.replace(/\D/g,"").length<24;e=e.replace(/\D/g,"");let c=a.trim().replace(/\s+/g,"").replace(/[^\d+]/g,"");/^\+/.test(c)&&(c="+"+c.replace(/^\++/,""));let l="",u="";({7:"Russia, Kazakhstan",27:"South Africa",31:"Netherlands",32:"Belgium",33:"France",34:"Spain",36:"Hungary",39:"Italy, San Marino, Vatican",44:"United Kingdom",46:"Sweden",47:"Norway",48:"Poland",49:"Germany",52:"Mexico",54:"Argentina",55:"Brazil",56:"Chile",61:"Australia",62:"Indonesia",64:"New Zealand",81:"Japan",82:"South Korea",86:"China",90:"Turkey",91:"India",92:"Pakistan",351:"Portugal",352:"Luxembourg",971:"UAE"})[c.replace(/^\+/,"").replace(/[^\d]/g,"")]&&e.startsWith("0")?(l=e.slice(1,4),u=e.slice(4)):(l=e.slice(0,4),u=e.slice(4));const m=c.trim(),f=s.trim(),d=p.trim();let g="";g=m?f&&d?`${f}${m}${d} ${l}`:f&&!d?`${f}${m} ${l}`:!f&&d?`${m}${d} ${l}`:`${m} ${l}`:`${l}`;const y={0:r,4:r,8:r,12:r,16:r,20:r,24:r};for(let e=0;e<u.length;e++){g+=(y[e+l.length]||"")+u[e]}return g},exports.getGMTOffset=e=>{try{if(o.isNil(e)||o.isString(e)&&n.isEmptyString(e))e=new Date;else if(!c.isDate(e)&&!o.isNonEmptyString(e))return"0";const t=new Date(e);if(o.isNaN(t.getTime()))return"0";const r=e=>e.toString().padStart(2,"0");let i=t.getTimezoneOffset();const a=i<0?"+":"-";return i=Math.abs(i),`${a}${r(Math.floor(i/60))}${r(i%60)}`}catch{return"0"}},exports.truncateString=(e,t={})=>{if(!o.isNonEmptyString(e))return"";o.assertIsPlainObject(t,{message:({currentType:e,validType:t})=>`Seconds parameter (\`options\`) must be of type \`${t}\`, but received: \`${e}\`.`});const r=!o.hasOwnProp(t,"trim")||t.trim,p=o.hasOwnProp(t,"length")?t.length:10;let c=o.hasOwnProp(t,"ending")?t.ending:"...";if(!a.isInteger(p))throw new TypeError(`Parameter \`length\` property of the \`options\` (second parameter) must be of type \`integer-number\`, but received: \`${o.getPreciseType(p)}\`, with value: \`${s.safeStableStringify(p)}\`.`);if(p<1)return"";i.assertIsString(c,{message:({currentType:e,validType:t})=>`Parameter \`ending\` property of the \`options\` (second parameter) must be of type \`${t}\`, but received: \`${e}\`.`}),o.assertIsBoolean(r,{message:({currentType:e,validType:t})=>`Parameter \`trim\` property of the \`options\` (second parameter) must be of type \`${t}\`, but received: \`${e}\`.`}),c=n.isEmptyString(c)?"...":c.trim();const l=r?e.trim():e;if(l.length<=p)return l;const u=l.slice(0,p);return(r?u:u.trimEnd())+c};
|
|
1
|
+
"use strict";var e=require("./chunk-7BXIZM57.cjs"),t=require("./chunk-YZR5OGJA.cjs"),r=require("./chunk-XC2PYCT4.cjs"),n=require("./chunk-EBMHQW7X.cjs"),i=require("./chunk-Y4O5KZF6.cjs"),a=require("./chunk-DVMHRLKP.cjs"),s=require("./chunk-DQFU3KLE.cjs"),o=require("./chunk-INUFZJLX.cjs"),p=require("date-fns/locale"),c=require("date-fns"),l=(e,t)=>{const r=e.slice(-3),n=e.slice(0,-3);return n?n.replace(/\B(?=(\d{2})+(?!\d))/g,t)+t+r:r};var u=(e,t)=>"fixed"===e?(()=>{let e=0;for(let r=0;r<t.length;r++)e=(e<<5)-e+t.charCodeAt(r),e|=0;return Math.abs(e)})():void 0,m=(e,t,r,n)=>{if(e.length<=t)return"*".repeat(e.length);const i=e.split(""),a=Math.max(t,Math.ceil(e.length*r)),s=new Set;let p=0;for(;s.size<a;){const t=o.isUndefined(n)?Math.floor(Math.random()*e.length):(n+e.length+31*p)%e.length;s.add(t),p++}for(const e of s)i[e]="*";return i.join("")};exports.censorEmail=(e,t={})=>{if(!o.isNonEmptyString(e))return"";o.assertIsPlainObject(t,{message:({currentType:e,validType:t})=>`Second parameter (\`options\`) must be of type \`${t}\`, but received: \`${e}\`.`});const r=o.hasOwnProp(t,"mode")?t.mode:"fixed";if("random"!==r&&"fixed"!==r)throw new TypeError(`Parameter \`mode\` property of the \`options\` (second parameter) must be one of "fixed" or "random", but received: \`${o.getPreciseType(r)}\`, with value: \`${s.safeStableStringify(r)}\`.`);if(!/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/.test(e))return"";const[n,i]=e.split("@"),a=i.split(".");if(a.length<2)return"";const[p,...c]=a,l=c.join("."),f=u(r,e),d=n.length<4?1:2,g=p.length<4?1:2;return`${m(n,d,.6,f)}@${m(p,g,.5,f)}.${l.length<=2?l:m(l,1,.4,f)}`},exports.chunkString=function(e,t,n={}){if(o.isNil(e)||t<=0)return e;if(i.assertIsString(e,{message:({currentType:e,validType:t})=>`First parameter (\`subject\`) must be of type \`${t}\`, but received: \`${e}\`.`}),!a.isInteger(t))throw new TypeError(`Second parameter (\`limiter\`) must be of type \`integer-number\`, but received: \`${o.getPreciseType(t)}\`, with value: \`${s.safeStableStringify(t)}\`.`);o.assertIsPlainObject(n,{message:({currentType:e,validType:t})=>`Third parameter (\`options\`) must be of type \`${t}\`, but received: \`${e}\`.`});const p=o.hasOwnProp(n,"separator")?n.separator:" ",c=!!o.hasOwnProp(n,"reCountAfterSpace")&&n.reCountAfterSpace;if(i.assertIsString(p,{message:({currentType:e,validType:t})=>`Parameter \`separator\` property of the \`options\` (third parameter) must be of type \`${t}\`, but received: \`${e}\`.`}),o.assertIsBoolean(c,{message:({currentType:e,validType:t})=>`Parameter \`reCountAfterSpace\` property of the \`options\` (third parameter) must be of type \`${t}\`, but received: \`${e}\`.`}),e=r.normalizeSpaces(e),!c){let r="",n=0;for(let i=0;i<e.length;i++){n===t&&(r+=p,n=0),r+=e[i],n++}return r}const l=e.split(" "),u=[];let m=[],f=0;for(let e=0;e<l.length;e++){const r=l[e];let n="",i=0;for(let e=0;e<r.length;e++)n+=r[e],i++,i===t&&e<r.length-1&&(n+=p,i=0);m.push(n),f++,f!==t&&e!==l.length-1||(u.push(m.join(p)),m=[],f=0)}return u.join(" ")},exports.formatCurrency=(r,n={})=>{if(!o.isString(r)&&!t.isFinite(r))throw new TypeError(`First parameter (\`value\`) must be of type \`string\` or \`primitive-number\`, but received: \`${o.getPreciseType(r)}\`, with value: \`${s.safeStableStringify(r)}\`.`);o.assertIsPlainObject(n,{message:({currentType:e,validType:t})=>`Second parameter (\`options\`) must be of type \`${t}\`, but received: \`${e}\`.`});const p=!!o.hasOwnProp(n,"decimal")&&n.decimal,c=o.hasOwnProp(n,"totalDecimal")?n.totalDecimal:2,u=!o.hasOwnProp(n,"endDecimal")||n.endDecimal,m=!!o.hasOwnProp(n,"indianFormat")&&n.indianFormat,f=o.hasOwnProp(n,"suffixCurrency")?n.suffixCurrency:"",d=o.hasOwnProp(n,"suffixDecimal")?n.suffixDecimal:"",g=o.hasOwnProp(n,"roundedDecimal")?n.roundedDecimal:"round",y=o.hasOwnProp(n,"negativeFormat")?n.negativeFormat:"dash";let h=o.hasOwnProp(n,"separatorDecimals")?n.separatorDecimals:",",b=o.hasOwnProp(n,"separator")?n.separator:".";if(!(o.isString(b)&&o.isString(h)&&o.isString(f)&&o.isString(d)))throw new TypeError(`Parameter \`separator\`, \`separatorDecimals\`, \`suffixCurrency\` and \`suffixDecimal\` property of the \`options\` (second parameter) must be of type \`string\`, but received: ['separator': \`${o.getPreciseType(b)}\`, 'separatorDecimals': \`${o.getPreciseType(h)}\`, 'suffixCurrency': \`${o.getPreciseType(f)}\`, 'suffixDecimal': \`${o.getPreciseType(d)}\`].`);if(!o.isBoolean(p)||!o.isBoolean(u)||!o.isBoolean(m))throw new TypeError(`Parameter \`decimal\`, \`endDecimal\` and \`indianFormat\` property of the \`options\` (second parameter) must be of type \`boolean\`, but received: ['decimal': \`${o.getPreciseType(p)}\`, 'endDecimal': \`${o.getPreciseType(u)}\`, 'indianFormat': \`${o.getPreciseType(m)}\`].`);if(!a.isInteger(c))throw new TypeError(`Parameter \`totalDecimal\` property of the \`options\` (second parameter) must be of type \`integer-number\`, but received: \`${o.getPreciseType(c)}\`, with value: \`${s.safeStableStringify(length)}\`.`);if(!1!==g&&"round"!==g&&"ceil"!==g&&"floor"!==g)throw new TypeError(`Parameter \`roundedDecimal\` property of the \`options\` (second parameter) must be of type \`false\` or \`string\` must be one of "round" | "ceil" | "floor", but received: \`${o.getPreciseType(g)}\`, with value: \`${s.safeStableStringify(g)}\`.`);if("abs"!==y&&"brackets"!==y&&"dash"!==y&&!o.isPlainObject(y))throw new TypeError(`Parameter \`negativeFormat\` property of the \`options\` (second parameter) must be of type \`string\` must be one of "abs" | "brackets" | "dash" or \`plain-object\` type, but received: \`${o.getPreciseType(y)}\`, with value: \`${s.safeStableStringify(y)}\`.`);const $=o.isString(r)?e.parseCurrencyString(r):r;if(o.isNaN($))throw new TypeError("First parameter (`value`) could not be parsed into a valid `number`.");let S="",P="",w=Math.abs($);const T=Math.pow(10,c);if(g){const e=w*T;switch(g){case"round":w=Math.round(e)/T;break;case"ceil":w=Math.ceil(e)/T;break;case"floor":w=Math.floor(e)/T}}if(g)[S,P]=w.toFixed(c).split("."),P=P??"".padEnd(c,"0");else{const e=String(w).split(".");S=e[0],P=(e[1]||"").slice(0,c).padEnd(c,"0")}let v;if(m?(b=",",h=".",v=(f.trim().length?f:"")+l(S,b)):v=(f.trim().length?f:"")+S.replace(/\B(?=(\d{3})+(?!\d))/g,b),p&&!o.isUndefined(P)&&c>0){let e=h+P;u&&(e+=d),v+=e}if($<0)if("dash"===y)v="-"+v;else if("brackets"===y)v="("+v+")";else if("abs"===y);else if(o.isPlainObject(y))if(o.hasOwnProp(y,"custom")){const e=y.custom;if(!o.isFunction(e))throw new TypeError(`Parameter \`negativeFormat.custom\` property of the \`options\` (second parameter) must be of type function: \`(formatted: string) => string\`, but received: \`${o.getPreciseType(e)}\`.`);const t=e(v);i.assertIsString(t,{message:({currentType:e,validType:t})=>`Parameter \`negativeFormat.custom\` property of the \`options\` (second parameter) expected return a \`${t}\` type value, but received: \`${e}\`.`}),v=t}else{const e=y.style||"dash",t=!o.isUndefined(y.space)&&y.space;if(o.assertIsBoolean(t,{message:({currentType:e,validType:t})=>`Parameter \`negativeFormat.space\` property of the \`options\` (second parameter) must be of type \`${t} or undefined\`, but received: \`${e}\`.`}),"abs"!==e&&"brackets"!==e&&"dash"!==e)throw new TypeError(`Parameter \`negativeFormat.style\` property of the \`options\` (second parameter) must be of type \`string\` must be of type "abs" | "brackets" | "dash", but received: \`${o.getPreciseType(e)}\`, with value: \`${s.safeStableStringify(e)}\`.`);switch(e){case"dash":v="-"+(t?" ":"")+v;break;case"brackets":v=t?`( ${v} )`:`(${v})`}}return v},exports.formatDateFns=(e,t={})=>{if(o.isNil(e)||!c.isDate(e)&&!o.isNonEmptyString(e))return null;o.isPlainObject(t)||(t={});const{inputFormat:r,locale:n="en",inputLocale:i="en",...a}=t,s=o.hasOwnProp(t,"format")&&o.isNonEmptyString(t.format)?t.format:"dd MMM yyyy - HH:mm:ss";let l;try{if(o.isNonEmptyString(e)&&r&&i){const t=o.isNonEmptyString(i)?"id"===i?p.id:p.enUS:i;l=c.parse(e,r,new Date,{locale:t})}else l=new Date(e);if(o.isNaN(l.getTime()))return null;const t=o.isNonEmptyString(n)?"id"===n?p.id:p.enUS:n;return c.format(l,s,{...a,locale:t})}catch{return null}},exports.formatDateIntl=(e,t)=>{if(o.isNil(e)||!c.isDate(e)&&!o.isNonEmptyString(e))return null;const r=new Date(e);if(o.isNaN(r.getTime()))return null;o.isPlainObject(t)||(t={});const{locale:n="en-US",...i}=t;try{return new Intl.DateTimeFormat(o.isNonEmptyString(n)?n.trim():"en-US",i).format(r)}catch{return null}},exports.formatDateTime=(e,t)=>{if(o.isNil(t)&&(t="YYYY-MM-DD hh:mm:ss"),!o.isString(t))return null;if(o.isNil(e)||!c.isDate(e)&&!o.isNonEmptyString(e))return null;try{const r=new Date(e);if(o.isNaN(r.getTime()))return null;const n=e=>e.toString().padStart(2,"0"),i={YYYY:r.getFullYear().toString(),MM:n(r.getMonth()+1),DD:n(r.getDate()),hh:n(r.getHours()),mm:n(r.getMinutes()),ss:n(r.getSeconds())},a=Object.entries(i).reduce((e,[t,r])=>e.split(t).join(r),t);return a.includes("NaN")?null:a}catch{return null}},exports.formatNumber=(e,r=",")=>{if(!o.isString(e)&&!t.isFinite(e))throw new TypeError(`First parameter (\`value\`) must be of type \`string\` or \`primitive number\`, but received: \`${o.getPreciseType(e)}\`.`);if(!o.isString(r))throw new TypeError(`Second parameter (\`separator\`) must be of type \`string\` or empty as \`undefined\`, but received: \`${o.getPreciseType(r)}\`.`);const n="."===(r=o.isString(r)?r:",")?",":".",i=e.toString().trim(),a=i.lastIndexOf("."),s=i.lastIndexOf(",");let p="";a>s?p=".":s>a&&(p=",");let c=i,l="";if(p){const e=i.split(p);c=e.slice(0,-1).join(p),l=e.slice(-1)[0]}c=c.replace(/[^\d]/g,"");const u=c.replace(/\B(?=(\d{3})+(?!\d))/g,r);return l?`${u}${n}${l}`:u},exports.formatPhoneNumber=function(e,t={}){if(o.isNil(e))return"";if(!o.isString(e)&&!o.isNumber(e))throw new TypeError(`First parameter (\`value\`) must be of type \`string\`, \`number\`, \`null\` or \`undefined\`, but received: \`${o.getPreciseType(e)}\`.`);o.assertIsPlainObject(t,{message:({currentType:e,validType:t})=>`Second parameter (\`options\`) must be of type \`${t}\`, but received: \`${e}\`.`});const r=o.hasOwnProp(t,"separator")?t.separator:" ",n=!!o.hasOwnProp(t,"takeNumberOnly")&&t.takeNumberOnly,i=!!o.hasOwnProp(t,"checkValidOnly")&&t.checkValidOnly,a=o.hasOwnProp(t,"plusNumberCountry")?t.plusNumberCountry:"",s=o.hasOwnProp(t,"openingNumberCountry")?t.openingNumberCountry:"",p=o.hasOwnProp(t,"closingNumberCountry")?t.closingNumberCountry:"";if(!o.isBoolean(n)||!o.isBoolean(i))throw new TypeError(`Parameter \`takeNumberOnly\` and \`checkValidOnly\` property of the \`options\` (second parameter) must be of type \`boolean\` or unset as \`undefined\` value, but received: ['takeNumberOnly': \`${o.getPreciseType(n)}\`, 'checkValidOnly': \`${o.getPreciseType(i)}\`].`);if(!(o.isString(r)&&o.isString(a)&&o.isString(s)&&o.isString(p)))throw new TypeError(`Parameter \`separator\`, \`plusNumberCountry\`, \`openingNumberCountry\` and \`closingNumberCountry\` property of the \`options\` (second parameter) must be of type \`string\` or unset as \`undefined\` value, but received: ['separator': \`${o.getPreciseType(r)}\`, 'plusNumberCountry': \`${o.getPreciseType(a)}\`, 'openingNumberCountry': \`${o.getPreciseType(s)}\`, 'closingNumberCountry': \`${o.getPreciseType(p)}\`].`);if(o.isString(e)||(e=String(e)),n)return e.replace(/\D/g,"");if(i)return/^(\+)?[0-9\s().-]+$/.test(e)&&e.replace(/\D/g,"").length<24;e=e.replace(/\D/g,"");let c=a.trim().replace(/\s+/g,"").replace(/[^\d+]/g,"");/^\+/.test(c)&&(c="+"+c.replace(/^\++/,""));let l="",u="";({7:"Russia, Kazakhstan",27:"South Africa",31:"Netherlands",32:"Belgium",33:"France",34:"Spain",36:"Hungary",39:"Italy, San Marino, Vatican",44:"United Kingdom",46:"Sweden",47:"Norway",48:"Poland",49:"Germany",52:"Mexico",54:"Argentina",55:"Brazil",56:"Chile",61:"Australia",62:"Indonesia",64:"New Zealand",81:"Japan",82:"South Korea",86:"China",90:"Turkey",91:"India",92:"Pakistan",351:"Portugal",352:"Luxembourg",971:"UAE"})[c.replace(/^\+/,"").replace(/[^\d]/g,"")]&&e.startsWith("0")?(l=e.slice(1,4),u=e.slice(4)):(l=e.slice(0,4),u=e.slice(4));const m=c.trim(),f=s.trim(),d=p.trim();let g="";g=m?f&&d?`${f}${m}${d} ${l}`:f&&!d?`${f}${m} ${l}`:!f&&d?`${m}${d} ${l}`:`${m} ${l}`:`${l}`;const y={0:r,4:r,8:r,12:r,16:r,20:r,24:r};for(let e=0;e<u.length;e++){g+=(y[e+l.length]||"")+u[e]}return g},exports.getGMTOffset=e=>{try{if(o.isNil(e)||o.isString(e)&&n.isEmptyString(e))e=new Date;else if(!c.isDate(e)&&!o.isNonEmptyString(e))return"0";const t=new Date(e);if(o.isNaN(t.getTime()))return"0";const r=e=>e.toString().padStart(2,"0");let i=t.getTimezoneOffset();const a=i<0?"+":"-";return i=Math.abs(i),`${a}${r(Math.floor(i/60))}${r(i%60)}`}catch{return"0"}},exports.truncateString=(e,t={})=>{if(!o.isNonEmptyString(e))return"";o.assertIsPlainObject(t,{message:({currentType:e,validType:t})=>`Seconds parameter (\`options\`) must be of type \`${t}\`, but received: \`${e}\`.`});const r=!o.hasOwnProp(t,"trim")||t.trim,p=o.hasOwnProp(t,"length")?t.length:10;let c=o.hasOwnProp(t,"ending")?t.ending:"...";if(!a.isInteger(p))throw new TypeError(`Parameter \`length\` property of the \`options\` (second parameter) must be of type \`integer-number\`, but received: \`${o.getPreciseType(p)}\`, with value: \`${s.safeStableStringify(p)}\`.`);if(p<1)return"";i.assertIsString(c,{message:({currentType:e,validType:t})=>`Parameter \`ending\` property of the \`options\` (second parameter) must be of type \`${t}\`, but received: \`${e}\`.`}),o.assertIsBoolean(r,{message:({currentType:e,validType:t})=>`Parameter \`trim\` property of the \`options\` (second parameter) must be of type \`${t}\`, but received: \`${e}\`.`}),c=n.isEmptyString(c)?"...":c.trim();const l=r?e.trim():e;if(l.length<=p)return l;const u=l.slice(0,p);return(r?u:u.trimEnd())+c};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e=require("./chunk-DVMHRLKP.cjs"),t=require("./chunk-
|
|
1
|
+
"use strict";var e=require("./chunk-DVMHRLKP.cjs"),t=require("./chunk-DQFU3KLE.cjs"),r=require("./chunk-INUFZJLX.cjs");var n=(n,s)=>{if(!e.isInteger(n)||!e.isInteger(s))throw new TypeError(`First parameter (\`min\`) and second parameter (\`max\`) must be of type \`integer-number\`${i(n,s)}value, but received: ['min': \`${r.getPreciseType(n)}\` - (with value: \`${t.safeStableStringify(n)})\`, 'max': \`${r.getPreciseType(s)}\` - (with value: \`${t.safeStableStringify(s)}\`)].`);if(n>s)throw new RangeError(`First parameter (\`min\`) must be less than or equal to second parameter (\`max\`), but received: ['min': ${a(n)}, 'max': ${a(s)}].`);return n=Math.max(1,n),s=Math.min(Number.MAX_SAFE_INTEGER,s),Math.floor(Math.random()*(s-n+1))+n},a=e=>r.isNumber(e,{includeNaN:!0})?e===Number.MIN_VALUE?"`Number.MIN_VALUE`":`${e}`:`\`${r.getPreciseType(e)}\``,i=(...e)=>e.some(e=>r.isNumber(e,{includeNaN:!0})&&e===Number.MIN_VALUE)?" and can't be `Number.MIN_VALUE` ":" ";exports.getRandomItem=function(e){if(!r.isNonEmptyArray(e))return;return e[Math.floor(Math.random()*(e.length||0))]},exports.randomInt=n,exports.randomIntByLength=a=>{r.isPlainObject(a)||(a={});const{minLength:i=1,maxLength:s=16,avoidZero:m=!1}=a;if(r.assertIsBoolean(m,{message:({currentType:e,validType:t})=>`Parameters \`avoidZero\` must be of type \`${t}\`, but received: \`${e}\`.`}),!e.isInteger(i)||!e.isInteger(s))throw new TypeError(`Parameters \`minLength\` and \`maxLength\` must be of type \`integer-number\`, but received: ['minLength': \`${r.getPreciseType(i)}\` - (with value: ${t.safeStableStringify(i)}), 'maxLength': \`${r.getPreciseType(s)}\` - (with value: ${t.safeStableStringify(s)})].`);if(i<1||s>16||i>s)throw new RangeError(`Invalid range at parameters \`minLength\` must be ≥ 1, \`maxLength\` must be ≤ 16, and \`minLength\` ≤ \`maxLength\`, but received: ['minLength': \`${i}\`, 'maxLength': \`${s}\`].`);const o=i===s?i:n(i,s),h=10**(o-1);let u=n(h,10**o-1);return m&&0===u&&(u=h),u},exports.randomStr=a=>{r.isPlainObject(a)||(a={});const{minLength:i=40,maxLength:s=40,type:m="string",avoidWhiteSpace:o=!0}=a;if(r.assertIsBoolean(o,{message:({currentType:e,validType:t})=>`Parameters \`avoidWhiteSpace\` property of the \`options\` (first-parameter) must be of type \`${t}\`, but received: \`${e}\`.`}),!e.isInteger(i)||!e.isInteger(s))throw new TypeError(`Parameters \`minLength\` and \`maxLength\` must be of type \`integer-number\`, but received: ['minLength': \`${r.getPreciseType(i)}\` - (with value: ${t.safeStableStringify(i)}), 'maxLength': \`${r.getPreciseType(s)}\` - (with value: ${t.safeStableStringify(s)})].`);if(i<1||s>5e3||i>s)throw new RangeError(`Invalid range at parameters \`minLength\` must be ≥ 1, \`maxLength\` must be ≤ 5000, and \`minLength\` ≤ \`maxLength\`, but received: ['minLength': \`${i}\`, 'maxLength': \`${s}\`].`);if("string"!==m&&"number"!==m)throw new TypeError(`Parameter \`type\` must be of type \`string\` with value one of "string" | "number", but received: \`${r.getPreciseType(m)}\`, with value: ${t.safeStableStringify(m)}.`);const h=n(i,s),u="number"===m?(r.isNaN(Number(a.replaceGenInt))?void 0:a.replaceGenInt)??"0123456789":(a.replaceGenStr?a.replaceGenStr:void 0)??"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",g=(c=u,(o?c.replace(/\s|\n|\t/g,""):c)+(a.addChar||""));var c;if(!g.length){throw new Error(`Character set is empty. ${(()=>"number"===m?o?"If `avoidWhiteSpace` is true, and `replaceGenInt` cant be empty-string value, ensure `replaceGenInt` has valid characters and non-nan string number.":"Ensure `replaceGenInt` has valid characters and not a NaN number string while convert to number.":"Ensure `replaceGenStr` has valid characters and non empty string.")()}`)}let p="";for(let e=0;e<h;e++)p+=g.charAt(Math.floor(Math.random()*g.length));return p};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var e=require("./chunk-4VCRMMAH.cjs"),r=require("./chunk-YT3MSZKK.cjs"),t=require("./chunk-YZR5OGJA.cjs"),i=require("./chunk-DQFU3KLE.cjs"),s=require("./chunk-UDA26MCU.cjs"),n=require("./chunk-INUFZJLX.cjs");function a(r,t){if(!1!==t&&"stringOrNumber"!==t&&"primitives"!==t&&"all"!==t)throw new TypeError(`Second parameter \`forceToString\` must be of type \`false\` or \`string\` with value one of "stringOrNumber" | "primitives" | "all", but received: \`${n.getPreciseType(t)}\`, with value: \`${i.safeStableStringify(t)}\`.`);if(n.isNaN(r))return"primitives"===t||"all"===t?"NaN":NaN;if(n.isString(r)||n.isNumber(r))return"stringOrNumber"===t||"primitives"===t||"all"===t?String(r):r;if(n.isBoolean(r)||s.isBigInt(r)||n.isNil(r))return"primitives"===t||"all"===t?String(r):r;if(n.isNumberObject(r)||n.isBooleanObject(r)||n.isStringObject(r))return"all"===t?r.valueOf().toString():r;if(n.isSymbol(r))return"all"===t?r.toString():r;if(n.isFunction(r))return"all"===t?r.toString():r;if(n.isArray(r))return r.map(e=>a(e,t));if(n.isObjectOrArray(r)){if(i.isDate(r))return"all"===t?r.toISOString():r;if(e.isRegExp(r))return"all"===t?r.toString():r;if(n.isError(r)||r instanceof Promise)return"all"===t?r.toString():r;if(n.isSet(r))return"all"===t?[...r].map(e=>a(e,t)):r;if(i.isMap(r))return"all"===t?[...r.entries()].map(([e,r])=>[a(e,t),a(r,t)]):r;const s={};if(n.isObject(r))for(const e of Object.keys(r))s[e]=a(r[e],t);return s}return r}function o(r){if(n.isNil(r))return;if(!n.isArray(r))return[];return r.reduce((r,t)=>{if(!n.isNil(t))if(n.isArray(t)){const i=o(t);i&&!e.isEmptyArray(i)&&r.push(i)}else r.push(t);return r},[])}exports.dedupeArray=(t,s={})=>{r.assertIsArray(t,{message:({currentType:e,validType:r})=>`First parameter (\`inputArray\`) must be of type \`${r}\` (array literal or instance), but received: \`${e}\`.`}),n.assertIsPlainObject(s,{message:({currentType:e,validType:r})=>`Second parameter (\`options\`) must be of type \`${r}\`, but received: \`${e}\`.`});const o=!!n.hasOwnProp(s,"flatten")&&s.flatten,u=!!n.hasOwnProp(s,"forceToString")&&s.forceToString;if(!1!==u&&"stringOrNumber"!==u&&"primitives"!==u&&"all"!==u)throw new TypeError(`Parameter \`forceToString\` property of the \`options\` (second parameter) must be of type \`false\` or \`string\` with value one of "stringOrNumber" | "primitives" | "all", but received: \`${n.getPreciseType(u)}\`, with value: \`${i.safeStableStringify(u)}\`.`);n.assertIsBoolean(o,{message:({currentType:e,validType:r})=>`Parameter \`flatten\` property of the \`options\` (second parameter) must be of type \`${r}\`, but received: \`${e}\`.`});const l=r=>{const t=[];return r.reduce((r,i)=>{const s=n.isArray(i)?l(i):a(i,u);return t.some(r=>e.isEqual(r,s))||(t.push(s),r.push(s)),r},[])},p=e=>n.isArray(e)?e.flatMap(p):n.isSet(e)?[...e].flatMap(p):i.isMap(e)?[...e.values()].flatMap(p):[e];return l(o?p(t):t)},exports.filterNilArray=o,exports.toStringArrayUnRecursive=function(e,r={}){n.assertIsPlainObject(r,{message:({currentType:e,validType:r})=>`Second parameter (\`options\`) must be of type \`${r}\`, but received: \`${e}\`.`});const i=!n.hasOwnProp(r,"removeInvalidValue")||r.removeInvalidValue;if(n.assertIsBoolean(i,{message:({currentType:e,validType:r})=>`Parameter \`removeInvalidValue\` property of the \`options\` (second parameter) must be of type \`${r}\`, but received: \`${e}\`.`}),n.isArray(e)){const r=Array.from(e,e=>n.isString(e)||t.isFinite(e)||n.isBoolean(e)||s.isBigInt(e)?String(e):n.isNull(e)?null:void 0);return i?o(r):r}},exports.toStringDeepForce=a;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var t=require("./chunk-
|
|
1
|
+
"use strict";var t=require("./chunk-EXWCTDC3.cjs"),r=new Set(["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]","[object BigInt64Array]","[object BigUint64Array]"]);exports.isNonEmptyValue=(r,e={})=>!t.isEmptyValue(r,e),exports.isTypedArray=function(t){return null!=t&&"object"==typeof t&&r.has(Object.prototype.toString.call(t))};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{isURL as r}from"./chunk-ONZFBJVW.js";import{toStringArrayUnRecursive as e}from"./chunk-
|
|
1
|
+
import{isURL as r}from"./chunk-ONZFBJVW.js";import{toStringArrayUnRecursive as e}from"./chunk-Y44ZD3GG.js";import{isEmptyValue as t}from"./chunk-X4PD3I5U.js";import{assertIsArray as n}from"./chunk-ZXIWDFEQ.js";import{normalizeString as o}from"./chunk-Q6NHYWVX.js";import{isEmptyString as a}from"./chunk-TSLYDPBJ.js";import{safeStableStringify as s}from"./chunk-L73TOPX5.js";import{isString as i,getPreciseType as c,isUndefined as m,isNonEmptyString as u,isFunction as p,isNumber as h,isError as l}from"./chunk-2UIRWYE3.js";var f=(f,y,d)=>{if(i(f)){if(a(f))throw new TypeError("First parameter (`baseUrl`) cannot be an empty-string.");f=o(f)}else if(!r(f))throw new TypeError(`First parameter (\`baseUrl\`) must be of type an URL instance or a \`string\` and a non empty-string, but received: \`${c(f)}\`, with current value: \`${s(f)}\`.`);if(!m(d)&&(n(d,{message:({currentType:r,validType:e})=>`Third parameter (\`removeParams\`) must be of type \`${e} of strings\`, but received: \`${r}\`.`}),!d.every(r=>u(r))))throw new TypeError("Third parameter (`removeParams`) must be of type `array` and contains `string` only and non empty-string.");try{if(!m(y)&&!p(y[Symbol.iterator]))throw new TypeError(`Second parameter (\`queryParams\`) must be iterable (like URLSearchParams.entries() or an array of [[string, string | number]...]), but received: \`${c(y)}\`, with value: \`${s(y)}\`.`);const r=new URL(f);if(!m(y)){const n=Object.fromEntries(y);if(!t(n)){const t=new URLSearchParams(r.search);for(const[r,e]of Object.entries(n)){if(!u(e)&&!h(e,{includeNaN:!0}))throw new TypeError(`Second parameter (\`queryParams\`) must be iterable (like URLSearchParams.entries() or an array of [[string, string | number]...]), but received: \`${c(y)}\`, with value: \`${s(y)}\`.`);t.set(r,String(e))}(null==d?void 0:d.length)&&e(d).map(r=>{t.delete(r)}),r.search=t.toString()}}return null==d||d.forEach(e=>r.searchParams.delete(e)),r}catch(r){if(l(r))throw r;throw new Error("Failed to construct a valid URL in `constructURL()`, Error:"+r)}},y=r=>{if(!u(r))return null;let e;try{e=decodeURIComponent(r)}catch{return null}const t=e.match(/https?:\/\/.*?(?=https?:\/\/|\s|$)/g);if(!t)return null;const n=t.map(r=>r.replace(/[.,;:!?)]*$/,"")).filter(r=>{try{const e=new URL(r);return"http:"===e.protocol||"https:"===e.protocol}catch{return!1}});return n.length?n:null};export{f as constructURL,y as extractURLs};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var e=require("./chunk-UDA26MCU.cjs"),r=require("./chunk-INUFZJLX.cjs");function t(e){return"[object Map]"===Object.prototype.toString.call(e)||e instanceof Map}var n=(e,t={})=>{r.assertIsPlainObject(t,{message:({currentType:e,validType:r})=>`Second parameter (\`options\`) must be of type \`${r}\`, but received: \`${e}\`.`});const n=!(!r.isPlainObject(t)||!r.isBoolean(t.skipInvalidDate))&&t.skipInvalidDate,i=e instanceof Date;return n?i:i&&!r.isNaN(e.getTime())};exports.isDate=n,exports.isMap=t,exports.safeStableStringify=(i,s={})=>{r.assertIsPlainObject(s,{message:({currentType:e,validType:r})=>`Second parameter (\`options\`) must be of type \`${r}\`, but received: \`${e}\`.`});const o=!!r.hasOwnProp(s,"pretty")&&s.pretty,a=!r.hasOwnProp(s,"sortKeys")||s.sortKeys,u=!!r.hasOwnProp(s,"sortArray")&&s.sortArray,c=!!r.hasOwnProp(s,"keepUndefined")&&s.keepUndefined;if(!(r.isBoolean(a)&&r.isBoolean(u)&&r.isBoolean(o)&&r.isBoolean(c)))throw new TypeError(`Parameters \`sortKeys\`, \`sortArray\`, \`keepUndefined\` and \`pretty\` property of the \`options\` (second parameter) must be of type \`boolean\`, but received: "['sortKeys': \`${r.getPreciseType(a)}\`, 'sortArray': \`${r.getPreciseType(u)}\`, 'keepUndefined': \`${r.getPreciseType(c)}\`, 'pretty': \`${r.getPreciseType(o)}\`]".`);if(r.isUndefined(i))return c?"undefined":"null";const p=new WeakSet,f=e=>r.isNull(e)||!r.isObjectOrArray(e)&&!r.isFunction(e),l=i=>{if(r.isNumberObject(i)){const e=i.valueOf();return r.isNaN(e)||r.isInfinityNumber(e)?null:e}if(r.isStringObject(i))return i.valueOf();if(r.isBooleanObject(i))return i.valueOf();if(!r.isFunction(i)&&!r.isSymbol(i)){if(e.isBigInt(i))return i.toString();if(r.isNaN(i)||r.isInfinityNumber(i))return null;if(r.isUndefined(i))return c?void 0:null;if(r.isObjectOrArray(i)){if(p.has(i))return"[Circular]";if(p.add(i),n(i))return i.toISOString();if(t(i))return{map:Array.from(i.entries()).map(([e,r])=>[e,l(r)])};if(r.isSet(i))return{set:Array.from(i.values()).map(l)};if(r.isArray(i)){const e=i.map(l);if(u){const t=[],n=[];for(const r of e)f(r)?t.push(r):n.push(r);return t.sort((e,t)=>r.isNumber(e)&&r.isNumber(t)?e-t:String(e).localeCompare(String(t))),[...t,...n]}return e}const e=Object.keys(i);a&&e.sort((e,t)=>{const n=Number(e),i=Number(t);return r.isNaN(n)||r.isNaN(i)?e.localeCompare(t):n-i});const s={};if(r.isObject(i))for(const t of e){const e=l(i[t]);r.isUndefined(e)||(s[t]=e)}return s}return i}};try{return JSON.stringify(l(i),null,o?2:0)}catch(e){return console.warn("Error in safeStableStringify:",e),"{}"}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e=require("./chunk-
|
|
1
|
+
"use strict";var e=require("./chunk-4VCRMMAH.cjs"),s=require("./chunk-EBMHQW7X.cjs"),r=require("./chunk-INUFZJLX.cjs");exports.isEmptyValue=(t,c={})=>{r.assertIsPlainObject(c,{message:({currentType:e,validType:s})=>`Second parameter (\`options\`) must be of type \`${s}\`, but received: \`${e}\`.`});const i=!!r.hasOwnProp(c,"checkSymbols")&&c.checkSymbols;return r.assertIsBoolean(i,{message:({currentType:e,validType:s})=>`Parameter \`checkSymbols\` property of the \`options\` (second parameter) must be of type \`${s}\`, but received: \`${e}\`.`}),!(!r.isNil(t)&&!1!==t&&!r.isNaN(t))||(r.isString(t)?s.isEmptyString(t):r.isArray(t)?e.isEmptyArray(t):!!r.isObject(t)&&e.isEmptyObject(t,{checkSymbols:i}))};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{isEmptyArray as e,isEmptyObject as r}from"./chunk-
|
|
1
|
+
import{isEmptyArray as e,isEmptyObject as r}from"./chunk-GRSCNTOK.js";import{noop as t}from"./chunk-FIAAX3UE.js";import{safeStableStringify as o}from"./chunk-L73TOPX5.js";import{isString as n,isNumber as s,isNull as a,isUndefined as c,isNaN as i,isArray as m,isObject as l,isNonEmptyString as u,getPreciseType as v,isError as f,assertIsPlainObject as d,hasOwnProp as p,isBoolean as N,isFunction as g}from"./chunk-2UIRWYE3.js";var y=e=>{if(!n(e)&&!s(e))return 0;const r=String(e).trim().replace(/[^0-9]/g,"");return Number(r)||0},b=(e={})=>{d(e,{message:({currentType:e,validType:r})=>`Second parameter (\`options\`) must be of type \`${r}\`, but received: \`${e}\`.`});const r=!!p(e,"convertBooleans")&&e.convertBooleans,o=!!p(e,"convertDates")&&e.convertDates,n=!!p(e,"convertNumbers")&&e.convertNumbers,s=!!p(e,"loggingOnFail")&&e.loggingOnFail,a=!!p(e,"removeEmptyArrays")&&e.removeEmptyArrays,c=!!p(e,"removeEmptyObjects")&&e.removeEmptyObjects,i=!!p(e,"removeNulls")&&e.removeNulls,l=!!p(e,"removeUndefined")&&e.removeUndefined,u=!!p(e,"strictMode")&&e.strictMode,f=!!p(e,"checkSymbols")&&e.checkSymbols,y=!!p(e,"convertNaN")&&e.convertNaN,b=p(e,"customDateFormats")?e.customDateFormats:[],E=p(e,"onError")?e.onError:t;if(!(N(r)&&N(o)&&N(n)&&N(y)&&N(f)&&N(s)&&N(a)&&N(c)&&N(i)&&N(l)&&N(u)&&m(b)&&g(E)))throw new TypeError(`Invalid \`options\` parameter (second argument): \`convertBooleans\`, \`convertDates\`, \`convertNumbers\`, \`loggingOnFail\`, \`removeEmptyArrays\`, \`removeEmptyObjects\`, \`removeNulls\`, \`removeUndefined\`, \`strictMode\` expected to be a \`boolean\` type, \`customDateFormats\` expected to be a \`array\` type and \`onError\` expected to be a \`void function\` type. But received: ['convertBooleans': \`${v(r)}\`, 'convertDates': \`${v(o)}\`, 'convertNumbers': \`${v(n)}\`, 'loggingOnFail': \`${v(s)}\`, 'removeEmptyArrays': \`${v(a)}\`, 'removeEmptyObjects': \`${v(c)}\`, 'removeNulls': \`${v(i)}\`, 'removeUndefined': \`${v(l)}\`, 'strictMode': \`${v(u)}\`, 'customDateFormats': \`${v(b)}\`, 'onError': \`${v(E)}\`].`);return{convertBooleans:r,convertDates:o,convertNumbers:n,convertNaN:y,loggingOnFail:s,removeEmptyArrays:a,removeEmptyObjects:c,removeNulls:i,removeUndefined:l,strictMode:u,customDateFormats:b,onError:E,checkSymbols:f}},E=(t,o={})=>{var s;const u=b(o);if(a(t))return u.removeNulls?void 0:null;if(!c(t)){if(n(t)){const e=t.trim();if(u.convertNaN&&"NaN"===e)return NaN;if(u.convertNumbers&&!i(Number(e)))return Number(e);if(u.convertBooleans){if("true"===e)return!0;if("false"===e)return!1}if(u.convertDates){if(/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/.test(e))return new Date(e);if(null==(s=u.customDateFormats)?void 0:s.length)for(const r of u.customDateFormats){const t=D(e,r);if(t)return t}}return u.strictMode?void 0:e}if(m(t)){const r=t.map(e=>E(e,u)).filter(e=>!c(e));return u.removeEmptyArrays&&e(r)?void 0:r}if(l(t)){const e={};for(const r in t)if(Object.prototype.hasOwnProperty.call(t,r)){const o=E(t[r],u);c(o)||(e[r]=o)}return u.removeEmptyObjects&&r(e,{checkSymbols:u.checkSymbols})?void 0:e}return u.strictMode?void 0:t}u.removeUndefined},D=(e,r)=>{if(!u(e)||!u(r))throw new TypeError(`Parameter \`dateString\` and \`format\` must be of type \`string\` and not empty-string, but received: "['dateString': \`${v(e)}\` - (current value: \`${o(e)}\`), 'format': \`${v(r)}\` - (current value: \`${o(r)}\`)]".`);const t=e.split(/[-/]/).map(Number);if(3!==t.length||t.some(i))return null;let n,s,a;if("DD/MM/YYYY"===r)[n,s,a]=t;else{if("MM/DD/YYYY"!==r)return null;[s,n,a]=t}s-=1;const c=new Date(a,s,n);return c.getFullYear()!==a||c.getMonth()!==s||c.getDate()!==n?null:c};function h(e,r={}){if(a(e))return null;const t=b(r);if(t.convertNaN&&(i(e)||u(e)&&"NaN"===e))return NaN;if(t.convertNumbers&&!i(Number(e))&&s(y(e)))return Number(e);if(n(e))try{let r=function(e){const r=new Set(["\\",'"',"/","b","f","n","r","t","u"]);let t="",o=!1,n=!1,s=!1;for(let a=0;a<e.length;a++){const c=e[a];if(s)o?"'"===c?t+="'":r.has(c)?t+="\\"===c?"\\\\":'"'===c?'\\"':"\\"+c:t+="\\\\"+c:n?'"'===c?t+='\\"':r.has(c)?t+="\\"+c:t+="\\\\"+c:t+="\\"+c,s=!1;else if("\\"!==c){if(o||n){if(o){if("'"===c){t+='"',o=!1;continue}}else if(n&&'"'===c){t+='"',n=!1;continue}}else{if("'"===c){t+='"',o=!0;continue}if('"'===c){t+='"',n=!0;continue}}t+=c}else s=!0}return t}(e);r=t.removeUndefined?r.replace(/,\s*"[^"]*"\s*:\s*undefined(?=\s*[},])/g,"").replace(/"[^"]*"\s*:\s*undefined\s*(,)?/g,""):r.replace(/:\s*undefined(?=\s*[,}])/g,":null"),r=t.convertNaN?r.replace(/:\s*NaN(?=\s*[,}])/g,':"NaN"'):r.replace(/:\s*NaN(?=\s*[,}])/g,':"NaN"').replace(/,\s*"[^"]*"\s*:\s*NaN(?=\s*[},])/g,"").replace(/"[^"]*"\s*:\s*NaN\s*(,)?/g,""),r=r.replace(/,(\s*[}\]])/g,"$1");const o=JSON.parse(r);return E(o,t)}catch(e){return t.loggingOnFail&&console.error("Failed to parsing at `safeJsonParse`:",e),void t.onError(f(e)?new Error(e.message.replace(/^JSON\.parse:/,"Failed to parsing")):new Error(String(e)))}}export{E as cleanParsedData,y as extractDigits,D as parseCustomDate,h as safeJsonParse};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e=require("./chunk-
|
|
1
|
+
"use strict";var e=require("./chunk-7YVINA3U.cjs"),r=require("./chunk-7PG6YKIY.cjs"),t=require("./chunk-4VCRMMAH.cjs"),i=require("./chunk-YT3MSZKK.cjs"),s=require("./chunk-EBMHQW7X.cjs"),n=require("./chunk-Y4O5KZF6.cjs"),o=require("./chunk-DQFU3KLE.cjs"),a=require("./chunk-UDA26MCU.cjs"),m=require("./chunk-INUFZJLX.cjs");var y=e=>!m.isNil(e)&&(m.isString(e)?m.isNonEmptyString(e):m.isBoolean(e)?e:m.isNumber(e,{includeNaN:!0})?0!==e:m.isArray(e)?e.some(y):!!m.isObject(e)&&Object.values(e).some(y)),p=(e,r)=>{if(!m.isObjectOrArray(e))return e;const[i,...s]=r;if(m.isArray(e))for(const t of e)m.isObjectOrArray(t)&&p(t,r);else t.isEmptyArray(s)?m.isPlainObject(e)&&delete e[i]:m.isPlainObject(e)&&m.isObjectOrArray(e[i])&&p(e[i],s);return e},c=(e,r)=>{if(!m.isPlainObject(e))return e;const[t,...i]=r;return 0===i.length?m.isPlainObject(e)&&delete e[t]:m.isPlainObject(e[t])&&c(e[t],i),e};exports.convertType=e=>{const r={undefined:void 0,null:null,nan:NaN,true:!0,false:!1,yes:!0,no:!1};if(m.isString(e)){const t=e.trim().toLowerCase();if(Object.prototype.hasOwnProperty.call(r,t))return r[t];const i=t.replace(/,/g,""),s=Number(i);return!m.isNaN(s)&&m.isNonEmptyString(i)?s:e.trim()}return e},exports.removeObjectPaths=function(e,r,s=!0){if(t.isEmptyObject(e,{checkSymbols:!0}))return{};if(i.assertIsArray(r,{message:({currentType:e,validType:t})=>`Second parameter (\`keysToDelete\`) must be of type \`${t}\` with value of { key: string, deep?: boolean } plain-object, but received: \`${e}\`, with value: \`${o.safeStableStringify(r)}\`.`}),!r.every(e=>m.isPlainObject(e)&&"key"in e))throw new TypeError(`Each element in Second Parameter (\`keysToDelete\`) must be of type \`plain-object\` with at least a "key" property (optionally "deep"), but received: \`${o.safeStableStringify(r)}\`.`);let a=s?(e=>{try{if(m.isFunction(structuredClone))return structuredClone(e)}catch{}return JSON.parse(JSON.stringify(e))})(e):e;for(const{key:e,deep:t}of r){if(n.assertIsString(e,{message:({currentType:e,validType:r})=>`Parameter \`key\` at Second Parameter (\`keysToDelete\`) must be of type \`${r}\`, but received: \`${e}\`.`}),!m.isUndefined(t)&&!m.isBoolean(t))throw new TypeError(`Parameter \`deep\` at Second Parameter (\`keysToDelete\`) ➔ (key: "${e}", deep: ${t}) must be of type \`boolean\` or \`undefined\`, but received: \`${m.getPreciseType(t)}\`.`);const r=e.split(".");a=t?p(a,r):c(a,r)}return a},exports.toBooleanContent=r=>!m.isNil(r)&&(m.isString(r)?m.isNonEmptyString(r):m.isBoolean(r)?r:m.isNumber(r,{includeNaN:!0})?0!==r:m.isArray(r)||m.isObject(r)?e.isNonEmptyValue(r):Boolean(r)),exports.toBooleanContentDeep=y,exports.toBooleanExplicit=(e,r={})=>{if(m.isNil(e))return!1;m.isPlainObject(r)||(r={});const t=!!m.hasOwnProp(r,"caseInsensitive")&&r.caseInsensitive,i=!m.hasOwnProp(r,"trimString")||r.trimString,s=!!m.hasOwnProp(r,"includeIndeterminate")&&r.includeIndeterminate;if(!m.isBoolean(t)||!m.isBoolean(i)||!m.isBoolean(s))throw new TypeError(`Parameters \`caseInsensitive\`, \`trimString\` and \`includeIndeterminate\` property of the \`options\` (second parameter) expected to be a \`boolean\` type, but received: ['caseInsensitive': \`${m.getPreciseType(t)}\`, 'trimString': \`${m.getPreciseType(i)}\`, 'includeIndeterminate': \`${m.getPreciseType(s)}\`].`);if(m.isString(e)){let r=e;i&&(r=r.trim()),t&&(r=r.toLowerCase());const n=["true","on","yes","1"];return s&&n.push("indeterminate"),n.includes(r)}return m.isNumber(e)?1===e:!!m.isBoolean(e)&&e},exports.toBooleanLoose=e=>!m.isNil(e)&&(m.isString(e)?!s.isEmptyString(e):m.isBoolean(e)?e:m.isNumber(e,{includeNaN:!0})?0!==e:m.isArray(e)?e.length>0:Boolean(e)),exports.toNumberArrayUnRecursive=function(e,t={}){m.assertIsPlainObject(t,{message:({currentType:e,validType:r})=>`Second parameter (\`options\`) must be of type \`${r}\`, but received: \`${e}\`.`});const i=!m.hasOwnProp(t,"removeInvalidValueNumber")||t.removeInvalidValueNumber;if(m.assertIsBoolean(i,{message:({currentType:e,validType:r})=>`Parameter \`removeInvalidValueNumber\` property of the \`options\` (second parameter) must be of type \`${r}\`, but received: \`${e}\`.`}),m.isArray(e)){const t=Array.from(e,e=>{if(a.isBigInt(e))return Number(e);const r=String(e).trim().match(/-?\d+(\.\d+)?/);return r?Number(r[0]):m.isNull(e)?null:void 0});return i?r.filterNilArray(t):t}},exports.toNumberDeep=function(r,i={}){return m.assertIsPlainObject(i,{message:({currentType:e,validType:r})=>`Second parameter (\`options\`) must be of type \`${r}\`, but received: \`${e}\`.`}),function r(i,s){if(m.isNil(i)||t.isRegExp(i))return;const{removeEmptyArrays:n,removeEmptyObjects:a,isRoot:y}=s;if(!m.isBoolean(a)||!m.isBoolean(n))throw new TypeError(`Parameters \`removeEmptyObjects\` and \`removeEmptyArrays\` property of the \`options\` (second parameter) must be of type \`boolean\`, but received: ['removeEmptyObjects': \`${m.getPreciseType(a)}\`, 'removeEmptyArrays': \`${m.getPreciseType(n)}\`].`);if(m.isNumber(i)||m.isBoolean(i)||m.isNonEmptyString(i)){const e=Number(i);return m.isInfinityNumber(e)||m.isNaN(e)?void 0:e}if(m.isNumberObject(i)||m.isStringObject(i)||m.isBooleanObject(i)){const e=Number(i.valueOf());return m.isInfinityNumber(e)||m.isNaN(e)?void 0:e}if(o.isDate(i,{skipInvalidDate:!0}))try{return m.isNaN(i.getTime())?0:i.getTime()}catch{return 0}if(m.isBuffer(i)){const e=Array.from(i).map(e=>r(e,{removeEmptyObjects:a,removeEmptyArrays:n,isRoot:!1})).filter(e=>!m.isUndefined(e));if(n&&t.isEmptyArray(e))return;return e}if(e.isTypedArray(i)){if(i instanceof BigInt64Array||i instanceof BigUint64Array){const e=Array.from(i).map(e=>r(e,{removeEmptyObjects:a,removeEmptyArrays:n,isRoot:!1})).filter(e=>!m.isUndefined(e));if(n&&t.isEmptyArray(e))return;return e}{const e=Array.from(i).map(e=>r(e,{removeEmptyObjects:a,removeEmptyArrays:n,isRoot:!1})).filter(e=>!m.isUndefined(e));if(n&&t.isEmptyArray(e))return;return e}}if(m.isSet(i)){const e=Array.from(i).map(e=>r(e,{removeEmptyObjects:a,removeEmptyArrays:n,isRoot:!1})).filter(e=>!m.isUndefined(e));if(n&&t.isEmptyArray(e))return;return e}if(o.isMap(i)){let e=Array.from(i.entries()).map(([e,t])=>{const i=r(e,{removeEmptyObjects:a,removeEmptyArrays:n,isRoot:!1}),s=r(t,{removeEmptyObjects:a,removeEmptyArrays:n,isRoot:!1});return m.isUndefined(i)||m.isUndefined(s)?void 0:[i,s]}).filter(e=>!m.isUndefined(e));if(n&&(e=e.filter(e=>!t.isEmptyArray(e))),n&&t.isEmptyArray(e))return;return e}if(m.isArray(i)){const e=i.map(e=>r(e,{removeEmptyObjects:a,removeEmptyArrays:n,isRoot:!1})).filter(e=>!m.isUndefined(e));if(n&&t.isEmptyArray(e))return;return e}if(m.isObject(i)){const e={};for(const[t,s]of Object.entries(i)){const i=r(s,{removeEmptyObjects:a,removeEmptyArrays:n,isRoot:!1});m.isUndefined(i)||(e[t]=i)}return a&&t.isEmptyObject(e)?y?{}:void 0:e}}(r,{removeEmptyObjects:!!m.hasOwnProp(i,"removeEmptyObjects")&&i.removeEmptyObjects,removeEmptyArrays:!!m.hasOwnProp(i,"removeEmptyArrays")&&i.removeEmptyArrays,isRoot:!0})},exports.toStringDeep=function(r,i={}){return m.assertIsPlainObject(i,{message:({currentType:e,validType:r})=>`Second parameter (\`options\`) must be of type \`${r}\`, but received: \`${e}\`.`}),function r(i,s){if(m.isNil(i)||m.isInfinityNumber(i))return;const{removeEmptyArrays:n,removeEmptyObjects:a,isRoot:y}=s;if(!m.isBoolean(a)||!m.isBoolean(n))throw new TypeError(`Parameters \`removeEmptyObjects\` and \`removeEmptyArrays\` property of the \`options\` (second parameter) must be of type \`boolean\`, but received: ['removeEmptyObjects': \`${m.getPreciseType(a)}\`, 'removeEmptyArrays': \`${m.getPreciseType(n)}\`].`);if(m.isNumber(i)||m.isString(i)||m.isBoolean(i))return String(i);if(m.isNumberObject(i)){const e=i.valueOf();return m.isInfinityNumber(e)||m.isNaN(e)?void 0:e.toString()}if(m.isStringObject(i))return i.valueOf();if(m.isBooleanObject(i))return i.valueOf().toString();if(o.isDate(i,{skipInvalidDate:!0}))try{return i.toISOString()}catch{return i.toString()}if(t.isRegExp(i))return i.toString();if(m.isBuffer(i))return Array.from(i).map(e=>String(e)).filter(e=>!m.isUndefined(e));if(e.isTypedArray(i)){if(i instanceof BigInt64Array||i instanceof BigUint64Array){const e=Array.from(i).map(e=>r(e,{removeEmptyObjects:a,removeEmptyArrays:n,isRoot:!1})).map(e=>String(e)).filter(e=>!m.isUndefined(e));if(n&&t.isEmptyArray(e))return;return e}{const e=Array.from(i).map(e=>r(e,{removeEmptyObjects:a,removeEmptyArrays:n,isRoot:!1})).map(e=>String(e)).filter(e=>!m.isUndefined(e));if(n&&t.isEmptyArray(e))return;return e}}if(m.isSet(i)){const e=Array.from(i).map(e=>r(e,{removeEmptyObjects:a,removeEmptyArrays:n,isRoot:!1})).filter(e=>!m.isUndefined(e));if(n&&t.isEmptyArray(e))return;return e}if(o.isMap(i)){const e=Array.from(i.entries()).map(([e,t])=>[r(e,{removeEmptyObjects:a,removeEmptyArrays:n,isRoot:!1}),r(t,{removeEmptyObjects:a,removeEmptyArrays:n,isRoot:!1})]).filter(([e,r])=>!m.isUndefined(e)&&!m.isUndefined(r));if(n&&t.isEmptyArray(e))return;return e}if(m.isArray(i)){let e=i.map(e=>r(e,{removeEmptyObjects:a,removeEmptyArrays:n,isRoot:!1})).filter(e=>!m.isUndefined(e));if(n&&(e=e.filter(e=>!(m.isArray(e)&&0===e.length))),n&&t.isEmptyArray(e))return;return e}if(m.isObject(i)){const e={};for(const[t,s]of Object.entries(i)){const i=r(s,{removeEmptyObjects:a,removeEmptyArrays:n,isRoot:!1});m.isUndefined(i)?m.isArray(s)&&!n&&(e[t]=[]):e[t]=i}return a&&0===Object.keys(e).length?y?{}:void 0:e}}(r,{removeEmptyObjects:!!m.hasOwnProp(i,"removeEmptyObjects")&&i.removeEmptyObjects,removeEmptyArrays:!!m.hasOwnProp(i,"removeEmptyArrays")&&i.removeEmptyArrays,isRoot:!0})};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{isDate as e,isMap as r}from"./chunk-
|
|
1
|
+
import{isDate as e,isMap as r}from"./chunk-L73TOPX5.js";import{isObjectOrArray as t,isError as n,isSet as f,isArray as i,isObject as o,assertIsPlainObject as u,hasOwnProp as s,assertIsBoolean as c,isUndefined as a}from"./chunk-2UIRWYE3.js";var g=e=>e instanceof RegExp;function y(e){return e instanceof ArrayBuffer}function l(o,u,s,c=new WeakMap){if(o===u)return!0;if(o!=o&&u!=u)return!0;if(!t(o)||!t(u))return!1;if(c.get(o)===u)return!0;c.set(o,u);const h=(e,r,t,n,f)=>{if(s){const i=s(e,r,t,n,f,c);if(!a(i))return i}return l(e,r,s,c)};if(e(o)&&e(u))return o.getTime()===u.getTime();if(g(o)&&g(u))return o.source===u.source&&o.flags===u.flags;if(n(o)&&n(u))return o.name===u.name&&o.message===u.message;if(ArrayBuffer.isView(o)&&ArrayBuffer.isView(u)){const e=new Uint8Array(o.buffer,o.byteOffset,o.byteLength),r=new Uint8Array(u.buffer,u.byteOffset,u.byteLength);if(e.length!==r.length)return!1;for(let t=0;t<e.length;t++)if(e[t]!==r[t])return!1;return!0}if(y(o)&&y(u)){if(o.byteLength!==u.byteLength)return!1;const e=new Uint8Array(o),r=new Uint8Array(u);for(let t=0;t<e.length;t++)if(e[t]!==r[t])return!1;return!0}if(r(o)&&r(u)){if(o.size!==u.size)return!1;for(const[e,r]of o){if(!u.has(e))return!1;if(!l(r,u.get(e),s,c))return!1}return!0}if(f(o)&&f(u)){if(o.size!==u.size)return!1;for(const e of o){let r=!1;for(const t of u)if(l(e,t,s,c)){r=!0;break}if(!r)return!1}return!0}if(i(o)&&i(u)){if(o.length!==u.length)return!1;for(let e=0;e<o.length;e++)if(!h(o[e],u[e],e,o,u))return!1;return!0}if(Object.getPrototypeOf(o)!==Object.getPrototypeOf(u))return!1;const b=Reflect.ownKeys(o),m=Reflect.ownKeys(u);if(b.length!==m.length)return!1;for(const e of b){if(!h(o[e],u[e],e,o,u))return!1}return!0}function h(e,r){return l(e,r,void 0,new WeakMap)}var b=e=>!i(e)||0===e.length;function m(e,r={}){if(!o(e))return!0;u(r,{message:({currentType:e,validType:r})=>`Second parameter (\`options\`) must be of type \`${r}\`, but received: \`${e}\`.`});const t=!!s(r,"checkSymbols")&&r.checkSymbols;c(t,{message:({currentType:e,validType:r})=>`Parameter \`checkSymbols\` property of the \`options\` (second parameter) must be of type \`${r}\`, but received: \`${e}\`.`});const n=0===Object.keys(e).length;return t?n&&0===Object.getOwnPropertySymbols(e).length:n}export{l as baseDeepEqual,y as isArrayBuffer,b as isEmptyArray,m as isEmptyObject,h as isEqual,g as isRegExp};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e=require("./chunk-KHO2SBNA.cjs"),r=require("./chunk-
|
|
1
|
+
"use strict";var e=require("./chunk-KHO2SBNA.cjs"),r=require("./chunk-7YVINA3U.cjs"),t=require("./chunk-4VCRMMAH.cjs"),s=require("./chunk-7BXIZM57.cjs"),i=require("./chunk-EBMHQW7X.cjs"),n=require("./chunk-Y4O5KZF6.cjs"),a=require("./chunk-DQFU3KLE.cjs"),o=require("./chunk-INUFZJLX.cjs");function u(e){const r=typeof e;return"string"===r||"number"===r||"symbol"===r}var c=(e,r)=>{if(!o.isObjectOrArray(e))return!1;if(!u(r))throw new TypeError(`Second Parameter (\`key\`) must be of type \`string\`, \`number\` or \`symbol\`, but received: \`${o.getPreciseType(r)}\`.`);return!!Object.prototype.hasOwnProperty.call(e,r)||(o.isArray(e)?e.some(e=>c(e,r)):Object.values(e).some(e=>o.isObjectOrArray(e)&&c(e,r)))},p=e=>"[object Arguments]"===Object.prototype.toString.call(e);function y(e){return"number"==typeof e&&e>-1&&Number.isInteger(e)&&e<=Number.MAX_SAFE_INTEGER}var f=(e,r)=>{if("number"==typeof e&&"number"==typeof r&&Number.isNaN(e)&&Number.isNaN(r))return!0;if(e===r)return!0;if(typeof e!=typeof r)return!1;if(a.isDate(e)&&a.isDate(r))return e.getTime()===r.getTime();if(t.isRegExp(e)&&t.isRegExp(r))return e.toString()===r.toString();if(o.isSymbol(e)&&o.isSymbol(r))return e.toString()===r.toString();if(o.isSet(e)&&o.isSet(r)){if(e.size!==r.size)return!1;const t=Array.from(r),s=new Set;for(const r of e){let e=!1;for(let i=0;i<t.length;i++)if(!s.has(i)&&f(r,t[i])){s.add(i),e=!0;break}if(!e)return!1}return!0}if(a.isMap(e)&&a.isMap(r)){if(e.size!==r.size)return!1;const t=Array.from(r),s=new Set;for(const[r,i]of e){let e=!1;for(let n=0;n<t.length;n++){if(s.has(n))continue;const[a,o]=t[n];if(f(r,a)&&f(i,o)){s.add(n),e=!0;break}}if(!e)return!1}return!0}if(o.isArray(e)&&o.isArray(r))return e.length===r.length&&e.every((e,t)=>f(e,r[t]));if(o.isObjectOrArray(e)&&o.isObjectOrArray(r)&&e&&r){if(o.isArray(e)!==o.isArray(r))return!1;const t=Object.keys(e),s=Object.keys(r);return t.length===s.length&&t.every(t=>f(e[t],r[t]))}return!1};var l=e=>{if(o.isString(e))return i.isEmptyString(e);if(o.isNumber(e))return o.isNaN(e);if(o.isArray(e))return t.isEmptyArray(e)||e.every(l);if(o.isObjectOrArray(e)){const r=Object.keys(e),t=Object.getOwnPropertySymbols(e);return 0===r.length&&0===t.length||[...r,...t].every(r=>l(e[r]))}return!e};function m(e,r,t){return g(e,r,t)}function b(e,r){return e===r||0===e&&0===r||Number.isNaN(e)&&Number.isNaN(r)}function g(e,r,t){if(e===r)return!0;if(!o.isObjectOrArray(r))return b(e,r);if(!o.isObjectOrArray(e))return!1;const s=Reflect.ownKeys(r).filter(e=>!(o.isArray(r)&&"length"===e));for(const i of s){if(!(i in e))return!1;const s=e[i],n=r[i],a=null==t?void 0:t(s,n,i,e,r);if(o.isUndefined(a)){if(o.isObjectOrArray(s)&&o.isObjectOrArray(n)){if(!m(s,n,t))return!1}else if(!b(s,n))return!1}else if(!a)return!1}return!0}var h=Function.prototype.toString,d=/\{\s*\[native code\]\s*\}/;exports.areArraysEqual=(e,r,s=!1)=>{if(!o.isArray(e)||!o.isArray(r))throw new TypeError(`Parameters \`array1\` and \`array2\` property of the \`options\` (second parameter) must be of type \`array\`, but received: ['array1': \`${o.getPreciseType(e)}\`, 'array2': \`${o.getPreciseType(r)}\`].`);if(o.assertIsBoolean(s,{message:({currentType:e,validType:r})=>`Third parameter \`ignoreOrder\` must be of type \`${r}\`, but received: \`${e}\`.`}),!t.isEqual(e.length,r.length))return!1;const i=e=>{if(!o.isArray(e))return e;return e.map(e=>o.isArray(e)?i(e):e).sort((e,r)=>{const t=a.safeStableStringify(e),s=a.safeStableStringify(r);return t<s?-1:t>s?1:0})},n=s?i(e):e,u=s?i(r):r;return!!t.isEqual(n.length,u.length)&&n.every((e,r)=>a.safeStableStringify(e)===a.safeStableStringify(u[r]))},exports.areObjectsEqual=(e,r)=>t.isEqual(e,r),exports.areURLsEqualPath=(r,t)=>{if(!e.isURL(r)||!e.isURL(t))throw new TypeError("Parameters `urlA` and `urlB` (first and second parameter) must be instance of URL.");return r.protocol+"//"+r.host+r.pathname==t.protocol+"//"+t.host+t.pathname},exports.areURLsIdentical=(r,t)=>{if(!e.isURL(r)||!e.isURL(t))throw new TypeError("Parameters `urlA` and `urlB` (first and second parameter) must be instance of URL.");return r.protocol+"//"+r.host+r.pathname+r.search==t.protocol+"//"+t.host+t.pathname+t.search},exports.arrayHasAnyMatch=(e,r)=>{if(!o.isArray(e)||!o.isArray(r)||t.isEmptyArray(e)||t.isEmptyArray(r))return!1;const s=new Set(e);return r.some(e=>s.has(e))},exports.doesKeyExist=c,exports.isArguments=p,exports.isArrayLike=function(e){return!o.isFunction(e)&&o.isObjectOrArray(e)&&y(null==e?void 0:e.length)},exports.isArrayLikeObject=function(e){return o.isObjectOrArray(e)&&y(e.length)},exports.isCurrencyLike=e=>{if(!o.isString(e)&&!o.isNumber(e))return!1;return 0!==s.parseCurrencyString(e.toString())||"0"===e.toString().trim()},exports.isDeepEqual=f,exports.isElement=function(e){return!!e&&"object"==typeof e&&1===(null==e?void 0:e.nodeType)&&!o.isPlainObject(e)},exports.isEmpty=function(e){return!!o.isNil(e)||(!!(o.isBoolean(e)||o.isNumber(e,{includeNaN:!0})||o.isSymbol(e))||(o.isFunction(e)?0===Object.keys(e).length:o.isString(e)||o.isArray(e)||p(e)||r.isTypedArray(e)?0===e.length:a.isMap(e)||o.isSet(e)?0===e.size:o.isBuffer(e)?0===e.length:!!o.isPlainObject(e)&&0===Object.keys(e).length))},exports.isEmptyDeep=l,exports.isEqualWith=function(e,r,s){return t.baseDeepEqual(e,r,s,new WeakMap)},exports.isLength=y,exports.isMatch=function(e,r){return g(e,r)},exports.isMatchWith=m,exports.isNative=function(e){if(!o.isFunction(e))return!1;try{const r=h.call(e);return d.test(r)}catch{return!1}},exports.isObjectLoose=function(e){return!o.isNil(e)&&(o.isObjectOrArray(e)||o.isFunction(e))},exports.isPropertyKey=u,exports.isSafeInteger=function(e){return"number"==typeof e&&Number.isSafeInteger(e)},exports.isValidURL=e=>{if(!o.isNonEmptyString(e))return!1;let r;try{r=decodeURIComponent(e)}catch{return!1}if(!r.startsWith("http://")&&!r.startsWith("https://"))return!1;return new RegExp(/^https?:\/\/(?:localhost(?::\d+)?(?:[\/?#][^\s]*)?|(?:www\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}(?::\d+)?(?:[\/?#][^\s]*)?)$/).test(r)},exports.isWeakMap=function(e){return o.isObject(e)&&!o.isNull(e)&&e instanceof WeakMap},exports.textContainsAll=(e,r,t={})=>{if(!o.isNonEmptyString(e)||!o.isArray(r))return!1;o.assertIsPlainObject(t,{message:({currentType:e,validType:r})=>`Third parameter (\`options\`) must be of type \`${r}\`, but received: \`${e}\`.`});const{exactMatch:s=!1,flags:i="i"}=t;o.assertIsBoolean(s,{message:({currentType:e,validType:r})=>`Parameter \`exactMatch\` property of the \`options\` (third parameter) must be of type \`${r}\`, but received: \`${e}\`.`}),n.assertIsString(i,{message:({currentType:e,validType:r})=>`Parameter \`flags\` property of the \`options\` (third parameter) must be of type \`${r}\`, but received: \`${e}\`.`});const a=r.filter(e=>o.isNonEmptyString(e)).map(e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"));return 0!==a.length&&a.every(r=>new RegExp(s?`(?<!\\S)${r}(?!\\S)`:r,i.includes("u")?i:i+"u").test(e))},exports.textContainsAny=(e,r,t={})=>{if(!o.isNonEmptyString(e)||!o.isArray(r))return!1;o.assertIsPlainObject(t,{message:({currentType:e,validType:r})=>`Third parameter (\`options\`) must be of type \`${r}\`, but received: \`${e}\`.`});const{exactMatch:s=!1,flags:i="i"}=t;o.assertIsBoolean(s,{message:({currentType:e,validType:r})=>`Parameter \`exactMatch\` property of the \`options\` (third parameter) must be of type \`${r}\`, but received: \`${e}\`.`}),n.assertIsString(i,{message:({currentType:e,validType:r})=>`Parameter \`flags\` property of the \`options\` (third parameter) must be of type \`${r}\`, but received: \`${e}\`.`});const a=r.filter(e=>o.isNonEmptyString(e)).map(e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"));if(0===a.length)return!1;const u=s?`(?<!\\S)(${a.join("|")})(?!\\S)`:`(${a.join("|")})`;return new RegExp(u,i.includes("u")?i:i+"u").test(e)};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{isInteger as e}from"./chunk-WVSPXFTY.js";import{safeStableStringify as r}from"./chunk-
|
|
1
|
+
import{isInteger as e}from"./chunk-WVSPXFTY.js";import{safeStableStringify as r}from"./chunk-L73TOPX5.js";import{isNonEmptyArray as t,getPreciseType as n,isNumber as a,isPlainObject as m,assertIsBoolean as i,isNaN as h}from"./chunk-2UIRWYE3.js";function o(e){if(!t(e))return;return e[Math.floor(Math.random()*(e.length||0))]}var u=(t,a)=>{if(!e(t)||!e(a))throw new TypeError(`First parameter (\`min\`) and second parameter (\`max\`) must be of type \`integer-number\`${c(t,a)}value, but received: ['min': \`${n(t)}\` - (with value: \`${r(t)})\`, 'max': \`${n(a)}\` - (with value: \`${r(a)}\`)].`);if(t>a)throw new RangeError(`First parameter (\`min\`) must be less than or equal to second parameter (\`max\`), but received: ['min': ${s(t)}, 'max': ${s(a)}].`);return t=Math.max(1,t),a=Math.min(Number.MAX_SAFE_INTEGER,a),Math.floor(Math.random()*(a-t+1))+t},s=e=>a(e,{includeNaN:!0})?e===Number.MIN_VALUE?"`Number.MIN_VALUE`":`${e}`:`\`${n(e)}\``,c=(...e)=>e.some(e=>a(e,{includeNaN:!0})&&e===Number.MIN_VALUE)?" and can't be `Number.MIN_VALUE` ":" ",g=t=>{m(t)||(t={});const{minLength:a=1,maxLength:h=16,avoidZero:o=!1}=t;if(i(o,{message:({currentType:e,validType:r})=>`Parameters \`avoidZero\` must be of type \`${r}\`, but received: \`${e}\`.`}),!e(a)||!e(h))throw new TypeError(`Parameters \`minLength\` and \`maxLength\` must be of type \`integer-number\`, but received: ['minLength': \`${n(a)}\` - (with value: ${r(a)}), 'maxLength': \`${n(h)}\` - (with value: ${r(h)})].`);if(a<1||h>16||a>h)throw new RangeError(`Invalid range at parameters \`minLength\` must be ≥ 1, \`maxLength\` must be ≤ 16, and \`minLength\` ≤ \`maxLength\`, but received: ['minLength': \`${a}\`, 'maxLength': \`${h}\`].`);const s=a===h?a:u(a,h),c=10**(s-1);let g=u(c,10**s-1);return o&&0===g&&(g=c),g},p=t=>{m(t)||(t={});const{minLength:a=40,maxLength:o=40,type:s="string",avoidWhiteSpace:c=!0}=t;if(i(c,{message:({currentType:e,validType:r})=>`Parameters \`avoidWhiteSpace\` property of the \`options\` (first-parameter) must be of type \`${r}\`, but received: \`${e}\`.`}),!e(a)||!e(o))throw new TypeError(`Parameters \`minLength\` and \`maxLength\` must be of type \`integer-number\`, but received: ['minLength': \`${n(a)}\` - (with value: ${r(a)}), 'maxLength': \`${n(o)}\` - (with value: ${r(o)})].`);if(a<1||o>5e3||a>o)throw new RangeError(`Invalid range at parameters \`minLength\` must be ≥ 1, \`maxLength\` must be ≤ 5000, and \`minLength\` ≤ \`maxLength\`, but received: ['minLength': \`${a}\`, 'maxLength': \`${o}\`].`);if("string"!==s&&"number"!==s)throw new TypeError(`Parameter \`type\` must be of type \`string\` with value one of "string" | "number", but received: \`${n(s)}\`, with value: ${r(s)}.`);const g=u(a,o),p="number"===s?(h(Number(t.replaceGenInt))?void 0:t.replaceGenInt)??"0123456789":(t.replaceGenStr?t.replaceGenStr:void 0)??"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",d=(l=p,(c?l.replace(/\s|\n|\t/g,""):l)+(t.addChar||""));var l;if(!d.length){throw new Error(`Character set is empty. ${(()=>"number"===s?c?"If `avoidWhiteSpace` is true, and `replaceGenInt` cant be empty-string value, ensure `replaceGenInt` has valid characters and non-nan string number.":"Ensure `replaceGenInt` has valid characters and not a NaN number string while convert to number.":"Ensure `replaceGenStr` has valid characters and non empty string.")()}`)}let b="";for(let e=0;e<g;e++)b+=d.charAt(Math.floor(Math.random()*d.length));return b};export{o as getRandomItem,u as randomInt,g as randomIntByLength,p as randomStr};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{isBigInt as e}from"./chunk-QNKGP5DY.js";import{assertIsPlainObject as r,isPlainObject as t,isBoolean as n,isNaN as o,hasOwnProp as s,getPreciseType as i,isUndefined as a,isNumberObject as u,isInfinityNumber as f,isStringObject as p,isBooleanObject as c,isFunction as l,isSymbol as y,isObjectOrArray as d,isSet as m,isArray as b,isNull as v,isNumber as S,isObject as g}from"./chunk-2UIRWYE3.js";function k(e){return"[object Map]"===Object.prototype.toString.call(e)||e instanceof Map}var h=(e,s={})=>{r(s,{message:({currentType:e,validType:r})=>`Second parameter (\`options\`) must be of type \`${r}\`, but received: \`${e}\`.`});const i=!(!t(s)||!n(s.skipInvalidDate))&&s.skipInvalidDate,a=e instanceof Date;return i?a:a&&!o(e.getTime())},$=(t,$={})=>{r($,{message:({currentType:e,validType:r})=>`Second parameter (\`options\`) must be of type \`${r}\`, but received: \`${e}\`.`});const O=!!s($,"pretty")&&$.pretty,A=!s($,"sortKeys")||$.sortKeys,T=!!s($,"sortArray")&&$.sortArray,j=!!s($,"keepUndefined")&&$.keepUndefined;if(!(n(A)&&n(T)&&n(O)&&n(j)))throw new TypeError(`Parameters \`sortKeys\`, \`sortArray\`, \`keepUndefined\` and \`pretty\` property of the \`options\` (second parameter) must be of type \`boolean\`, but received: "['sortKeys': \`${i(A)}\`, 'sortArray': \`${i(T)}\`, 'keepUndefined': \`${i(j)}\`, 'pretty': \`${i(O)}\`]".`);if(a(t))return j?"undefined":"null";const K=new WeakSet,U=e=>v(e)||!d(e)&&!l(e),w=r=>{if(u(r)){const e=r.valueOf();return o(e)||f(e)?null:e}if(p(r))return r.valueOf();if(c(r))return r.valueOf();if(!l(r)&&!y(r)){if(e(r))return r.toString();if(o(r)||f(r))return null;if(a(r))return j?void 0:null;if(d(r)){if(K.has(r))return"[Circular]";if(K.add(r),h(r))return r.toISOString();if(k(r))return{map:Array.from(r.entries()).map(([e,r])=>[e,w(r)])};if(m(r))return{set:Array.from(r.values()).map(w)};if(b(r)){const e=r.map(w);if(T){const r=[],t=[];for(const n of e)U(n)?r.push(n):t.push(n);return r.sort((e,r)=>S(e)&&S(r)?e-r:String(e).localeCompare(String(r))),[...r,...t]}return e}const e=Object.keys(r);A&&e.sort((e,r)=>{const t=Number(e),n=Number(r);return o(t)||o(n)?e.localeCompare(r):t-n});const t={};if(g(r))for(const n of e){const e=w(r[n]);a(e)||(t[n]=e)}return t}return r}};try{return JSON.stringify(w(t),null,O?2:0)}catch(e){return console.warn("Error in safeStableStringify:",e),"{}"}};export{h as isDate,k as isMap,$ as safeStableStringify};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e=require("./chunk-DVMHRLKP.cjs"),r=require("./chunk-
|
|
1
|
+
"use strict";var e=require("./chunk-DVMHRLKP.cjs"),r=require("./chunk-DQFU3KLE.cjs"),n=require("./chunk-INUFZJLX.cjs");exports.delay=(t=1e3,i)=>{if(!e.isInteger(t)||t<=0)throw new TypeError(`First parameter (\`milliSeconds\`) must be of type \`number\` and value must be a \`non-zero\`, \`non-NaN\`, \`non-negative\`, and \`integer-number\`, but received: \`${n.getPreciseType(t)}\`, with value: \`${r.safeStableStringify(t)}\`.`);if(n.isNull(i)||i&&!(i instanceof AbortSignal))throw new TypeError("Second parameter (`signal`) must be an `instance of AbortSignal` if provided.");return new Promise((e,r)=>{const n=setTimeout(()=>{o(),e()},t),o=()=>{clearTimeout(n),i&&i.removeEventListener("abort",a)},a=()=>{o(),r(new DOMException("Function `delay` aborted","AbortError"))};i&&(i.aborted?a():i.addEventListener("abort",a,{once:!0}))})};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var r=require("./chunk-KHO2SBNA.cjs"),e=require("./chunk-
|
|
1
|
+
"use strict";var r=require("./chunk-KHO2SBNA.cjs"),e=require("./chunk-7PG6YKIY.cjs"),t=require("./chunk-EXWCTDC3.cjs"),n=require("./chunk-YT3MSZKK.cjs"),i=require("./chunk-XC2PYCT4.cjs"),s=require("./chunk-EBMHQW7X.cjs"),a=require("./chunk-DQFU3KLE.cjs"),o=require("./chunk-INUFZJLX.cjs");exports.constructURL=(c,u,l)=>{if(o.isString(c)){if(s.isEmptyString(c))throw new TypeError("First parameter (`baseUrl`) cannot be an empty-string.");c=i.normalizeString(c)}else if(!r.isURL(c))throw new TypeError(`First parameter (\`baseUrl\`) must be of type an URL instance or a \`string\` and a non empty-string, but received: \`${o.getPreciseType(c)}\`, with current value: \`${a.safeStableStringify(c)}\`.`);if(!o.isUndefined(l)&&(n.assertIsArray(l,{message:({currentType:r,validType:e})=>`Third parameter (\`removeParams\`) must be of type \`${e} of strings\`, but received: \`${r}\`.`}),!l.every(r=>o.isNonEmptyString(r))))throw new TypeError("Third parameter (`removeParams`) must be of type `array` and contains `string` only and non empty-string.");try{if(!o.isUndefined(u)&&!o.isFunction(u[Symbol.iterator]))throw new TypeError(`Second parameter (\`queryParams\`) must be iterable (like URLSearchParams.entries() or an array of [[string, string | number]...]), but received: \`${o.getPreciseType(u)}\`, with value: \`${a.safeStableStringify(u)}\`.`);const r=new URL(c);if(!o.isUndefined(u)){const n=Object.fromEntries(u);if(!t.isEmptyValue(n)){const t=new URLSearchParams(r.search);for(const[r,e]of Object.entries(n)){if(!o.isNonEmptyString(e)&&!o.isNumber(e,{includeNaN:!0}))throw new TypeError(`Second parameter (\`queryParams\`) must be iterable (like URLSearchParams.entries() or an array of [[string, string | number]...]), but received: \`${o.getPreciseType(u)}\`, with value: \`${a.safeStableStringify(u)}\`.`);t.set(r,String(e))}(null==l?void 0:l.length)&&e.toStringArrayUnRecursive(l).map(r=>{t.delete(r)}),r.search=t.toString()}}return null==l||l.forEach(e=>r.searchParams.delete(e)),r}catch(r){if(o.isError(r))throw r;throw new Error("Failed to construct a valid URL in `constructURL()`, Error:"+r)}},exports.extractURLs=r=>{if(!o.isNonEmptyString(r))return null;let e;try{e=decodeURIComponent(r)}catch{return null}const t=e.match(/https?:\/\/.*?(?=https?:\/\/|\s|$)/g);if(!t)return null;const n=t.map(r=>r.replace(/[.,;:!?)]*$/,"")).filter(r=>{try{const e=new URL(r);return"http:"===e.protocol||"https:"===e.protocol}catch{return!1}});return n.length?n:null};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{isEmptyValue as t}from"./chunk-
|
|
1
|
+
import{isEmptyValue as t}from"./chunk-X4PD3I5U.js";var r=(r,o={})=>!t(r,o),o=new Set(["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]","[object BigInt64Array]","[object BigUint64Array]"]);function e(t){return null!=t&&"object"==typeof t&&o.has(Object.prototype.toString.call(t))}export{r as isNonEmptyValue,e as isTypedArray};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{safeJsonParse as e}from"./chunk-
|
|
1
|
+
import{safeJsonParse as e}from"./chunk-G2B35D5W.js";import{isEqual as r,isEmptyArray as t}from"./chunk-GRSCNTOK.js";import{assertIsArray as n}from"./chunk-ZXIWDFEQ.js";import{safeStableStringify as s}from"./chunk-L73TOPX5.js";import{isPlainObject as i,isNonEmptyArray as o,isObjectOrArray as c,isArray as a,isNaN as u,isUndefined as m}from"./chunk-2UIRWYE3.js";var f=e=>{n(e,{message:({currentType:e,validType:r})=>`First parameter (\`values\`) must be of type \`${r}\` (array literal or instance), but received: \`${e}\`.`});const t=[];return e.forEach((n,s)=>{for(let i=s+1;i<e.length;i++)if(r(n,e[i])){t.some(e=>r(e,n))||t.push(n);break}}),t},p=(e,r)=>{if(!i(e))return{};n(r,{message:({currentType:e,validType:r})=>`Second parameter (\`keysToOmit\`) must be of type \`${r}\` (array literal or instance), but received: \`${e}\`.`});const t=f(r);if(t.length>0)throw new Error(`Function "omitKeys" Error: Duplicate keys detected - \`${t}\``);return Object.fromEntries(Object.entries(e).filter(([e])=>!r.includes(e)))},l=(r,p)=>{if(!i(r))return{};n(p,{message:({currentType:e,validType:r})=>`Second parameter (\`keysToOmit\`) must be of type \`${r}\` (array literal or instance), but received: \`${e}\`.`});const l=f(p);if(o(l))throw new Error(`Function "omitKeysDeep" Error: Duplicate keys detected - \`${s(l)}\`.`);const y=(e,r)=>{if(!c(e))return e;const[n,...s]=r;if(t(s))if(a(e)){const r=parseInt(n);!u(r)&&r in e&&e.splice(r,1)}else delete e[n];else{const r=e[n];c(r)&&(e[n]=y(r,s))}return e},d=e=>{if(a(e))return e.map(d).filter(e=>!(c(e)&&0===Object.keys(e).length));if(c(e)){return Object.fromEntries(Object.entries(e).map(([e,r])=>[e,d(r)]).filter(([,e])=>!(m(e)||c(e)&&0===Object.keys(e).length)))}return e},b=e(s(r));for(const e of p){const r=e.split(".");y(b,r)}return d(b)};export{f as findDuplicates,p as omitKeys,l as omitKeysDeep};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{parseCurrencyString as e}from"./chunk-VEYMQ3UA.js";import{isFinite as t}from"./chunk-DUK2K4FB.js";import{normalizeSpaces as r}from"./chunk-Q6NHYWVX.js";import{isEmptyString as n}from"./chunk-TSLYDPBJ.js";import{assertIsString as o}from"./chunk-W2W3L2M5.js";import{isInteger as a}from"./chunk-WVSPXFTY.js";import{safeStableStringify as i}from"./chunk-AJ65QFV2.js";import{isString as s,getPreciseType as u,assertIsPlainObject as p,hasOwnProp as l,isBoolean as c,isPlainObject as m,isNaN as d,isUndefined as f,isFunction as y,assertIsBoolean as h,isNil as b,isNumber as g,isNonEmptyString as $}from"./chunk-2UIRWYE3.js";import{id as v,enUS as w}from"date-fns/locale";import{isDate as T,parse as D,format as k}from"date-fns";var S=(r,n={})=>{if(!s(r)&&!t(r))throw new TypeError(`First parameter (\`value\`) must be of type \`string\` or \`primitive-number\`, but received: \`${u(r)}\`, with value: \`${i(r)}\`.`);p(n,{message:({currentType:e,validType:t})=>`Second parameter (\`options\`) must be of type \`${t}\`, but received: \`${e}\`.`});const b=!!l(n,"decimal")&&n.decimal,g=l(n,"totalDecimal")?n.totalDecimal:2,$=!l(n,"endDecimal")||n.endDecimal,v=!!l(n,"indianFormat")&&n.indianFormat,w=l(n,"suffixCurrency")?n.suffixCurrency:"",T=l(n,"suffixDecimal")?n.suffixDecimal:"",D=l(n,"roundedDecimal")?n.roundedDecimal:"round",k=l(n,"negativeFormat")?n.negativeFormat:"dash";let S=l(n,"separatorDecimals")?n.separatorDecimals:",",F=l(n,"separator")?n.separator:".";if(!(s(F)&&s(S)&&s(w)&&s(T)))throw new TypeError(`Parameter \`separator\`, \`separatorDecimals\`, \`suffixCurrency\` and \`suffixDecimal\` property of the \`options\` (second parameter) must be of type \`string\`, but received: ['separator': \`${u(F)}\`, 'separatorDecimals': \`${u(S)}\`, 'suffixCurrency': \`${u(w)}\`, 'suffixDecimal': \`${u(T)}\`].`);if(!c(b)||!c($)||!c(v))throw new TypeError(`Parameter \`decimal\`, \`endDecimal\` and \`indianFormat\` property of the \`options\` (second parameter) must be of type \`boolean\`, but received: ['decimal': \`${u(b)}\`, 'endDecimal': \`${u($)}\`, 'indianFormat': \`${u(v)}\`].`);if(!a(g))throw new TypeError(`Parameter \`totalDecimal\` property of the \`options\` (second parameter) must be of type \`integer-number\`, but received: \`${u(g)}\`, with value: \`${i(length)}\`.`);if(!1!==D&&"round"!==D&&"ceil"!==D&&"floor"!==D)throw new TypeError(`Parameter \`roundedDecimal\` property of the \`options\` (second parameter) must be of type \`false\` or \`string\` must be one of "round" | "ceil" | "floor", but received: \`${u(D)}\`, with value: \`${i(D)}\`.`);if("abs"!==k&&"brackets"!==k&&"dash"!==k&&!m(k))throw new TypeError(`Parameter \`negativeFormat\` property of the \`options\` (second parameter) must be of type \`string\` must be one of "abs" | "brackets" | "dash" or \`plain-object\` type, but received: \`${u(k)}\`, with value: \`${i(k)}\`.`);const E=s(r)?e(r):r;if(d(E))throw new TypeError("First parameter (`value`) could not be parsed into a valid `number`.");let C="",N="",P=Math.abs(E);const x=Math.pow(10,g);if(D){const e=P*x;switch(D){case"round":P=Math.round(e)/x;break;case"ceil":P=Math.ceil(e)/x;break;case"floor":P=Math.floor(e)/x}}if(D)[C,N]=P.toFixed(g).split("."),N=N??"".padEnd(g,"0");else{const e=String(P).split(".");C=e[0],N=(e[1]||"").slice(0,g).padEnd(g,"0")}let j;if(v?(F=",",S=".",j=(w.trim().length?w:"")+M(C,F)):j=(w.trim().length?w:"")+C.replace(/\B(?=(\d{3})+(?!\d))/g,F),b&&!f(N)&&g>0){let e=S+N;$&&(e+=T),j+=e}if(E<0)if("dash"===k)j="-"+j;else if("brackets"===k)j="("+j+")";else if("abs"===k);else if(m(k))if(l(k,"custom")){const e=k.custom;if(!y(e))throw new TypeError(`Parameter \`negativeFormat.custom\` property of the \`options\` (second parameter) must be of type function: \`(formatted: string) => string\`, but received: \`${u(e)}\`.`);const t=e(j);o(t,{message:({currentType:e,validType:t})=>`Parameter \`negativeFormat.custom\` property of the \`options\` (second parameter) expected return a \`${t}\` type value, but received: \`${e}\`.`}),j=t}else{const e=k.style||"dash",t=!f(k.space)&&k.space;if(h(t,{message:({currentType:e,validType:t})=>`Parameter \`negativeFormat.space\` property of the \`options\` (second parameter) must be of type \`${t} or undefined\`, but received: \`${e}\`.`}),"abs"!==e&&"brackets"!==e&&"dash"!==e)throw new TypeError(`Parameter \`negativeFormat.style\` property of the \`options\` (second parameter) must be of type \`string\` must be of type "abs" | "brackets" | "dash", but received: \`${u(e)}\`, with value: \`${i(e)}\`.`);switch(e){case"dash":j="-"+(t?" ":"")+j;break;case"brackets":j=t?`( ${j} )`:`(${j})`}}return j},M=(e,t)=>{const r=e.slice(-3),n=e.slice(0,-3);return n?n.replace(/\B(?=(\d{2})+(?!\d))/g,t)+t+r:r},F=(e,r=",")=>{if(!s(e)&&!t(e))throw new TypeError(`First parameter (\`value\`) must be of type \`string\` or \`primitive number\`, but received: \`${u(e)}\`.`);if(!s(r))throw new TypeError(`Second parameter (\`separator\`) must be of type \`string\` or empty as \`undefined\`, but received: \`${u(r)}\`.`);const n="."===(r=s(r)?r:",")?",":".",o=e.toString().trim(),a=o.lastIndexOf("."),i=o.lastIndexOf(",");let p="";a>i?p=".":i>a&&(p=",");let l=o,c="";if(p){const e=o.split(p);l=e.slice(0,-1).join(p),c=e.slice(-1)[0]}l=l.replace(/[^\d]/g,"");const m=l.replace(/\B(?=(\d{3})+(?!\d))/g,r);return c?`${m}${n}${c}`:m};function E(e,t={}){if(b(e))return"";if(!s(e)&&!g(e))throw new TypeError(`First parameter (\`value\`) must be of type \`string\`, \`number\`, \`null\` or \`undefined\`, but received: \`${u(e)}\`.`);p(t,{message:({currentType:e,validType:t})=>`Second parameter (\`options\`) must be of type \`${t}\`, but received: \`${e}\`.`});const r=l(t,"separator")?t.separator:" ",n=!!l(t,"takeNumberOnly")&&t.takeNumberOnly,o=!!l(t,"checkValidOnly")&&t.checkValidOnly,a=l(t,"plusNumberCountry")?t.plusNumberCountry:"",i=l(t,"openingNumberCountry")?t.openingNumberCountry:"",m=l(t,"closingNumberCountry")?t.closingNumberCountry:"";if(!c(n)||!c(o))throw new TypeError(`Parameter \`takeNumberOnly\` and \`checkValidOnly\` property of the \`options\` (second parameter) must be of type \`boolean\` or unset as \`undefined\` value, but received: ['takeNumberOnly': \`${u(n)}\`, 'checkValidOnly': \`${u(o)}\`].`);if(!(s(r)&&s(a)&&s(i)&&s(m)))throw new TypeError(`Parameter \`separator\`, \`plusNumberCountry\`, \`openingNumberCountry\` and \`closingNumberCountry\` property of the \`options\` (second parameter) must be of type \`string\` or unset as \`undefined\` value, but received: ['separator': \`${u(r)}\`, 'plusNumberCountry': \`${u(a)}\`, 'openingNumberCountry': \`${u(i)}\`, 'closingNumberCountry': \`${u(m)}\`].`);if(s(e)||(e=String(e)),n)return e.replace(/\D/g,"");if(o)return/^(\+)?[0-9\s().-]+$/.test(e)&&e.replace(/\D/g,"").length<24;e=e.replace(/\D/g,"");let d=a.trim().replace(/\s+/g,"").replace(/[^\d+]/g,"");/^\+/.test(d)&&(d="+"+d.replace(/^\++/,""));let f="",y="";({7:"Russia, Kazakhstan",27:"South Africa",31:"Netherlands",32:"Belgium",33:"France",34:"Spain",36:"Hungary",39:"Italy, San Marino, Vatican",44:"United Kingdom",46:"Sweden",47:"Norway",48:"Poland",49:"Germany",52:"Mexico",54:"Argentina",55:"Brazil",56:"Chile",61:"Australia",62:"Indonesia",64:"New Zealand",81:"Japan",82:"South Korea",86:"China",90:"Turkey",91:"India",92:"Pakistan",351:"Portugal",352:"Luxembourg",971:"UAE"})[d.replace(/^\+/,"").replace(/[^\d]/g,"")]&&e.startsWith("0")?(f=e.slice(1,4),y=e.slice(4)):(f=e.slice(0,4),y=e.slice(4));const h=d.trim(),$=i.trim(),v=m.trim();let w="";w=h?$&&v?`${$}${h}${v} ${f}`:$&&!v?`${$}${h} ${f}`:!$&&v?`${h}${v} ${f}`:`${h} ${f}`:`${f}`;const T={0:r,4:r,8:r,12:r,16:r,20:r,24:r};for(let e=0;e<y.length;e++){w+=(T[e+f.length]||"")+y[e]}return w}var C=(e,t)=>{if(b(t)&&(t="YYYY-MM-DD hh:mm:ss"),!s(t))return null;if(b(e)||!T(e)&&!$(e))return null;try{const r=new Date(e);if(d(r.getTime()))return null;const n=e=>e.toString().padStart(2,"0"),o={YYYY:r.getFullYear().toString(),MM:n(r.getMonth()+1),DD:n(r.getDate()),hh:n(r.getHours()),mm:n(r.getMinutes()),ss:n(r.getSeconds())},a=Object.entries(o).reduce((e,[t,r])=>e.split(t).join(r),t);return a.includes("NaN")?null:a}catch{return null}},N=(e,t)=>{if(b(e)||!T(e)&&!$(e))return null;const r=new Date(e);if(d(r.getTime()))return null;m(t)||(t={});const{locale:n="en-US",...o}=t;try{return new Intl.DateTimeFormat($(n)?n.trim():"en-US",o).format(r)}catch{return null}},P=(e,t={})=>{if(b(e)||!T(e)&&!$(e))return null;m(t)||(t={});const{inputFormat:r,locale:n="en",inputLocale:o="en",...a}=t,i=l(t,"format")&&$(t.format)?t.format:"dd MMM yyyy - HH:mm:ss";let s;try{if($(e)&&r&&o){const t=$(o)?"id"===o?v:w:o;s=D(e,r,new Date,{locale:t})}else s=new Date(e);if(d(s.getTime()))return null;const t=$(n)?"id"===n?v:w:n;return k(s,i,{...a,locale:t})}catch{return null}},x=e=>{try{if(b(e)||s(e)&&n(e))e=new Date;else if(!T(e)&&!$(e))return"0";const t=new Date(e);if(d(t.getTime()))return"0";const r=e=>e.toString().padStart(2,"0");let o=t.getTimezoneOffset();const a=o<0?"+":"-";return o=Math.abs(o),`${a}${r(Math.floor(o/60))}${r(o%60)}`}catch{return"0"}},j=(e,t={})=>{if(!$(e))return"";p(t,{message:({currentType:e,validType:t})=>`Second parameter (\`options\`) must be of type \`${t}\`, but received: \`${e}\`.`});const r=l(t,"mode")?t.mode:"fixed";if("random"!==r&&"fixed"!==r)throw new TypeError(`Parameter \`mode\` property of the \`options\` (second parameter) must be one of "fixed" or "random", but received: \`${u(r)}\`, with value: \`${i(r)}\`.`);if(!/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/.test(e))return"";const[n,o]=e.split("@"),a=o.split(".");if(a.length<2)return"";const[s,...c]=a,m=c.join("."),d=Y(r,e),f=n.length<4?1:2,y=s.length<4?1:2;return`${A(n,f,.6,d)}@${A(s,y,.5,d)}.${m.length<=2?m:A(m,1,.4,d)}`},Y=(e,t)=>"fixed"===e?(()=>{let e=0;for(let r=0;r<t.length;r++)e=(e<<5)-e+t.charCodeAt(r),e|=0;return Math.abs(e)})():void 0,A=(e,t,r,n)=>{if(e.length<=t)return"*".repeat(e.length);const o=e.split(""),a=Math.max(t,Math.ceil(e.length*r)),i=new Set;let s=0;for(;i.size<a;){const t=f(n)?Math.floor(Math.random()*e.length):(n+e.length+31*s)%e.length;i.add(t),s++}for(const e of i)o[e]="*";return o.join("")};function O(e,t,n={}){if(b(e)||t<=0)return e;if(o(e,{message:({currentType:e,validType:t})=>`First parameter (\`subject\`) must be of type \`${t}\`, but received: \`${e}\`.`}),!a(t))throw new TypeError(`Second parameter (\`limiter\`) must be of type \`integer-number\`, but received: \`${u(t)}\`, with value: \`${i(t)}\`.`);p(n,{message:({currentType:e,validType:t})=>`Third parameter (\`options\`) must be of type \`${t}\`, but received: \`${e}\`.`});const s=l(n,"separator")?n.separator:" ",c=!!l(n,"reCountAfterSpace")&&n.reCountAfterSpace;if(o(s,{message:({currentType:e,validType:t})=>`Parameter \`separator\` property of the \`options\` (third parameter) must be of type \`${t}\`, but received: \`${e}\`.`}),h(c,{message:({currentType:e,validType:t})=>`Parameter \`reCountAfterSpace\` property of the \`options\` (third parameter) must be of type \`${t}\`, but received: \`${e}\`.`}),e=r(e),!c){let r="",n=0;for(let o=0;o<e.length;o++){n===t&&(r+=s,n=0),r+=e[o],n++}return r}const m=e.split(" "),d=[];let f=[],y=0;for(let e=0;e<m.length;e++){const r=m[e];let n="",o=0;for(let e=0;e<r.length;e++)n+=r[e],o++,o===t&&e<r.length-1&&(n+=s,o=0);f.push(n),y++,y!==t&&e!==m.length-1||(d.push(f.join(s)),f=[],y=0)}return d.join(" ")}var V=(e,t={})=>{if(!$(e))return"";p(t,{message:({currentType:e,validType:t})=>`Seconds parameter (\`options\`) must be of type \`${t}\`, but received: \`${e}\`.`});const r=!l(t,"trim")||t.trim,s=l(t,"length")?t.length:10;let c=l(t,"ending")?t.ending:"...";if(!a(s))throw new TypeError(`Parameter \`length\` property of the \`options\` (second parameter) must be of type \`integer-number\`, but received: \`${u(s)}\`, with value: \`${i(s)}\`.`);if(s<1)return"";o(c,{message:({currentType:e,validType:t})=>`Parameter \`ending\` property of the \`options\` (second parameter) must be of type \`${t}\`, but received: \`${e}\`.`}),h(r,{message:({currentType:e,validType:t})=>`Parameter \`trim\` property of the \`options\` (second parameter) must be of type \`${t}\`, but received: \`${e}\`.`}),c=n(c)?"...":c.trim();const m=r?e.trim():e;if(m.length<=s)return m;const d=m.slice(0,s);return(r?d:d.trimEnd())+c};export{j as censorEmail,O as chunkString,S as formatCurrency,P as formatDateFns,N as formatDateIntl,C as formatDateTime,F as formatNumber,E as formatPhoneNumber,x as getGMTOffset,V as truncateString};
|
|
1
|
+
import{parseCurrencyString as e}from"./chunk-VEYMQ3UA.js";import{isFinite as t}from"./chunk-DUK2K4FB.js";import{normalizeSpaces as r}from"./chunk-Q6NHYWVX.js";import{isEmptyString as n}from"./chunk-TSLYDPBJ.js";import{assertIsString as o}from"./chunk-W2W3L2M5.js";import{isInteger as a}from"./chunk-WVSPXFTY.js";import{safeStableStringify as i}from"./chunk-L73TOPX5.js";import{isString as s,getPreciseType as u,assertIsPlainObject as p,hasOwnProp as l,isBoolean as c,isPlainObject as m,isNaN as d,isUndefined as f,isFunction as y,assertIsBoolean as h,isNil as b,isNumber as g,isNonEmptyString as $}from"./chunk-2UIRWYE3.js";import{id as v,enUS as w}from"date-fns/locale";import{isDate as T,parse as D,format as k}from"date-fns";var S=(r,n={})=>{if(!s(r)&&!t(r))throw new TypeError(`First parameter (\`value\`) must be of type \`string\` or \`primitive-number\`, but received: \`${u(r)}\`, with value: \`${i(r)}\`.`);p(n,{message:({currentType:e,validType:t})=>`Second parameter (\`options\`) must be of type \`${t}\`, but received: \`${e}\`.`});const b=!!l(n,"decimal")&&n.decimal,g=l(n,"totalDecimal")?n.totalDecimal:2,$=!l(n,"endDecimal")||n.endDecimal,v=!!l(n,"indianFormat")&&n.indianFormat,w=l(n,"suffixCurrency")?n.suffixCurrency:"",T=l(n,"suffixDecimal")?n.suffixDecimal:"",D=l(n,"roundedDecimal")?n.roundedDecimal:"round",k=l(n,"negativeFormat")?n.negativeFormat:"dash";let S=l(n,"separatorDecimals")?n.separatorDecimals:",",E=l(n,"separator")?n.separator:".";if(!(s(E)&&s(S)&&s(w)&&s(T)))throw new TypeError(`Parameter \`separator\`, \`separatorDecimals\`, \`suffixCurrency\` and \`suffixDecimal\` property of the \`options\` (second parameter) must be of type \`string\`, but received: ['separator': \`${u(E)}\`, 'separatorDecimals': \`${u(S)}\`, 'suffixCurrency': \`${u(w)}\`, 'suffixDecimal': \`${u(T)}\`].`);if(!c(b)||!c($)||!c(v))throw new TypeError(`Parameter \`decimal\`, \`endDecimal\` and \`indianFormat\` property of the \`options\` (second parameter) must be of type \`boolean\`, but received: ['decimal': \`${u(b)}\`, 'endDecimal': \`${u($)}\`, 'indianFormat': \`${u(v)}\`].`);if(!a(g))throw new TypeError(`Parameter \`totalDecimal\` property of the \`options\` (second parameter) must be of type \`integer-number\`, but received: \`${u(g)}\`, with value: \`${i(length)}\`.`);if(!1!==D&&"round"!==D&&"ceil"!==D&&"floor"!==D)throw new TypeError(`Parameter \`roundedDecimal\` property of the \`options\` (second parameter) must be of type \`false\` or \`string\` must be one of "round" | "ceil" | "floor", but received: \`${u(D)}\`, with value: \`${i(D)}\`.`);if("abs"!==k&&"brackets"!==k&&"dash"!==k&&!m(k))throw new TypeError(`Parameter \`negativeFormat\` property of the \`options\` (second parameter) must be of type \`string\` must be one of "abs" | "brackets" | "dash" or \`plain-object\` type, but received: \`${u(k)}\`, with value: \`${i(k)}\`.`);const F=s(r)?e(r):r;if(d(F))throw new TypeError("First parameter (`value`) could not be parsed into a valid `number`.");let P="",C="",N=Math.abs(F);const x=Math.pow(10,g);if(D){const e=N*x;switch(D){case"round":N=Math.round(e)/x;break;case"ceil":N=Math.ceil(e)/x;break;case"floor":N=Math.floor(e)/x}}if(D)[P,C]=N.toFixed(g).split("."),C=C??"".padEnd(g,"0");else{const e=String(N).split(".");P=e[0],C=(e[1]||"").slice(0,g).padEnd(g,"0")}let j;if(v?(E=",",S=".",j=(w.trim().length?w:"")+M(P,E)):j=(w.trim().length?w:"")+P.replace(/\B(?=(\d{3})+(?!\d))/g,E),b&&!f(C)&&g>0){let e=S+C;$&&(e+=T),j+=e}if(F<0)if("dash"===k)j="-"+j;else if("brackets"===k)j="("+j+")";else if("abs"===k);else if(m(k))if(l(k,"custom")){const e=k.custom;if(!y(e))throw new TypeError(`Parameter \`negativeFormat.custom\` property of the \`options\` (second parameter) must be of type function: \`(formatted: string) => string\`, but received: \`${u(e)}\`.`);const t=e(j);o(t,{message:({currentType:e,validType:t})=>`Parameter \`negativeFormat.custom\` property of the \`options\` (second parameter) expected return a \`${t}\` type value, but received: \`${e}\`.`}),j=t}else{const e=k.style||"dash",t=!f(k.space)&&k.space;if(h(t,{message:({currentType:e,validType:t})=>`Parameter \`negativeFormat.space\` property of the \`options\` (second parameter) must be of type \`${t} or undefined\`, but received: \`${e}\`.`}),"abs"!==e&&"brackets"!==e&&"dash"!==e)throw new TypeError(`Parameter \`negativeFormat.style\` property of the \`options\` (second parameter) must be of type \`string\` must be of type "abs" | "brackets" | "dash", but received: \`${u(e)}\`, with value: \`${i(e)}\`.`);switch(e){case"dash":j="-"+(t?" ":"")+j;break;case"brackets":j=t?`( ${j} )`:`(${j})`}}return j},M=(e,t)=>{const r=e.slice(-3),n=e.slice(0,-3);return n?n.replace(/\B(?=(\d{2})+(?!\d))/g,t)+t+r:r},E=(e,r=",")=>{if(!s(e)&&!t(e))throw new TypeError(`First parameter (\`value\`) must be of type \`string\` or \`primitive number\`, but received: \`${u(e)}\`.`);if(!s(r))throw new TypeError(`Second parameter (\`separator\`) must be of type \`string\` or empty as \`undefined\`, but received: \`${u(r)}\`.`);const n="."===(r=s(r)?r:",")?",":".",o=e.toString().trim(),a=o.lastIndexOf("."),i=o.lastIndexOf(",");let p="";a>i?p=".":i>a&&(p=",");let l=o,c="";if(p){const e=o.split(p);l=e.slice(0,-1).join(p),c=e.slice(-1)[0]}l=l.replace(/[^\d]/g,"");const m=l.replace(/\B(?=(\d{3})+(?!\d))/g,r);return c?`${m}${n}${c}`:m};function F(e,t={}){if(b(e))return"";if(!s(e)&&!g(e))throw new TypeError(`First parameter (\`value\`) must be of type \`string\`, \`number\`, \`null\` or \`undefined\`, but received: \`${u(e)}\`.`);p(t,{message:({currentType:e,validType:t})=>`Second parameter (\`options\`) must be of type \`${t}\`, but received: \`${e}\`.`});const r=l(t,"separator")?t.separator:" ",n=!!l(t,"takeNumberOnly")&&t.takeNumberOnly,o=!!l(t,"checkValidOnly")&&t.checkValidOnly,a=l(t,"plusNumberCountry")?t.plusNumberCountry:"",i=l(t,"openingNumberCountry")?t.openingNumberCountry:"",m=l(t,"closingNumberCountry")?t.closingNumberCountry:"";if(!c(n)||!c(o))throw new TypeError(`Parameter \`takeNumberOnly\` and \`checkValidOnly\` property of the \`options\` (second parameter) must be of type \`boolean\` or unset as \`undefined\` value, but received: ['takeNumberOnly': \`${u(n)}\`, 'checkValidOnly': \`${u(o)}\`].`);if(!(s(r)&&s(a)&&s(i)&&s(m)))throw new TypeError(`Parameter \`separator\`, \`plusNumberCountry\`, \`openingNumberCountry\` and \`closingNumberCountry\` property of the \`options\` (second parameter) must be of type \`string\` or unset as \`undefined\` value, but received: ['separator': \`${u(r)}\`, 'plusNumberCountry': \`${u(a)}\`, 'openingNumberCountry': \`${u(i)}\`, 'closingNumberCountry': \`${u(m)}\`].`);if(s(e)||(e=String(e)),n)return e.replace(/\D/g,"");if(o)return/^(\+)?[0-9\s().-]+$/.test(e)&&e.replace(/\D/g,"").length<24;e=e.replace(/\D/g,"");let d=a.trim().replace(/\s+/g,"").replace(/[^\d+]/g,"");/^\+/.test(d)&&(d="+"+d.replace(/^\++/,""));let f="",y="";({7:"Russia, Kazakhstan",27:"South Africa",31:"Netherlands",32:"Belgium",33:"France",34:"Spain",36:"Hungary",39:"Italy, San Marino, Vatican",44:"United Kingdom",46:"Sweden",47:"Norway",48:"Poland",49:"Germany",52:"Mexico",54:"Argentina",55:"Brazil",56:"Chile",61:"Australia",62:"Indonesia",64:"New Zealand",81:"Japan",82:"South Korea",86:"China",90:"Turkey",91:"India",92:"Pakistan",351:"Portugal",352:"Luxembourg",971:"UAE"})[d.replace(/^\+/,"").replace(/[^\d]/g,"")]&&e.startsWith("0")?(f=e.slice(1,4),y=e.slice(4)):(f=e.slice(0,4),y=e.slice(4));const h=d.trim(),$=i.trim(),v=m.trim();let w="";w=h?$&&v?`${$}${h}${v} ${f}`:$&&!v?`${$}${h} ${f}`:!$&&v?`${h}${v} ${f}`:`${h} ${f}`:`${f}`;const T={0:r,4:r,8:r,12:r,16:r,20:r,24:r};for(let e=0;e<y.length;e++){w+=(T[e+f.length]||"")+y[e]}return w}var P=(e,t)=>{if(b(t)&&(t="YYYY-MM-DD hh:mm:ss"),!s(t))return null;if(b(e)||!T(e)&&!$(e))return null;try{const r=new Date(e);if(d(r.getTime()))return null;const n=e=>e.toString().padStart(2,"0"),o={YYYY:r.getFullYear().toString(),MM:n(r.getMonth()+1),DD:n(r.getDate()),hh:n(r.getHours()),mm:n(r.getMinutes()),ss:n(r.getSeconds())},a=Object.entries(o).reduce((e,[t,r])=>e.split(t).join(r),t);return a.includes("NaN")?null:a}catch{return null}},C=(e,t)=>{if(b(e)||!T(e)&&!$(e))return null;const r=new Date(e);if(d(r.getTime()))return null;m(t)||(t={});const{locale:n="en-US",...o}=t;try{return new Intl.DateTimeFormat($(n)?n.trim():"en-US",o).format(r)}catch{return null}},N=(e,t={})=>{if(b(e)||!T(e)&&!$(e))return null;m(t)||(t={});const{inputFormat:r,locale:n="en",inputLocale:o="en",...a}=t,i=l(t,"format")&&$(t.format)?t.format:"dd MMM yyyy - HH:mm:ss";let s;try{if($(e)&&r&&o){const t=$(o)?"id"===o?v:w:o;s=D(e,r,new Date,{locale:t})}else s=new Date(e);if(d(s.getTime()))return null;const t=$(n)?"id"===n?v:w:n;return k(s,i,{...a,locale:t})}catch{return null}},x=e=>{try{if(b(e)||s(e)&&n(e))e=new Date;else if(!T(e)&&!$(e))return"0";const t=new Date(e);if(d(t.getTime()))return"0";const r=e=>e.toString().padStart(2,"0");let o=t.getTimezoneOffset();const a=o<0?"+":"-";return o=Math.abs(o),`${a}${r(Math.floor(o/60))}${r(o%60)}`}catch{return"0"}},j=(e,t={})=>{if(!$(e))return"";p(t,{message:({currentType:e,validType:t})=>`Second parameter (\`options\`) must be of type \`${t}\`, but received: \`${e}\`.`});const r=l(t,"mode")?t.mode:"fixed";if("random"!==r&&"fixed"!==r)throw new TypeError(`Parameter \`mode\` property of the \`options\` (second parameter) must be one of "fixed" or "random", but received: \`${u(r)}\`, with value: \`${i(r)}\`.`);if(!/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/.test(e))return"";const[n,o]=e.split("@"),a=o.split(".");if(a.length<2)return"";const[s,...c]=a,m=c.join("."),d=Y(r,e),f=n.length<4?1:2,y=s.length<4?1:2;return`${O(n,f,.6,d)}@${O(s,y,.5,d)}.${m.length<=2?m:O(m,1,.4,d)}`},Y=(e,t)=>"fixed"===e?(()=>{let e=0;for(let r=0;r<t.length;r++)e=(e<<5)-e+t.charCodeAt(r),e|=0;return Math.abs(e)})():void 0,O=(e,t,r,n)=>{if(e.length<=t)return"*".repeat(e.length);const o=e.split(""),a=Math.max(t,Math.ceil(e.length*r)),i=new Set;let s=0;for(;i.size<a;){const t=f(n)?Math.floor(Math.random()*e.length):(n+e.length+31*s)%e.length;i.add(t),s++}for(const e of i)o[e]="*";return o.join("")};function A(e,t,n={}){if(b(e)||t<=0)return e;if(o(e,{message:({currentType:e,validType:t})=>`First parameter (\`subject\`) must be of type \`${t}\`, but received: \`${e}\`.`}),!a(t))throw new TypeError(`Second parameter (\`limiter\`) must be of type \`integer-number\`, but received: \`${u(t)}\`, with value: \`${i(t)}\`.`);p(n,{message:({currentType:e,validType:t})=>`Third parameter (\`options\`) must be of type \`${t}\`, but received: \`${e}\`.`});const s=l(n,"separator")?n.separator:" ",c=!!l(n,"reCountAfterSpace")&&n.reCountAfterSpace;if(o(s,{message:({currentType:e,validType:t})=>`Parameter \`separator\` property of the \`options\` (third parameter) must be of type \`${t}\`, but received: \`${e}\`.`}),h(c,{message:({currentType:e,validType:t})=>`Parameter \`reCountAfterSpace\` property of the \`options\` (third parameter) must be of type \`${t}\`, but received: \`${e}\`.`}),e=r(e),!c){let r="",n=0;for(let o=0;o<e.length;o++){n===t&&(r+=s,n=0),r+=e[o],n++}return r}const m=e.split(" "),d=[];let f=[],y=0;for(let e=0;e<m.length;e++){const r=m[e];let n="",o=0;for(let e=0;e<r.length;e++)n+=r[e],o++,o===t&&e<r.length-1&&(n+=s,o=0);f.push(n),y++,y!==t&&e!==m.length-1||(d.push(f.join(s)),f=[],y=0)}return d.join(" ")}var V=(e,t={})=>{if(!$(e))return"";p(t,{message:({currentType:e,validType:t})=>`Seconds parameter (\`options\`) must be of type \`${t}\`, but received: \`${e}\`.`});const r=!l(t,"trim")||t.trim,s=l(t,"length")?t.length:10;let c=l(t,"ending")?t.ending:"...";if(!a(s))throw new TypeError(`Parameter \`length\` property of the \`options\` (second parameter) must be of type \`integer-number\`, but received: \`${u(s)}\`, with value: \`${i(s)}\`.`);if(s<1)return"";o(c,{message:({currentType:e,validType:t})=>`Parameter \`ending\` property of the \`options\` (second parameter) must be of type \`${t}\`, but received: \`${e}\`.`}),h(r,{message:({currentType:e,validType:t})=>`Parameter \`trim\` property of the \`options\` (second parameter) must be of type \`${t}\`, but received: \`${e}\`.`}),c=n(c)?"...":c.trim();const m=r?e.trim():e;if(m.length<=s)return m;const d=m.slice(0,s);return(r?d:d.trimEnd())+c};export{j as censorEmail,A as chunkString,S as formatCurrency,N as formatDateFns,C as formatDateIntl,P as formatDateTime,E as formatNumber,F as formatPhoneNumber,x as getGMTOffset,V as truncateString};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{removeSpaces as e}from"./chunk-Q6NHYWVX.js";import{isEmptyString as r}from"./chunk-TSLYDPBJ.js";import{isInteger as t}from"./chunk-WVSPXFTY.js";import{safeStableStringify as n}from"./chunk-
|
|
1
|
+
import{removeSpaces as e}from"./chunk-Q6NHYWVX.js";import{isEmptyString as r}from"./chunk-TSLYDPBJ.js";import{isInteger as t}from"./chunk-WVSPXFTY.js";import{safeStableStringify as n}from"./chunk-L73TOPX5.js";import{isString as o,isArray as a,getPreciseType as i,isNull as s,isPlainObject as u,isBoolean as p,isNonEmptyArray as c,isNonEmptyString as m,isNil as f,isError as l,assertIsPlainObject as h,hasOwnProp as y}from"./chunk-2UIRWYE3.js";var d=class e extends Error{constructor(r,t){super(r),this.originalError=t,this.name="NormalizePathnameError",Error.captureStackTrace&&Error.captureStackTrace(this,e)}},b=(e,r=null,f={})=>{const l=[];o(e)||a(e)||l.push(`First parameter (\`url\`) must be of type \`string\` or \`array-string\`, but received: \`${i(e)}\`.`),o(r)||a(r)||s(r)||l.push(`Second parameter (\`base\`) must be of type \`string\`, \`array-string\` or \`null\`, but received: \`${i(r)}\`.`),u(f)||l.push(`Second parameter (\`options\`) must be of type \`plain-object\`, but received: \`${i(f)}\`.`);const{levels:h=1,removeDuplicates:y=!0}=f;if((!t(h)||t(h)&&h<0)&&l.push(`Parameter \`levels\` property of the \`options\` (second parameter) must be of type \`integer-number\` and minimum is \`0\`, but received: \`${i(h)}\`, with value: \`${n(h)}\`.`),p(y)||l.push(`Parameter \`removeDuplicates\` property of the \`options\` (second parameter) must be of type \`boolean\`, but received: \`${i(y)}\`.`),c(l))throw new TypeError(`Invalid parameter(s) in \`getPrefixPathname\` function:\n- ${l.join("\n- ")}`);function d(e){return`/${$(e).split("/").filter(Boolean).slice(0,h).join("/")}`}function b(e){if(r){if(e=$(e),a(r)){for(const t of r)if(e.startsWith($(t)))return d(e)}else if(m(r)&&e.startsWith($(r)))return d(e);return null}return d(e)}if(a(e)){const r=e.map(b).filter(e=>!s(e)),t=y?[...new Set(r)]:r;return 1===t.length?t[0]:t}return b(e)},v=(e,r="/")=>{if(!m(r))throw new TypeError(`Second parameter (\`defaultValue\`) must be of type \`string\` and not an \`empty-string\`, but received: \`${i(r)}\`, with value: \`${n(r)}\`.`);if(a(e)){if(!e.every(e=>o(e)))throw new TypeError(`First parameter (\`result\`) must be of type \`string\` or \`array of string\`, but received: \`${i(e)}\`, with value: \`${n(e)}\`.`);for(const r of e){const e=$(r);if("/"!==e)return e}return $(r)}if(o(e)){const t=$(e);return"/"!==t?t:$(r)}if(!f(e))throw new TypeError(`First parameter (\`result\`) must be of type \`string\`, \`array-string\`, \`null\` or \`undefined\`, but received: \`${i(e)}\`.`);return $(r)},$=(r,t="/")=>{if(!m(t))throw new TypeError(`Second parameter (\`defaultPath\`) must be of type \`string\` and not empty-string, but received: \`${i(t)}\`, with value: \`${n(t)}\`.`);if(!m(r))return t;try{if((r=(r=e(r,{trimOnly:!0})).replace(/\s+/g,"")).startsWith("http://")||r.startsWith("https://")){const e=new URL(r);return`${e.pathname}${e.search}${e.hash}`.replace(/^\/+/,"/")}return"/"+r.replace(/^\/+/,"").replace(/\/{2,}/g,"/")}catch(e){const r=l(e)?e:new Error("Unknown error from function `normalizePathname()`.");throw new d(`Failed to normalize pathname in function \`normalizePathname()\`: ${r.message}`,r)}},w=(e,t={})=>{if(!m(e))return"";h(t,{message:({currentType:e,validType:r})=>`Second parameter (\`options\`) must be of type \`${r}\`, but received: \`${e}\`.`});const n=!!y(t,"prefixColon")&&t.prefixColon;if(!p(n))throw new TypeError(`Parameter \`prefixColon\` property of the \`options\` (second parameter) must be of type \`boolean\`, but received: \`${i(n)}\`.`);const o=e.replace(/\D+/g,"");return r(o)?"":n?`:${o}`:o};export{w as formatEnvPort,v as getFirstPrefixPathname,b as getPrefixPathname,$ as normalizePathname};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{isInteger as e}from"./chunk-WVSPXFTY.js";import{safeStableStringify as r}from"./chunk-
|
|
1
|
+
import{isInteger as e}from"./chunk-WVSPXFTY.js";import{safeStableStringify as r}from"./chunk-L73TOPX5.js";import{getPreciseType as n,isNull as o}from"./chunk-2UIRWYE3.js";var t=(t=1e3,i)=>{if(!e(t)||t<=0)throw new TypeError(`First parameter (\`milliSeconds\`) must be of type \`number\` and value must be a \`non-zero\`, \`non-NaN\`, \`non-negative\`, and \`integer-number\`, but received: \`${n(t)}\`, with value: \`${r(t)}\`.`);if(o(i)||i&&!(i instanceof AbortSignal))throw new TypeError("Second parameter (`signal`) must be an `instance of AbortSignal` if provided.");return new Promise((e,r)=>{const n=setTimeout(()=>{o(),e()},t),o=()=>{clearTimeout(n),i&&i.removeEventListener("abort",a)},a=()=>{o(),r(new DOMException("Function `delay` aborted","AbortError"))};i&&(i.aborted?a():i.addEventListener("abort",a,{once:!0}))})};export{t as delay};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{isNonEmptyValue as e,isTypedArray as r}from"./chunk-
|
|
1
|
+
import{isNonEmptyValue as e,isTypedArray as r}from"./chunk-NXWPZDDX.js";import{filterNilArray as t}from"./chunk-Y44ZD3GG.js";import{isEmptyObject as o,isRegExp as n,isEmptyArray as m}from"./chunk-GRSCNTOK.js";import{assertIsArray as i}from"./chunk-ZXIWDFEQ.js";import{isEmptyString as s}from"./chunk-TSLYDPBJ.js";import{assertIsString as a}from"./chunk-W2W3L2M5.js";import{safeStableStringify as y,isDate as p,isMap as c}from"./chunk-L73TOPX5.js";import{isBigInt as u}from"./chunk-QNKGP5DY.js";import{assertIsPlainObject as f,hasOwnProp as v,assertIsBoolean as l,isArray as d,isNull as b,isNil as E,isString as j,isNonEmptyString as A,isBoolean as O,isNumber as g,isObject as h,isPlainObject as S,getPreciseType as T,isNaN as $,isUndefined as k,isInfinityNumber as N,isNumberObject as R,isStringObject as I,isBooleanObject as w,isBuffer as P,isSet as D,isFunction as B,isObjectOrArray as C}from"./chunk-2UIRWYE3.js";function L(e,r={}){f(r,{message:({currentType:e,validType:r})=>`Second parameter (\`options\`) must be of type \`${r}\`, but received: \`${e}\`.`});const o=!v(r,"removeInvalidValueNumber")||r.removeInvalidValueNumber;if(l(o,{message:({currentType:e,validType:r})=>`Parameter \`removeInvalidValueNumber\` property of the \`options\` (second parameter) must be of type \`${r}\`, but received: \`${e}\`.`}),d(e)){const r=Array.from(e,e=>{if(u(e))return Number(e);const r=String(e).trim().match(/-?\d+(\.\d+)?/);return r?Number(r[0]):b(e)?null:void 0});return o?t(r):r}}var W=r=>!E(r)&&(j(r)?A(r):O(r)?r:g(r,{includeNaN:!0})?0!==r:d(r)||h(r)?e(r):Boolean(r)),G=e=>!E(e)&&(j(e)?A(e):O(e)?e:g(e,{includeNaN:!0})?0!==e:d(e)?e.some(G):!!h(e)&&Object.values(e).some(G)),X=(e,r={})=>{if(E(e))return!1;S(r)||(r={});const t=!!v(r,"caseInsensitive")&&r.caseInsensitive,o=!v(r,"trimString")||r.trimString,n=!!v(r,"includeIndeterminate")&&r.includeIndeterminate;if(!O(t)||!O(o)||!O(n))throw new TypeError(`Parameters \`caseInsensitive\`, \`trimString\` and \`includeIndeterminate\` property of the \`options\` (second parameter) expected to be a \`boolean\` type, but received: ['caseInsensitive': \`${T(t)}\`, 'trimString': \`${T(o)}\`, 'includeIndeterminate': \`${T(n)}\`].`);if(j(e)){let r=e;o&&(r=r.trim()),t&&(r=r.toLowerCase());const m=["true","on","yes","1"];return n&&m.push("indeterminate"),m.includes(r)}return g(e)?1===e:!!O(e)&&e},Y=e=>!E(e)&&(j(e)?!s(e):O(e)?e:g(e,{includeNaN:!0})?0!==e:d(e)?e.length>0:Boolean(e)),J=e=>{const r={undefined:void 0,null:null,nan:NaN,true:!0,false:!1,yes:!0,no:!1};if(j(e)){const t=e.trim().toLowerCase();if(Object.prototype.hasOwnProperty.call(r,t))return r[t];const o=t.replace(/,/g,""),n=Number(o);return!$(n)&&A(o)?n:e.trim()}return e},U=(e,r)=>{if(!C(e))return e;const[t,...o]=r;if(d(e))for(const t of e)C(t)&&U(t,r);else m(o)?S(e)&&delete e[t]:S(e)&&C(e[t])&&U(e[t],o);return e},V=(e,r)=>{if(!S(e))return e;const[t,...o]=r;return 0===o.length?S(e)&&delete e[t]:S(e[t])&&V(e[t],o),e};function Z(e,r,t=!0){if(o(e,{checkSymbols:!0}))return{};if(i(r,{message:({currentType:e,validType:t})=>`Second parameter (\`keysToDelete\`) must be of type \`${t}\` with value of { key: string, deep?: boolean } plain-object, but received: \`${e}\`, with value: \`${y(r)}\`.`}),!r.every(e=>S(e)&&"key"in e))throw new TypeError(`Each element in Second Parameter (\`keysToDelete\`) must be of type \`plain-object\` with at least a "key" property (optionally "deep"), but received: \`${y(r)}\`.`);let n=t?(e=>{try{if(B(structuredClone))return structuredClone(e)}catch{}return JSON.parse(JSON.stringify(e))})(e):e;for(const{key:e,deep:t}of r){if(a(e,{message:({currentType:e,validType:r})=>`Parameter \`key\` at Second Parameter (\`keysToDelete\`) must be of type \`${r}\`, but received: \`${e}\`.`}),!k(t)&&!O(t))throw new TypeError(`Parameter \`deep\` at Second Parameter (\`keysToDelete\`) ➔ (key: "${e}", deep: ${t}) must be of type \`boolean\` or \`undefined\`, but received: \`${T(t)}\`.`);const r=e.split(".");n=t?U(n,r):V(n,r)}return n}function x(e,t={}){f(t,{message:({currentType:e,validType:r})=>`Second parameter (\`options\`) must be of type \`${r}\`, but received: \`${e}\`.`});return function e(t,i){if(E(t)||n(t))return;const{removeEmptyArrays:s,removeEmptyObjects:a,isRoot:y}=i;if(!O(a)||!O(s))throw new TypeError(`Parameters \`removeEmptyObjects\` and \`removeEmptyArrays\` property of the \`options\` (second parameter) must be of type \`boolean\`, but received: ['removeEmptyObjects': \`${T(a)}\`, 'removeEmptyArrays': \`${T(s)}\`].`);if(g(t)||O(t)||A(t)){const e=Number(t);return N(e)||$(e)?void 0:e}if(R(t)||I(t)||w(t)){const e=Number(t.valueOf());return N(e)||$(e)?void 0:e}if(p(t,{skipInvalidDate:!0}))try{return $(t.getTime())?0:t.getTime()}catch{return 0}if(P(t)){const r=Array.from(t).map(r=>e(r,{removeEmptyObjects:a,removeEmptyArrays:s,isRoot:!1})).filter(e=>!k(e));if(s&&m(r))return;return r}if(r(t)){if(t instanceof BigInt64Array||t instanceof BigUint64Array){const r=Array.from(t).map(r=>e(r,{removeEmptyObjects:a,removeEmptyArrays:s,isRoot:!1})).filter(e=>!k(e));if(s&&m(r))return;return r}{const r=Array.from(t).map(r=>e(r,{removeEmptyObjects:a,removeEmptyArrays:s,isRoot:!1})).filter(e=>!k(e));if(s&&m(r))return;return r}}if(D(t)){const r=Array.from(t).map(r=>e(r,{removeEmptyObjects:a,removeEmptyArrays:s,isRoot:!1})).filter(e=>!k(e));if(s&&m(r))return;return r}if(c(t)){let r=Array.from(t.entries()).map(([r,t])=>{const o=e(r,{removeEmptyObjects:a,removeEmptyArrays:s,isRoot:!1}),n=e(t,{removeEmptyObjects:a,removeEmptyArrays:s,isRoot:!1});return k(o)||k(n)?void 0:[o,n]}).filter(e=>!k(e));if(s&&(r=r.filter(e=>!m(e))),s&&m(r))return;return r}if(d(t)){const r=t.map(r=>e(r,{removeEmptyObjects:a,removeEmptyArrays:s,isRoot:!1})).filter(e=>!k(e));if(s&&m(r))return;return r}if(h(t)){const r={};for(const[o,n]of Object.entries(t)){const t=e(n,{removeEmptyObjects:a,removeEmptyArrays:s,isRoot:!1});k(t)||(r[o]=t)}return a&&o(r)?y?{}:void 0:r}}(e,{removeEmptyObjects:!!v(t,"removeEmptyObjects")&&t.removeEmptyObjects,removeEmptyArrays:!!v(t,"removeEmptyArrays")&&t.removeEmptyArrays,isRoot:!0})}function K(e,t={}){f(t,{message:({currentType:e,validType:r})=>`Second parameter (\`options\`) must be of type \`${r}\`, but received: \`${e}\`.`});return function e(t,o){if(E(t)||N(t))return;const{removeEmptyArrays:i,removeEmptyObjects:s,isRoot:a}=o;if(!O(s)||!O(i))throw new TypeError(`Parameters \`removeEmptyObjects\` and \`removeEmptyArrays\` property of the \`options\` (second parameter) must be of type \`boolean\`, but received: ['removeEmptyObjects': \`${T(s)}\`, 'removeEmptyArrays': \`${T(i)}\`].`);if(g(t)||j(t)||O(t))return String(t);if(R(t)){const e=t.valueOf();return N(e)||$(e)?void 0:e.toString()}if(I(t))return t.valueOf();if(w(t))return t.valueOf().toString();if(p(t,{skipInvalidDate:!0}))try{return t.toISOString()}catch{return t.toString()}if(n(t))return t.toString();if(P(t))return Array.from(t).map(e=>String(e)).filter(e=>!k(e));if(r(t)){if(t instanceof BigInt64Array||t instanceof BigUint64Array){const r=Array.from(t).map(r=>e(r,{removeEmptyObjects:s,removeEmptyArrays:i,isRoot:!1})).map(e=>String(e)).filter(e=>!k(e));if(i&&m(r))return;return r}{const r=Array.from(t).map(r=>e(r,{removeEmptyObjects:s,removeEmptyArrays:i,isRoot:!1})).map(e=>String(e)).filter(e=>!k(e));if(i&&m(r))return;return r}}if(D(t)){const r=Array.from(t).map(r=>e(r,{removeEmptyObjects:s,removeEmptyArrays:i,isRoot:!1})).filter(e=>!k(e));if(i&&m(r))return;return r}if(c(t)){const r=Array.from(t.entries()).map(([r,t])=>[e(r,{removeEmptyObjects:s,removeEmptyArrays:i,isRoot:!1}),e(t,{removeEmptyObjects:s,removeEmptyArrays:i,isRoot:!1})]).filter(([e,r])=>!k(e)&&!k(r));if(i&&m(r))return;return r}if(d(t)){let r=t.map(r=>e(r,{removeEmptyObjects:s,removeEmptyArrays:i,isRoot:!1})).filter(e=>!k(e));if(i&&(r=r.filter(e=>!(d(e)&&0===e.length))),i&&m(r))return;return r}if(h(t)){const r={};for(const[o,n]of Object.entries(t)){const t=e(n,{removeEmptyObjects:s,removeEmptyArrays:i,isRoot:!1});k(t)?d(n)&&!i&&(r[o]=[]):r[o]=t}return s&&0===Object.keys(r).length?a?{}:void 0:r}}(e,{removeEmptyObjects:!!v(t,"removeEmptyObjects")&&t.removeEmptyObjects,removeEmptyArrays:!!v(t,"removeEmptyArrays")&&t.removeEmptyArrays,isRoot:!0})}export{J as convertType,Z as removeObjectPaths,W as toBooleanContent,G as toBooleanContentDeep,X as toBooleanExplicit,Y as toBooleanLoose,L as toNumberArrayUnRecursive,x as toNumberDeep,K as toStringDeep};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e=require("./chunk-XC2PYCT4.cjs"),r=require("./chunk-EBMHQW7X.cjs"),t=require("./chunk-DVMHRLKP.cjs"),i=require("./chunk-
|
|
1
|
+
"use strict";var e=require("./chunk-XC2PYCT4.cjs"),r=require("./chunk-EBMHQW7X.cjs"),t=require("./chunk-DVMHRLKP.cjs"),i=require("./chunk-DQFU3KLE.cjs"),n=require("./chunk-INUFZJLX.cjs"),s=class e extends Error{constructor(r,t){super(r),this.originalError=t,this.name="NormalizePathnameError",Error.captureStackTrace&&Error.captureStackTrace(this,e)}},a=(r,t="/")=>{if(!n.isNonEmptyString(t))throw new TypeError(`Second parameter (\`defaultPath\`) must be of type \`string\` and not empty-string, but received: \`${n.getPreciseType(t)}\`, with value: \`${i.safeStableStringify(t)}\`.`);if(!n.isNonEmptyString(r))return t;try{if((r=(r=e.removeSpaces(r,{trimOnly:!0})).replace(/\s+/g,"")).startsWith("http://")||r.startsWith("https://")){const e=new URL(r);return`${e.pathname}${e.search}${e.hash}`.replace(/^\/+/,"/")}return"/"+r.replace(/^\/+/,"").replace(/\/{2,}/g,"/")}catch(e){const r=n.isError(e)?e:new Error("Unknown error from function `normalizePathname()`.");throw new s(`Failed to normalize pathname in function \`normalizePathname()\`: ${r.message}`,r)}};exports.formatEnvPort=(e,t={})=>{if(!n.isNonEmptyString(e))return"";n.assertIsPlainObject(t,{message:({currentType:e,validType:r})=>`Second parameter (\`options\`) must be of type \`${r}\`, but received: \`${e}\`.`});const i=!!n.hasOwnProp(t,"prefixColon")&&t.prefixColon;if(!n.isBoolean(i))throw new TypeError(`Parameter \`prefixColon\` property of the \`options\` (second parameter) must be of type \`boolean\`, but received: \`${n.getPreciseType(i)}\`.`);const s=e.replace(/\D+/g,"");return r.isEmptyString(s)?"":i?`:${s}`:s},exports.getFirstPrefixPathname=(e,r="/")=>{if(!n.isNonEmptyString(r))throw new TypeError(`Second parameter (\`defaultValue\`) must be of type \`string\` and not an \`empty-string\`, but received: \`${n.getPreciseType(r)}\`, with value: \`${i.safeStableStringify(r)}\`.`);if(n.isArray(e)){if(!e.every(e=>n.isString(e)))throw new TypeError(`First parameter (\`result\`) must be of type \`string\` or \`array of string\`, but received: \`${n.getPreciseType(e)}\`, with value: \`${i.safeStableStringify(e)}\`.`);for(const r of e){const e=a(r);if("/"!==e)return e}return a(r)}if(n.isString(e)){const t=a(e);return"/"!==t?t:a(r)}if(!n.isNil(e))throw new TypeError(`First parameter (\`result\`) must be of type \`string\`, \`array-string\`, \`null\` or \`undefined\`, but received: \`${n.getPreciseType(e)}\`.`);return a(r)},exports.getPrefixPathname=(e,r=null,s={})=>{const o=[];n.isString(e)||n.isArray(e)||o.push(`First parameter (\`url\`) must be of type \`string\` or \`array-string\`, but received: \`${n.getPreciseType(e)}\`.`),n.isString(r)||n.isArray(r)||n.isNull(r)||o.push(`Second parameter (\`base\`) must be of type \`string\`, \`array-string\` or \`null\`, but received: \`${n.getPreciseType(r)}\`.`),n.isPlainObject(s)||o.push(`Second parameter (\`options\`) must be of type \`plain-object\`, but received: \`${n.getPreciseType(s)}\`.`);const{levels:p=1,removeDuplicates:u=!0}=s;if((!t.isInteger(p)||t.isInteger(p)&&p<0)&&o.push(`Parameter \`levels\` property of the \`options\` (second parameter) must be of type \`integer-number\` and minimum is \`0\`, but received: \`${n.getPreciseType(p)}\`, with value: \`${i.safeStableStringify(p)}\`.`),n.isBoolean(u)||o.push(`Parameter \`removeDuplicates\` property of the \`options\` (second parameter) must be of type \`boolean\`, but received: \`${n.getPreciseType(u)}\`.`),n.isNonEmptyArray(o))throw new TypeError(`Invalid parameter(s) in \`getPrefixPathname\` function:\n- ${o.join("\n- ")}`);function c(e){return`/${a(e).split("/").filter(Boolean).slice(0,p).join("/")}`}function l(e){if(r){if(e=a(e),n.isArray(r)){for(const t of r)if(e.startsWith(a(t)))return c(e)}else if(n.isNonEmptyString(r)&&e.startsWith(a(r)))return c(e);return null}return c(e)}if(n.isArray(e)){const r=e.map(l).filter(e=>!n.isNull(e)),t=u?[...new Set(r)]:r;return 1===t.length?t[0]:t}return l(e)},exports.normalizePathname=a;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{isEmptyArray as e,isEmptyObject as r}from"./chunk-
|
|
1
|
+
import{isEmptyArray as e,isEmptyObject as r}from"./chunk-GRSCNTOK.js";import{isEmptyString as o}from"./chunk-TSLYDPBJ.js";import{assertIsPlainObject as t,hasOwnProp as c,assertIsBoolean as m,isNil as s,isNaN as p,isString as a,isArray as n,isObject as y}from"./chunk-2UIRWYE3.js";var u=(u,i={})=>{t(i,{message:({currentType:e,validType:r})=>`Second parameter (\`options\`) must be of type \`${r}\`, but received: \`${e}\`.`});const b=!!c(i,"checkSymbols")&&i.checkSymbols;return m(b,{message:({currentType:e,validType:r})=>`Parameter \`checkSymbols\` property of the \`options\` (second parameter) must be of type \`${r}\`, but received: \`${e}\`.`}),!(!s(u)&&!1!==u&&!p(u))||(a(u)?o(u):n(u)?e(u):!!y(u)&&r(u,{checkSymbols:b}))};export{u as isEmptyValue};
|