formate(urlObj) {
		let { protocol, hostname, username, password, path, port, query } = urlObj;

		const enc = (str) => encodeURIComponent(str);

		if (!protocol || !hostname)
			throw new Error("Cannot formate url. Missing 'protocol' and 'hostname'.");

		let string = `${protocol}//`;

		if (username && password) string += `${enc(username)}:${enc(password)}@`;
		else if (username) string += `${username}@`;

		string += hostname;

		if (port) string += `:${port}`;

		if (path) {
			if (!path.startsWith("/")) path = "/" + path;

			string += path;
		}

		if (query && typeof query === "object") {
			string += "?";

			for (let key in query) string += `${enc(key)}=${enc(query[key])}&`;

			string = string.slice(0, -1);
		}

		return string;
	}
Formate Url object to string
@param {object} urlObj
@param {"ftp:"|"sftp:"|"http:"|"https:"} urlObj.protocol
@param {string|number} urlObj.hostname
@param {string} [urlObj.path]
@param {string} [urlObj.username]
@param {string} [urlObj.password]
@param {string|number} [urlObj.port]
@param {object} [urlObj.query]
@returns {string}