blob: f9c0c65afdbbd590e746c51ef61135fed7aabf9a [file] [log] [blame]
Leo Repp58b9f112021-11-22 11:57:47 +01001'use strict';
2var url = require('url');
3var prependHttp = require('prepend-http');
4
5module.exports = function (x) {
6 var withProtocol = prependHttp(x);
7 var parsed = url.parse(withProtocol);
8
9 if (withProtocol !== x) {
10 parsed.protocol = null;
11 }
12
13 return parsed;
14};