interlanguage-checker/src/main/js/Shared.js

21 lines
790 B
JavaScript

/**
* The message that is displayed when the application fails to connect to the API.
*
* @type {string}
*/
export const couldNotConnectMessage =
"Could not to connect to API. Is the URL correct? Are you using a script blocker? " +
"See the <b>About</b> section for more information."
/**
* Returns the status that has the lowest index in the given list of statuses.
*
* @param statuses {string[]} the statuses to look the given statuses up in
* @param status1 {string} the first status
* @param status2 {string} the second status
* @returns {string} the status that has the lowest index in the given list of statuses
*/
export const mergeStates = (statuses, status1, status2) => {
return statuses[Math.min(statuses.indexOf(status1), statuses.indexOf(status2))];
};