/** * Returns strict url address. * * @return string * * @example * const url: string = getHost() + '/following-url/'; */ export const getHost = (apiUrl: string): string => { if (!apiUrl.startsWith('http')) { const url = window.location; return url.protocol + '//' + url.host + apiUrl; } return apiUrl; } /** * Sorts objects by the display property. * * @param {number} a - The first object to sort. * @param {number} b - The second object to sort. * * @example * [objects].sortByDisplay() */ export const sortByDisplay = (a, b) => a.display - b.display;