I am using library to parse urls on my page:
import * as urlParse from 'url-parse';
const parseUrl = url => {
try {
return urlParse(url);
} catch (e) {
return null;
}
};
The issue is when the url 'www.stackoverflow.com' is passed to the function, parseUrl
returns http:localhost\www.stackoverflow.com
should I use to obtain the value http://www.stackoverflow.com
?
You don't really need any external lib for this: