22 lines
632 B
JavaScript
22 lines
632 B
JavaScript
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 = "") {
|
|
const baseUrlElement = document.querySelector('meta[name="url-base"]');
|
|
const baseUrl = baseUrlElement ? baseUrlElement.getAttribute("content") : "";
|
|
return baseUrl + path;
|
|
} |