import html from '../utils/html.js'
/**
* @param {string} url
* @returns {string}
*/
const formatURL = url => url.replace(/^(https?:|)\/\//, '').replace(/\/$/, '')
/**
* @param {string} [url]
* @param {string} [name]
* @returns {string | undefined}
*/
export default function Link(url, name) {
return name ? (url ? html`${name}` : name) : url && html`${formatURL(url)}`
}