ecency-mobile/src/utils/settings.js

17 lines
386 B
JavaScript
Raw Normal View History

2019-01-16 12:14:23 +03:00
export const groomingServerName = (serverName, prefix1) => {
const PREFIX1 = prefix1 || 'https://';
2019-01-16 11:05:51 +03:00
const PREFIX2 = 'https://';
2019-11-29 21:13:50 +03:00
if (!serverName) {
return null;
}
2019-01-16 11:05:51 +03:00
2019-01-16 11:25:53 +03:00
if (serverName.indexOf(PREFIX1) === 0) {
return serverName.substr(PREFIX1.length);
2019-01-16 11:05:51 +03:00
}
2019-01-16 11:25:53 +03:00
if (serverName.indexOf(PREFIX2) === 0) {
return serverName.substr(PREFIX2.length);
2019-01-16 11:05:51 +03:00
}
return serverName;
};