You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

15 lines
268 B
JavaScript

'use strict';
var url = require('url');
var prependHttp = require('prepend-http');
module.exports = function (x) {
var withProtocol = prependHttp(x);
var parsed = url.parse(withProtocol);
if (withProtocol !== x) {
parsed.protocol = null;
}
return parsed;
};