basic-business-template/assets/js/utils.js

22 lines
620 B
JavaScript
Raw Normal View History

2023-10-21 04:05:42 +00:00
export function numberToEuroFormat(number) {
let formatter = new Intl.NumberFormat('de', { style: 'currency', currency: 'EUR' });
return formatter.format(number);
}
export function isJson(string) {
try { JSON.parse(string); }
catch (error) { return false; }
return true;
}
export function isEncoded(string) {
try { atob(string); }
catch (error) { return false; }
return true;
}
export function url(path = "") {
2023-10-21 04:44:42 +00:00
const baseUrlElement = document.getElementById("base-url");
const baseUrl = baseUrlElement ? baseUrlElement.getAttribute("content") : "";
return baseUrl + path;
2023-10-21 04:05:42 +00:00
}