ecency-mobile/src/utils/settings.js
2019-11-29 20:13:50 +02:00

17 lines
386 B
JavaScript

export const groomingServerName = (serverName, prefix1) => {
const PREFIX1 = prefix1 || 'https://';
const PREFIX2 = 'https://';
if (!serverName) {
return null;
}
if (serverName.indexOf(PREFIX1) === 0) {
return serverName.substr(PREFIX1.length);
}
if (serverName.indexOf(PREFIX2) === 0) {
return serverName.substr(PREFIX2.length);
}
return serverName;
};