LearningSalesForceCommerceC.../storefront-reference-architecture/test/integration/helpers/urlUtils.js
2021-12-21 10:57:31 -08:00

19 lines
462 B
JavaScript

function urlUtils() {}
/**
* Strips auth basic authentication parameters - if set - and returns the url
*
* @param {String} url - Url string
* @returns {String}
*/
urlUtils.stripBasicAuth = function (url) {
var sfIndex = url.indexOf('storefront');
var atIndex = url.indexOf('@');
if (sfIndex > -1 && atIndex > -1) {
return url.slice(0, sfIndex) + url.slice(atIndex + 1, url.length);
}
return url;
};
module.exports = urlUtils;