@machinerd/js-module 0.0.3 → 0.0.4

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.
@@ -1 +1 @@
1
- var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,a)=>(a=n==null?{}:e(i(n)),o(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));let c=require(`dayjs`);c=s(c);let l=require(`dayjs/plugin/relativeTime`);l=s(l);let u=require(`google-libphonenumber`),d=require(`js-cookie`);d=s(d);let f=require(`lodash-es`),p=require(`nanoid`),m=require(`query-string`);m=s(m);let h=require(`slugify`);h=s(h);const g=u.PhoneNumberUtil.getInstance();c.default.extend(l.default);const _=e=>d.default.get(e),v=(e,t,n)=>d.default.set(e,t,n),y=(e,t=[])=>{if(typeof window>`u`)return``;let{hash:n,search:r}=window.location,i=m.default.parse(r);Object.keys(e).forEach(t=>{e[t]?i[t]=e[t]:delete i[t]});let a={...i};return Object.keys(i).forEach(e=>{t.includes(e)&&delete a[e]}),`?${m.default.stringify(a,{encode:!0})}${n}`},b=(e,t)=>{let n=0;return e%t===0&&(n=e/t),n=Math.ceil(e/t),n<1&&(n=1),n},x=e=>{let t=[...e];for(let e=t.length-1;e>0;e--){let n=Math.floor(Math.random()*(e+1));[t[e],t[n]]=[t[n],t[e]]}return t},S=(e,t)=>{let n=[];for(let r=e;r<t;r++)n.push(r);return n},C=(e,t,n=1)=>{let r=[],i=S(e,t);for(;r.length<n;){let t=Math.ceil(e),n=Math.floor(i.length),a=Math.floor(Math.random()*(n-t))+t,o=i.splice(a,1);r.push(o[0])}return[...r]},ee=e=>{let t=document.getElementById(`naverMapLib`);if(!t){let t=document.createElement(`script`);t.src=`https://oapi.map.naver.com/openapi/v3/maps.js?ncpKeyId=ecs1pyoo9b`,t.id=`naverMapLib`,document.body.appendChild(t),t.onload=()=>{e&&e()}}t&&e&&e()},w=(e,t,n)=>t?e===`ko`&&n&&n!==`82`||e!==`ko`&&n?`+${n}-${t.replace(/^0/,``)}`:t:`-`,T=({phone:e,country:t={callingCode:`82`,alpha2Code:`KR`},format:n=u.PhoneNumberFormat.INTERNATIONAL,locale:r})=>{if(!e||e===`-`)return`-`;try{let i=g.parseAndKeepRawInput(e,t?.alpha2Code||`KR`),a=i.getCountryCode();return r===`ko`&&t?.alpha2Code===`KR`&&a===82?g.format(i,u.PhoneNumberFormat.NATIONAL):g.format(i,n)}catch{return w(r||`en`,e,t?.callingCode)}},E=(e,...t)=>{h.default.extend({'"':`-`,"”":`-`,"“":`-`,"•":`----`});let n=`${e}`;return t.forEach(e=>{e&&(n=`${n}-${(0,h.default)(e,{lower:!0,trim:!0,locale:`en`,strict:!0})}`)}),n},D=e=>{let t=[];e.i18n?.forEach(e=>{e.locale===`en`&&e.name&&t.push(e.name)});let n=e.series?.i18n.find(e=>e.locale===`en`);return n?.name&&t.push(n.name.toLowerCase()),e.stockNo&&t.push(e.stockNo[0]),E(e.id,...t)},O=e=>{let t=e;return t.length>0?t[0].trim():``},k=(e=`en`,t,n)=>{if(!t||!n||t.length<=0)return``;let r=[...t].sort(j);if(e){let t=r.findIndex(t=>t.locale===e);if(t){let e=r.splice(t,1);r.unshift(e[0])}}for(let e of r){let t=e[n];if(!(Array.isArray(t)&&t.length===0)&&t)return t}return``},A=(e,t,n)=>{if(!t||!n||t.length<=0)return``;let r=[...t].sort(j);if(e){let t=r.findIndex(t=>t.locale===e);if(t){let e=r.splice(t,1);r.unshift(e[0])}}let i=``;for(let e of r){let t=e[n];if(t){i=String(t);break}}return i},j=(e,t)=>e.priority<t.priority?-1:e.priority>t.priority?1:0,M=()=>(0,p.customAlphabet)(`0123456789abcdefghijklmnopqrstuvwxyz`,5)(),N=e=>{for(let t=0;t<e;t++)console.log(M())},P=()=>typeof window>`u`?[]:JSON.parse(localStorage.getItem(`search-history`)||`[]`),F=e=>{let t=(0,f.uniq)([e,...P()]).slice(0,10);return localStorage.setItem(`search-history`,JSON.stringify(t)),t},I=e=>{let t=P();return t.splice(e,1),localStorage.setItem(`search-history`,JSON.stringify(t)),t},L=()=>{localStorage.setItem(`search-history`,JSON.stringify([]))},R=(e,t,n)=>{if(e){let r;r=Array.isArray(e)?e[0]:e;try{return t(r)}catch{return n}}return n},z=(e,t)=>{let{[t]:n,...r}=e;return r},B=(e,t)=>Object.fromEntries(Object.entries(e).filter(([e])=>!t.includes(e))),V=(e,t)=>(0,f.intersection)(e,t).length>0,H=e=>e.endsWith(`/search`),U=e=>H(e)?e:`${e}/search`.replace(`//`,`/`),W=e=>e.replace(`/search`,``).replace(`//`,`/`),G=(e,t)=>{let n=new URLSearchParams(e);return n.delete(t),Object.fromEntries(n)},K=e=>e.split(`:`).pop()?.split(`.`).pop(),q=(e,...t)=>[e,t].flat().join(`.`).replace(`:.`,`.`);function J(e,t=0){if(e==0)return`0 Bytes`;let n=1024,r=t,i=[`Bytes`,`KB`,`MB`,`GB`,`TB`,`PB`,`EB`,`ZB`,`YB`],a=Math.floor(Math.log(e)/Math.log(n));return parseFloat((e/n**+a).toFixed(r))+` `+i[a]}const Y=e=>e.split(`.`).slice(0,-1).join(`.`),X=e=>e.split(`.`).pop(),Z=(e,t)=>{let n={directory:``,filename:``,extension:``,filenameWithoutExtension:``},r=e.lastIndexOf(`/`),i=r>=0?e.substring(r+1):e,a=i.lastIndexOf(`.`),o=a>0?i.substring(a+1):``,s=a>0?i.substring(0,a):i;if(n.filename=i,n.extension=o,n.filenameWithoutExtension=s,e.startsWith(`http`)){let r=t?`/static/`:`/media/`,i=e.indexOf(r);if(i!==-1){let t=e.substring(i+r.length),a=t.lastIndexOf(`/`);return n.directory=a===-1?``:t.substring(0,a),n}}return n.directory=r===-1?``:e.substring(0,r),n},Q=(e=`en`,t)=>{if(t.length<=0)return`-`;let n=t[0];return n?$(e,n.i18n):`-`},$=(e=`en`,t)=>{if(t.length===0)return``;let n=k(e,t,`address1`)?.replace(`대한민국`,``)||``,r=t.find(t=>t.locale===e)?.address2,i=[n];return e===`ko`?i.push(r):i.unshift(r),i.filter(Boolean).join(`, `).trim()},te=e=>{let t=0;for(let n of e)t+=n.weight;let n=Math.random()*t,r=0;for(let t of e)if(r+=t.weight,n<r)return t;return e[e.length-1]};exports.appendSearchPath=U,exports.calcPageCount=b,exports.clearQueryByKey=G,exports.clearSearchPath=W,exports.comparePriorityAsc=j,exports.composeKey=q,exports.deleteAllSearchHistory=L,exports.deleteSearchHistory=I,exports.existLeastOne=V,exports.formatBytes=J,exports.formatI18nNumber=T,exports.genNanoID=M,exports.getCookie=_,exports.getFileExtension=X,exports.getFilename=Y,exports.getFirstLocationAddress=Q,exports.getFullAddress=$,exports.getI18nKey=K,exports.getI18nValue=A,exports.getI18nValues=k,exports.getModelName=O,exports.getSearchHistory=P,exports.insertSearchHistory=F,exports.isSearchPage=H,exports.link=y,exports.loadExLib=ee,exports.parsePath=Z,exports.parseQuery=R,exports.printNanoID=N,exports.productSlugify=D,exports.randomNum=C,exports.recomposeI18nNumber=w,exports.selectItemByWeight=te,exports.setCookies=v,exports.shuffle=x,exports.slugify=E,exports.withoutProperties=B,exports.withoutProperty=z;
1
+ var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,a)=>(a=n==null?{}:e(i(n)),o(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));let c=require(`google-libphonenumber`),l=require(`js-cookie`);l=s(l);let u=require(`lodash-es`),d=require(`nanoid`),f=require(`query-string`);f=s(f);let p=require(`slugify`);p=s(p);const m=c.PhoneNumberUtil.getInstance(),h=e=>l.default.get(e),g=(e,t,n)=>l.default.set(e,t,n),_=(e,t=[])=>{if(typeof window>`u`)return``;let{hash:n,search:r}=window.location,i=f.default.parse(r);Object.keys(e).forEach(t=>{e[t]?i[t]=e[t]:delete i[t]});let a={...i};return Object.keys(i).forEach(e=>{t.includes(e)&&delete a[e]}),`?${f.default.stringify(a,{encode:!0})}${n}`},v=(e,t)=>{let n=0;return e%t===0&&(n=e/t),n=Math.ceil(e/t),n<1&&(n=1),n},y=e=>{let t=[...e];for(let e=t.length-1;e>0;e--){let n=Math.floor(Math.random()*(e+1));[t[e],t[n]]=[t[n],t[e]]}return t},b=(e,t)=>{let n=[];for(let r=e;r<t;r++)n.push(r);return n},x=(e,t,n=1)=>{let r=[],i=b(e,t);for(;r.length<n;){let t=Math.ceil(e),n=Math.floor(i.length),a=Math.floor(Math.random()*(n-t))+t,o=i.splice(a,1);r.push(o[0])}return[...r]},S=e=>{let t=document.getElementById(`naverMapLib`);if(!t){let t=document.createElement(`script`);t.src=`https://oapi.map.naver.com/openapi/v3/maps.js?ncpKeyId=ecs1pyoo9b`,t.id=`naverMapLib`,document.body.appendChild(t),t.onload=()=>{e&&e()}}t&&e&&e()},C=(e,t,n)=>t?e===`ko`&&n&&n!==`82`||e!==`ko`&&n?`+${n}-${t.replace(/^0/,``)}`:t:`-`,w=({phone:e,country:t={callingCode:`82`,alpha2Code:`KR`},format:n=c.PhoneNumberFormat.INTERNATIONAL,locale:r})=>{if(!e||e===`-`)return`-`;try{let i=m.parseAndKeepRawInput(e,t?.alpha2Code||`KR`),a=i.getCountryCode();return r===`ko`&&t?.alpha2Code===`KR`&&a===82?m.format(i,c.PhoneNumberFormat.NATIONAL):m.format(i,n)}catch{return C(r||`en`,e,t?.callingCode)}},T=(e,...t)=>{p.default.extend({'"':`-`,"”":`-`,"“":`-`,"•":`----`});let n=`${e}`;return t.forEach(e=>{e&&(n=`${n}-${(0,p.default)(e,{lower:!0,trim:!0,locale:`en`,strict:!0})}`)}),n},E=e=>{let t=[];e.i18n?.forEach(e=>{e.locale===`en`&&e.name&&t.push(e.name)});let n=e.series?.i18n.find(e=>e.locale===`en`);return n?.name&&t.push(n.name.toLowerCase()),e.stockNo&&t.push(e.stockNo[0]),T(e.id,...t)},D=e=>{let t=e;return t.length>0?t[0].trim():``},O=(e=`en`,t,n)=>{if(!t||!n||t.length<=0)return``;let r=[...t].sort(A);if(e){let t=r.findIndex(t=>t.locale===e);if(t){let e=r.splice(t,1);r.unshift(e[0])}}for(let e of r){let t=e[n];if(!(Array.isArray(t)&&t.length===0)&&t)return t}return``},k=(e,t,n)=>{if(!t||!n||t.length<=0)return``;let r=[...t].sort(A);if(e){let t=r.findIndex(t=>t.locale===e);if(t){let e=r.splice(t,1);r.unshift(e[0])}}let i=``;for(let e of r){let t=e[n];if(t){i=String(t);break}}return i},A=(e,t)=>e.priority<t.priority?-1:e.priority>t.priority?1:0,j=()=>(0,d.customAlphabet)(`0123456789abcdefghijklmnopqrstuvwxyz`,5)(),M=e=>{for(let t=0;t<e;t++)console.log(j())},N=()=>typeof window>`u`?[]:JSON.parse(localStorage.getItem(`search-history`)||`[]`),P=e=>{let t=(0,u.uniq)([e,...N()]).slice(0,10);return localStorage.setItem(`search-history`,JSON.stringify(t)),t},F=e=>{let t=N();return t.splice(e,1),localStorage.setItem(`search-history`,JSON.stringify(t)),t},I=()=>{localStorage.setItem(`search-history`,JSON.stringify([]))},L=(e,t,n)=>{if(e){let r;r=Array.isArray(e)?e[0]:e;try{return t(r)}catch{return n}}return n},R=(e,t)=>{let{[t]:n,...r}=e;return r},z=(e,t)=>Object.fromEntries(Object.entries(e).filter(([e])=>!t.includes(e))),B=(e,t)=>(0,u.intersection)(e,t).length>0,V=e=>e.endsWith(`/search`),H=e=>V(e)?e:`${e}/search`.replace(`//`,`/`),U=e=>e.replace(`/search`,``).replace(`//`,`/`),W=(e,t)=>{let n=new URLSearchParams(e);return n.delete(t),Object.fromEntries(n)},G=e=>e.split(`:`).pop()?.split(`.`).pop(),K=(e,...t)=>[e,t].flat().join(`.`).replace(`:.`,`.`);function q(e,t=0){if(e==0)return`0 Bytes`;let n=1024,r=t,i=[`Bytes`,`KB`,`MB`,`GB`,`TB`,`PB`,`EB`,`ZB`,`YB`],a=Math.floor(Math.log(e)/Math.log(n));return parseFloat((e/n**+a).toFixed(r))+` `+i[a]}const J=e=>e.split(`.`).slice(0,-1).join(`.`),Y=e=>e.split(`.`).pop(),X=(e,t)=>{let n={directory:``,filename:``,extension:``,filenameWithoutExtension:``},r=e.lastIndexOf(`/`),i=r>=0?e.substring(r+1):e,a=i.lastIndexOf(`.`),o=a>0?i.substring(a+1):``,s=a>0?i.substring(0,a):i;if(n.filename=i,n.extension=o,n.filenameWithoutExtension=s,e.startsWith(`http`)){let r=t?`/static/`:`/media/`,i=e.indexOf(r);if(i!==-1){let t=e.substring(i+r.length),a=t.lastIndexOf(`/`);return n.directory=a===-1?``:t.substring(0,a),n}}return n.directory=r===-1?``:e.substring(0,r),n},Z=(e=`en`,t)=>{if(t.length<=0)return`-`;let n=t[0];return n?Q(e,n.i18n):`-`},Q=(e=`en`,t)=>{if(t.length===0)return``;let n=O(e,t,`address1`)?.replace(`대한민국`,``)||``,r=t.find(t=>t.locale===e)?.address2,i=[n];return e===`ko`?i.push(r):i.unshift(r),i.filter(Boolean).join(`, `).trim()},$=e=>{let t=0;for(let n of e)t+=n.weight;let n=Math.random()*t,r=0;for(let t of e)if(r+=t.weight,n<r)return t;return e[e.length-1]};exports.appendSearchPath=H,exports.calcPageCount=v,exports.clearQueryByKey=W,exports.clearSearchPath=U,exports.comparePriorityAsc=A,exports.composeKey=K,exports.deleteAllSearchHistory=I,exports.deleteSearchHistory=F,exports.existLeastOne=B,exports.formatBytes=q,exports.formatI18nNumber=w,exports.genNanoID=j,exports.getCookie=h,exports.getFileExtension=Y,exports.getFilename=J,exports.getFirstLocationAddress=Z,exports.getFullAddress=Q,exports.getI18nKey=G,exports.getI18nValue=k,exports.getI18nValues=O,exports.getModelName=D,exports.getSearchHistory=N,exports.insertSearchHistory=P,exports.isSearchPage=V,exports.link=_,exports.loadExLib=S,exports.parsePath=X,exports.parseQuery=L,exports.printNanoID=M,exports.productSlugify=E,exports.randomNum=x,exports.recomposeI18nNumber=C,exports.selectItemByWeight=$,exports.setCookies=g,exports.shuffle=y,exports.slugify=T,exports.withoutProperties=z,exports.withoutProperty=R;
@@ -1 +1 @@
1
- import e from"dayjs";import t from"dayjs/plugin/relativeTime";import{PhoneNumberFormat as n,PhoneNumberUtil as r}from"google-libphonenumber";import i from"js-cookie";import{intersection as a,uniq as o}from"lodash-es";import{customAlphabet as s}from"nanoid";import c from"query-string";import l from"slugify";const u=r.getInstance();e.extend(t);const d=e=>i.get(e),f=(e,t,n)=>i.set(e,t,n),p=(e,t=[])=>{if(typeof window>`u`)return``;let{hash:n,search:r}=window.location,i=c.parse(r);Object.keys(e).forEach(t=>{e[t]?i[t]=e[t]:delete i[t]});let a={...i};return Object.keys(i).forEach(e=>{t.includes(e)&&delete a[e]}),`?${c.stringify(a,{encode:!0})}${n}`},m=(e,t)=>{let n=0;return e%t===0&&(n=e/t),n=Math.ceil(e/t),n<1&&(n=1),n},h=e=>{let t=[...e];for(let e=t.length-1;e>0;e--){let n=Math.floor(Math.random()*(e+1));[t[e],t[n]]=[t[n],t[e]]}return t},g=(e,t)=>{let n=[];for(let r=e;r<t;r++)n.push(r);return n},_=(e,t,n=1)=>{let r=[],i=g(e,t);for(;r.length<n;){let t=Math.ceil(e),n=Math.floor(i.length),a=Math.floor(Math.random()*(n-t))+t,o=i.splice(a,1);r.push(o[0])}return[...r]},v=e=>{let t=document.getElementById(`naverMapLib`);if(!t){let t=document.createElement(`script`);t.src=`https://oapi.map.naver.com/openapi/v3/maps.js?ncpKeyId=ecs1pyoo9b`,t.id=`naverMapLib`,document.body.appendChild(t),t.onload=()=>{e&&e()}}t&&e&&e()},y=(e,t,n)=>t?e===`ko`&&n&&n!==`82`||e!==`ko`&&n?`+${n}-${t.replace(/^0/,``)}`:t:`-`,b=({phone:e,country:t={callingCode:`82`,alpha2Code:`KR`},format:r=n.INTERNATIONAL,locale:i})=>{if(!e||e===`-`)return`-`;try{let a=u.parseAndKeepRawInput(e,t?.alpha2Code||`KR`),o=a.getCountryCode();return i===`ko`&&t?.alpha2Code===`KR`&&o===82?u.format(a,n.NATIONAL):u.format(a,r)}catch{return y(i||`en`,e,t?.callingCode)}},x=(e,...t)=>{l.extend({'"':`-`,"”":`-`,"“":`-`,"•":`----`});let n=`${e}`;return t.forEach(e=>{e&&(n=`${n}-${l(e,{lower:!0,trim:!0,locale:`en`,strict:!0})}`)}),n},S=e=>{let t=[];e.i18n?.forEach(e=>{e.locale===`en`&&e.name&&t.push(e.name)});let n=e.series?.i18n.find(e=>e.locale===`en`);return n?.name&&t.push(n.name.toLowerCase()),e.stockNo&&t.push(e.stockNo[0]),x(e.id,...t)},C=e=>{let t=e;return t.length>0?t[0].trim():``},w=(e=`en`,t,n)=>{if(!t||!n||t.length<=0)return``;let r=[...t].sort(E);if(e){let t=r.findIndex(t=>t.locale===e);if(t){let e=r.splice(t,1);r.unshift(e[0])}}for(let e of r){let t=e[n];if(!(Array.isArray(t)&&t.length===0)&&t)return t}return``},T=(e,t,n)=>{if(!t||!n||t.length<=0)return``;let r=[...t].sort(E);if(e){let t=r.findIndex(t=>t.locale===e);if(t){let e=r.splice(t,1);r.unshift(e[0])}}let i=``;for(let e of r){let t=e[n];if(t){i=String(t);break}}return i},E=(e,t)=>e.priority<t.priority?-1:e.priority>t.priority?1:0,D=()=>s(`0123456789abcdefghijklmnopqrstuvwxyz`,5)(),O=e=>{for(let t=0;t<e;t++)console.log(D())},k=()=>typeof window>`u`?[]:JSON.parse(localStorage.getItem(`search-history`)||`[]`),A=e=>{let t=o([e,...k()]).slice(0,10);return localStorage.setItem(`search-history`,JSON.stringify(t)),t},j=e=>{let t=k();return t.splice(e,1),localStorage.setItem(`search-history`,JSON.stringify(t)),t},M=()=>{localStorage.setItem(`search-history`,JSON.stringify([]))},N=(e,t,n)=>{if(e){let r;r=Array.isArray(e)?e[0]:e;try{return t(r)}catch{return n}}return n},P=(e,t)=>{let{[t]:n,...r}=e;return r},F=(e,t)=>Object.fromEntries(Object.entries(e).filter(([e])=>!t.includes(e))),I=(e,t)=>a(e,t).length>0,L=e=>e.endsWith(`/search`),R=e=>L(e)?e:`${e}/search`.replace(`//`,`/`),z=e=>e.replace(`/search`,``).replace(`//`,`/`),B=(e,t)=>{let n=new URLSearchParams(e);return n.delete(t),Object.fromEntries(n)},V=e=>e.split(`:`).pop()?.split(`.`).pop(),H=(e,...t)=>[e,t].flat().join(`.`).replace(`:.`,`.`);function U(e,t=0){if(e==0)return`0 Bytes`;let n=1024,r=t,i=[`Bytes`,`KB`,`MB`,`GB`,`TB`,`PB`,`EB`,`ZB`,`YB`],a=Math.floor(Math.log(e)/Math.log(n));return parseFloat((e/n**+a).toFixed(r))+` `+i[a]}const W=e=>e.split(`.`).slice(0,-1).join(`.`),G=e=>e.split(`.`).pop(),K=(e,t)=>{let n={directory:``,filename:``,extension:``,filenameWithoutExtension:``},r=e.lastIndexOf(`/`),i=r>=0?e.substring(r+1):e,a=i.lastIndexOf(`.`),o=a>0?i.substring(a+1):``,s=a>0?i.substring(0,a):i;if(n.filename=i,n.extension=o,n.filenameWithoutExtension=s,e.startsWith(`http`)){let r=t?`/static/`:`/media/`,i=e.indexOf(r);if(i!==-1){let t=e.substring(i+r.length),a=t.lastIndexOf(`/`);return n.directory=a===-1?``:t.substring(0,a),n}}return n.directory=r===-1?``:e.substring(0,r),n},q=(e=`en`,t)=>{if(t.length<=0)return`-`;let n=t[0];return n?J(e,n.i18n):`-`},J=(e=`en`,t)=>{if(t.length===0)return``;let n=w(e,t,`address1`)?.replace(`대한민국`,``)||``,r=t.find(t=>t.locale===e)?.address2,i=[n];return e===`ko`?i.push(r):i.unshift(r),i.filter(Boolean).join(`, `).trim()},Y=e=>{let t=0;for(let n of e)t+=n.weight;let n=Math.random()*t,r=0;for(let t of e)if(r+=t.weight,n<r)return t;return e[e.length-1]};export{R as appendSearchPath,m as calcPageCount,B as clearQueryByKey,z as clearSearchPath,E as comparePriorityAsc,H as composeKey,M as deleteAllSearchHistory,j as deleteSearchHistory,I as existLeastOne,U as formatBytes,b as formatI18nNumber,D as genNanoID,d as getCookie,G as getFileExtension,W as getFilename,q as getFirstLocationAddress,J as getFullAddress,V as getI18nKey,T as getI18nValue,w as getI18nValues,C as getModelName,k as getSearchHistory,A as insertSearchHistory,L as isSearchPage,p as link,v as loadExLib,K as parsePath,N as parseQuery,O as printNanoID,S as productSlugify,_ as randomNum,y as recomposeI18nNumber,Y as selectItemByWeight,f as setCookies,h as shuffle,x as slugify,F as withoutProperties,P as withoutProperty};
1
+ import{PhoneNumberFormat as e,PhoneNumberUtil as t}from"google-libphonenumber";import n from"js-cookie";import{intersection as r,uniq as i}from"lodash-es";import{customAlphabet as a}from"nanoid";import o from"query-string";import s from"slugify";const c=t.getInstance(),l=e=>n.get(e),u=(e,t,r)=>n.set(e,t,r),d=(e,t=[])=>{if(typeof window>`u`)return``;let{hash:n,search:r}=window.location,i=o.parse(r);Object.keys(e).forEach(t=>{e[t]?i[t]=e[t]:delete i[t]});let a={...i};return Object.keys(i).forEach(e=>{t.includes(e)&&delete a[e]}),`?${o.stringify(a,{encode:!0})}${n}`},f=(e,t)=>{let n=0;return e%t===0&&(n=e/t),n=Math.ceil(e/t),n<1&&(n=1),n},p=e=>{let t=[...e];for(let e=t.length-1;e>0;e--){let n=Math.floor(Math.random()*(e+1));[t[e],t[n]]=[t[n],t[e]]}return t},m=(e,t)=>{let n=[];for(let r=e;r<t;r++)n.push(r);return n},h=(e,t,n=1)=>{let r=[],i=m(e,t);for(;r.length<n;){let t=Math.ceil(e),n=Math.floor(i.length),a=Math.floor(Math.random()*(n-t))+t,o=i.splice(a,1);r.push(o[0])}return[...r]},g=e=>{let t=document.getElementById(`naverMapLib`);if(!t){let t=document.createElement(`script`);t.src=`https://oapi.map.naver.com/openapi/v3/maps.js?ncpKeyId=ecs1pyoo9b`,t.id=`naverMapLib`,document.body.appendChild(t),t.onload=()=>{e&&e()}}t&&e&&e()},_=(e,t,n)=>t?e===`ko`&&n&&n!==`82`||e!==`ko`&&n?`+${n}-${t.replace(/^0/,``)}`:t:`-`,v=({phone:t,country:n={callingCode:`82`,alpha2Code:`KR`},format:r=e.INTERNATIONAL,locale:i})=>{if(!t||t===`-`)return`-`;try{let a=c.parseAndKeepRawInput(t,n?.alpha2Code||`KR`),o=a.getCountryCode();return i===`ko`&&n?.alpha2Code===`KR`&&o===82?c.format(a,e.NATIONAL):c.format(a,r)}catch{return _(i||`en`,t,n?.callingCode)}},y=(e,...t)=>{s.extend({'"':`-`,"”":`-`,"“":`-`,"•":`----`});let n=`${e}`;return t.forEach(e=>{e&&(n=`${n}-${s(e,{lower:!0,trim:!0,locale:`en`,strict:!0})}`)}),n},b=e=>{let t=[];e.i18n?.forEach(e=>{e.locale===`en`&&e.name&&t.push(e.name)});let n=e.series?.i18n.find(e=>e.locale===`en`);return n?.name&&t.push(n.name.toLowerCase()),e.stockNo&&t.push(e.stockNo[0]),y(e.id,...t)},x=e=>{let t=e;return t.length>0?t[0].trim():``},S=(e=`en`,t,n)=>{if(!t||!n||t.length<=0)return``;let r=[...t].sort(w);if(e){let t=r.findIndex(t=>t.locale===e);if(t){let e=r.splice(t,1);r.unshift(e[0])}}for(let e of r){let t=e[n];if(!(Array.isArray(t)&&t.length===0)&&t)return t}return``},C=(e,t,n)=>{if(!t||!n||t.length<=0)return``;let r=[...t].sort(w);if(e){let t=r.findIndex(t=>t.locale===e);if(t){let e=r.splice(t,1);r.unshift(e[0])}}let i=``;for(let e of r){let t=e[n];if(t){i=String(t);break}}return i},w=(e,t)=>e.priority<t.priority?-1:e.priority>t.priority?1:0,T=()=>a(`0123456789abcdefghijklmnopqrstuvwxyz`,5)(),E=e=>{for(let t=0;t<e;t++)console.log(T())},D=()=>typeof window>`u`?[]:JSON.parse(localStorage.getItem(`search-history`)||`[]`),O=e=>{let t=i([e,...D()]).slice(0,10);return localStorage.setItem(`search-history`,JSON.stringify(t)),t},k=e=>{let t=D();return t.splice(e,1),localStorage.setItem(`search-history`,JSON.stringify(t)),t},A=()=>{localStorage.setItem(`search-history`,JSON.stringify([]))},j=(e,t,n)=>{if(e){let r;r=Array.isArray(e)?e[0]:e;try{return t(r)}catch{return n}}return n},M=(e,t)=>{let{[t]:n,...r}=e;return r},N=(e,t)=>Object.fromEntries(Object.entries(e).filter(([e])=>!t.includes(e))),P=(e,t)=>r(e,t).length>0,F=e=>e.endsWith(`/search`),I=e=>F(e)?e:`${e}/search`.replace(`//`,`/`),L=e=>e.replace(`/search`,``).replace(`//`,`/`),R=(e,t)=>{let n=new URLSearchParams(e);return n.delete(t),Object.fromEntries(n)},z=e=>e.split(`:`).pop()?.split(`.`).pop(),B=(e,...t)=>[e,t].flat().join(`.`).replace(`:.`,`.`);function V(e,t=0){if(e==0)return`0 Bytes`;let n=1024,r=t,i=[`Bytes`,`KB`,`MB`,`GB`,`TB`,`PB`,`EB`,`ZB`,`YB`],a=Math.floor(Math.log(e)/Math.log(n));return parseFloat((e/n**+a).toFixed(r))+` `+i[a]}const H=e=>e.split(`.`).slice(0,-1).join(`.`),U=e=>e.split(`.`).pop(),W=(e,t)=>{let n={directory:``,filename:``,extension:``,filenameWithoutExtension:``},r=e.lastIndexOf(`/`),i=r>=0?e.substring(r+1):e,a=i.lastIndexOf(`.`),o=a>0?i.substring(a+1):``,s=a>0?i.substring(0,a):i;if(n.filename=i,n.extension=o,n.filenameWithoutExtension=s,e.startsWith(`http`)){let r=t?`/static/`:`/media/`,i=e.indexOf(r);if(i!==-1){let t=e.substring(i+r.length),a=t.lastIndexOf(`/`);return n.directory=a===-1?``:t.substring(0,a),n}}return n.directory=r===-1?``:e.substring(0,r),n},G=(e=`en`,t)=>{if(t.length<=0)return`-`;let n=t[0];return n?K(e,n.i18n):`-`},K=(e=`en`,t)=>{if(t.length===0)return``;let n=S(e,t,`address1`)?.replace(`대한민국`,``)||``,r=t.find(t=>t.locale===e)?.address2,i=[n];return e===`ko`?i.push(r):i.unshift(r),i.filter(Boolean).join(`, `).trim()},q=e=>{let t=0;for(let n of e)t+=n.weight;let n=Math.random()*t,r=0;for(let t of e)if(r+=t.weight,n<r)return t;return e[e.length-1]};export{I as appendSearchPath,f as calcPageCount,R as clearQueryByKey,L as clearSearchPath,w as comparePriorityAsc,B as composeKey,A as deleteAllSearchHistory,k as deleteSearchHistory,P as existLeastOne,V as formatBytes,v as formatI18nNumber,T as genNanoID,l as getCookie,U as getFileExtension,H as getFilename,G as getFirstLocationAddress,K as getFullAddress,z as getI18nKey,C as getI18nValue,S as getI18nValues,x as getModelName,D as getSearchHistory,O as insertSearchHistory,F as isSearchPage,d as link,g as loadExLib,W as parsePath,j as parseQuery,E as printNanoID,b as productSlugify,h as randomNum,_ as recomposeI18nNumber,q as selectItemByWeight,u as setCookies,p as shuffle,y as slugify,N as withoutProperties,M as withoutProperty};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@machinerd/js-module",
3
- "version": "0.0.3",
3
+ "version": "0.0.4",
4
4
  "type": "module",
5
5
  "description": "",
6
6
  "main": "dist/index.mjs",