@sorocraft/js-utils
Advanced tools
Comparing version 1.0.15 to 1.0.16
export declare const formatShortDate: (dateString: string, locale?: string) => string; | ||
export declare const formatShortTime: (dateString: string, locale?: string) => string; | ||
export declare const formatShortTime: (dateString: string) => string; |
@@ -1,2 +0,2 @@ | ||
function e(e){const t=typeof e;return null!=e&&("object"===t||"function"===t)}const t=e=>null==e||("object"==typeof e?Array.isArray(e)?0===e.length:e instanceof Set||e instanceof Map?0===e.size:0===Object.keys(e).length:"string"==typeof e&&0===e.length);function n(e,t){return e.reduce(((e,n)=>{const r=n[t];if(!r)return e;const o=String(r);return e[o]||(e[o]=[]),e[o].push(n),e}),{})}const r=/^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/i,o=e=>!!e&&r.test(e),c=e=>!!e&&e.length>=6,u=(e,t,n=[])=>{let r=[];for(const n in t)t[n]&&r.push(e[n]);return(null==n?void 0:n.length)>0&&(r=r.concat(n)),r.join(" ")},i=e=>{if("undefined"==typeof window)return"";const t=window.location.search.slice(1),n=new Map;t.split("&").forEach((e=>{const[t,r]=e.split("=");n.set(decodeURIComponent(t),decodeURIComponent(r))}));return n.get(e)||""},a=e=>{switch(e){case"azn":return"₼";case"usd":return"$";default:return"€"}},s=(e,t,n)=>{if(!Intl||!Intl.NumberFormat)return`${a(t)}${e}`;return new Intl.NumberFormat(n,{style:"currency",currency:t}).format(e)};function d(e,t,n,r){return new(n||(n=Promise))((function(o,c){function u(e){try{a(r.next(e))}catch(e){c(e)}}function i(e){try{a(r.throw(e))}catch(e){c(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(u,i)}a((r=r.apply(e,t||[])).next())}))}"function"==typeof SuppressedError&&SuppressedError;const l=e=>{document.body.removeChild(e),URL.revokeObjectURL(e.href)},f=(e,t)=>d(void 0,void 0,void 0,(function*(){try{const n=yield fetch(e,{credentials:"include"}),r=((e,t)=>{const n=document.createElement("a");return n.href=URL.createObjectURL(e),n.setAttribute("download",t),n})(yield n.blob(),t);document.body.appendChild(r),r.click(),l(r)}catch(t){const n=(e=>{const t=document.createElement("a");return t.href=e,t.target="_blank",t.rel="noopener noreferrer",t})(e);document.body.appendChild(n),n.click(),l(n)}})),p=(e,t)=>new Date(e).toLocaleDateString(t||"en-GB",{month:"short",day:"numeric"}),h=(e,t)=>{const n=new Date(e);return`${String(n.getHours()).padStart(2,"0")}:${String(n.getMinutes()).padStart(2,"0")}`};export{o as checkIsValidEmail,c as checkIsValidPassword,u as classNames,f as downloadFile,p as formatShortDate,h as formatShortTime,a as getCurrencySymbol,i as getQueryParam,n as groupBy,t as isEmpty,e as isObject,s as priceFormatter}; | ||
function e(e){const t=typeof e;return null!=e&&("object"===t||"function"===t)}const t=e=>null==e||("object"==typeof e?Array.isArray(e)?0===e.length:e instanceof Set||e instanceof Map?0===e.size:0===Object.keys(e).length:"string"==typeof e&&0===e.length);function n(e,t){return e.reduce(((e,n)=>{const r=n[t];if(!r)return e;const o=String(r);return e[o]||(e[o]=[]),e[o].push(n),e}),{})}const r=/^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/i,o=e=>!!e&&r.test(e),c=e=>!!e&&e.length>=6,u=(e,t,n=[])=>{let r=[];for(const n in t)t[n]&&r.push(e[n]);return(null==n?void 0:n.length)>0&&(r=r.concat(n)),r.join(" ")},i=e=>{if("undefined"==typeof window)return"";const t=window.location.search.slice(1),n=new Map;t.split("&").forEach((e=>{const[t,r]=e.split("=");n.set(decodeURIComponent(t),decodeURIComponent(r))}));return n.get(e)||""},a=e=>{switch(e){case"azn":return"₼";case"usd":return"$";default:return"€"}},s=(e,t,n)=>{if(!Intl||!Intl.NumberFormat)return`${a(t)}${e}`;return new Intl.NumberFormat(n,{style:"currency",currency:t}).format(e)};function d(e,t,n,r){return new(n||(n=Promise))((function(o,c){function u(e){try{a(r.next(e))}catch(e){c(e)}}function i(e){try{a(r.throw(e))}catch(e){c(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(u,i)}a((r=r.apply(e,t||[])).next())}))}"function"==typeof SuppressedError&&SuppressedError;const l=e=>{document.body.removeChild(e),URL.revokeObjectURL(e.href)},f=(e,t)=>d(void 0,void 0,void 0,(function*(){try{const n=yield fetch(e,{credentials:"include"}),r=((e,t)=>{const n=document.createElement("a");return n.href=URL.createObjectURL(e),n.setAttribute("download",t),n})(yield n.blob(),t);document.body.appendChild(r),r.click(),l(r)}catch(t){const n=(e=>{const t=document.createElement("a");return t.href=e,t.target="_blank",t.rel="noopener noreferrer",t})(e);document.body.appendChild(n),n.click(),l(n)}})),p=(e,t)=>new Date(e).toLocaleDateString(t||"en-GB",{month:"short",day:"numeric"}),h=e=>{const t=new Date(e);return`${String(t.getHours()).padStart(2,"0")}:${String(t.getMinutes()).padStart(2,"0")}`};export{o as checkIsValidEmail,c as checkIsValidPassword,u as classNames,f as downloadFile,p as formatShortDate,h as formatShortTime,a as getCurrencySymbol,i as getQueryParam,n as groupBy,t as isEmpty,e as isObject,s as priceFormatter}; | ||
//# sourceMappingURL=index.esm.js.map |
@@ -1,2 +0,2 @@ | ||
"use strict";const e=/^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/i,t=e=>{switch(e){case"azn":return"₼";case"usd":return"$";default:return"€"}};function n(e,t,n,r){return new(n||(n=Promise))((function(o,c){function s(e){try{a(r.next(e))}catch(e){c(e)}}function i(e){try{a(r.throw(e))}catch(e){c(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,i)}a((r=r.apply(e,t||[])).next())}))}"function"==typeof SuppressedError&&SuppressedError;const r=e=>{document.body.removeChild(e),URL.revokeObjectURL(e.href)};exports.checkIsValidEmail=t=>!!t&&e.test(t),exports.checkIsValidPassword=e=>!!e&&e.length>=6,exports.classNames=(e,t,n=[])=>{let r=[];for(const n in t)t[n]&&r.push(e[n]);return(null==n?void 0:n.length)>0&&(r=r.concat(n)),r.join(" ")},exports.downloadFile=(e,t)=>n(void 0,void 0,void 0,(function*(){try{const n=yield fetch(e,{credentials:"include"}),o=((e,t)=>{const n=document.createElement("a");return n.href=URL.createObjectURL(e),n.setAttribute("download",t),n})(yield n.blob(),t);document.body.appendChild(o),o.click(),r(o)}catch(t){const n=(e=>{const t=document.createElement("a");return t.href=e,t.target="_blank",t.rel="noopener noreferrer",t})(e);document.body.appendChild(n),n.click(),r(n)}})),exports.formatShortDate=(e,t)=>new Date(e).toLocaleDateString(t||"en-GB",{month:"short",day:"numeric"}),exports.formatShortTime=(e,t)=>{const n=new Date(e);return`${String(n.getHours()).padStart(2,"0")}:${String(n.getMinutes()).padStart(2,"0")}`},exports.getCurrencySymbol=t,exports.getQueryParam=e=>{if("undefined"==typeof window)return"";const t=window.location.search.slice(1),n=new Map;t.split("&").forEach((e=>{const[t,r]=e.split("=");n.set(decodeURIComponent(t),decodeURIComponent(r))}));return n.get(e)||""},exports.groupBy=function(e,t){return e.reduce(((e,n)=>{const r=n[t];if(!r)return e;const o=String(r);return e[o]||(e[o]=[]),e[o].push(n),e}),{})},exports.isEmpty=e=>null==e||("object"==typeof e?Array.isArray(e)?0===e.length:e instanceof Set||e instanceof Map?0===e.size:0===Object.keys(e).length:"string"==typeof e&&0===e.length),exports.isObject=function(e){const t=typeof e;return null!=e&&("object"===t||"function"===t)},exports.priceFormatter=(e,n,r)=>{if(!Intl||!Intl.NumberFormat)return`${t(n)}${e}`;return new Intl.NumberFormat(r,{style:"currency",currency:n}).format(e)}; | ||
"use strict";const e=/^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/i,t=e=>{switch(e){case"azn":return"₼";case"usd":return"$";default:return"€"}};function n(e,t,n,r){return new(n||(n=Promise))((function(o,c){function s(e){try{a(r.next(e))}catch(e){c(e)}}function i(e){try{a(r.throw(e))}catch(e){c(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,i)}a((r=r.apply(e,t||[])).next())}))}"function"==typeof SuppressedError&&SuppressedError;const r=e=>{document.body.removeChild(e),URL.revokeObjectURL(e.href)};exports.checkIsValidEmail=t=>!!t&&e.test(t),exports.checkIsValidPassword=e=>!!e&&e.length>=6,exports.classNames=(e,t,n=[])=>{let r=[];for(const n in t)t[n]&&r.push(e[n]);return(null==n?void 0:n.length)>0&&(r=r.concat(n)),r.join(" ")},exports.downloadFile=(e,t)=>n(void 0,void 0,void 0,(function*(){try{const n=yield fetch(e,{credentials:"include"}),o=((e,t)=>{const n=document.createElement("a");return n.href=URL.createObjectURL(e),n.setAttribute("download",t),n})(yield n.blob(),t);document.body.appendChild(o),o.click(),r(o)}catch(t){const n=(e=>{const t=document.createElement("a");return t.href=e,t.target="_blank",t.rel="noopener noreferrer",t})(e);document.body.appendChild(n),n.click(),r(n)}})),exports.formatShortDate=(e,t)=>new Date(e).toLocaleDateString(t||"en-GB",{month:"short",day:"numeric"}),exports.formatShortTime=e=>{const t=new Date(e);return`${String(t.getHours()).padStart(2,"0")}:${String(t.getMinutes()).padStart(2,"0")}`},exports.getCurrencySymbol=t,exports.getQueryParam=e=>{if("undefined"==typeof window)return"";const t=window.location.search.slice(1),n=new Map;t.split("&").forEach((e=>{const[t,r]=e.split("=");n.set(decodeURIComponent(t),decodeURIComponent(r))}));return n.get(e)||""},exports.groupBy=function(e,t){return e.reduce(((e,n)=>{const r=n[t];if(!r)return e;const o=String(r);return e[o]||(e[o]=[]),e[o].push(n),e}),{})},exports.isEmpty=e=>null==e||("object"==typeof e?Array.isArray(e)?0===e.length:e instanceof Set||e instanceof Map?0===e.size:0===Object.keys(e).length:"string"==typeof e&&0===e.length),exports.isObject=function(e){const t=typeof e;return null!=e&&("object"===t||"function"===t)},exports.priceFormatter=(e,n,r)=>{if(!Intl||!Intl.NumberFormat)return`${t(n)}${e}`;return new Intl.NumberFormat(r,{style:"currency",currency:n}).format(e)}; | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@sorocraft/js-utils", | ||
"version": "1.0.15", | ||
"version": "1.0.16", | ||
"main": "dist/index.js", | ||
@@ -5,0 +5,0 @@ "module": "dist/index.esm.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
64369