diff --git a/src/utils/url.js b/src/utils/url.js index 12a4935..ab95c82 100644 --- a/src/utils/url.js +++ b/src/utils/url.js @@ -7,10 +7,12 @@ function addProtocol(url, protocol) { } function stripProtocol(url){ + if(!url) return ''; return url.replace(/(^\w+:|^)\/\//, ''); } function getProtocol(url){ + if(!url) return ''; const values = url.match(/(^\w+:|^)\/\//); return values && (values.length > 0) ? values[0] : '';