From c2aa7bf38fb30de2d04f87f8e7780e4c768ae6b1 Mon Sep 17 00:00:00 2001 From: Minteck Date: Thu, 20 Jan 2022 13:43:34 +0100 Subject: Initial commit --- node_modules/mdurl/format.js | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 node_modules/mdurl/format.js (limited to 'node_modules/mdurl/format.js') diff --git a/node_modules/mdurl/format.js b/node_modules/mdurl/format.js new file mode 100644 index 0000000..c4eb9f4 --- /dev/null +++ b/node_modules/mdurl/format.js @@ -0,0 +1,25 @@ + +'use strict'; + + +module.exports = function format(url) { + var result = ''; + + result += url.protocol || ''; + result += url.slashes ? '//' : ''; + result += url.auth ? url.auth + '@' : ''; + + if (url.hostname && url.hostname.indexOf(':') !== -1) { + // ipv6 address + result += '[' + url.hostname + ']'; + } else { + result += url.hostname || ''; + } + + result += url.port ? ':' + url.port : ''; + result += url.pathname || ''; + result += url.search || ''; + result += url.hash || ''; + + return result; +}; -- cgit