+59
-0
@@ -392,1 +392,60 @@ const path = require('bare-path') | ||
| } | ||
| exports.format = function format(parts) { | ||
| const { | ||
| protocol, | ||
| auth, | ||
| host, | ||
| hostname, | ||
| port, | ||
| pathname, | ||
| search, | ||
| query, | ||
| hash, | ||
| slashes | ||
| } = parts | ||
| let result = '' | ||
| if (typeof protocol === 'string') { | ||
| result += protocol | ||
| if (protocol[protocol.length - 1] !== ':') { | ||
| result += ':' | ||
| } | ||
| if (slashes === true || /https?|ftp|gopher|file/.test(protocol)) { | ||
| result += '//' | ||
| } | ||
| } | ||
| if (typeof auth === 'string') { | ||
| if (host || hostname) result += auth + '@' | ||
| } | ||
| if (typeof host === 'string') result += host | ||
| else { | ||
| result += hostname | ||
| if (port) result += ':' + port | ||
| } | ||
| if (typeof pathname === 'string' && pathname !== '') { | ||
| if (pathname[0] !== '/') result += '/' | ||
| result += pathname | ||
| } | ||
| if (typeof search === 'string') { | ||
| if (search[0] !== '?') result += '?' | ||
| result += search | ||
| } else if (typeof query === 'object' && query !== null) { | ||
| result += '?' + new URLSearchParams(query) | ||
| } | ||
| if (typeof hash === 'string') { | ||
| if (hash[0] !== '#') result += '#' | ||
| result += hash | ||
| } | ||
| return result | ||
| } |
+1
-1
| { | ||
| "name": "bare-url", | ||
| "version": "2.2.2", | ||
| "version": "2.3.0", | ||
| "description": "WHATWG URL implementation for JavaScript", | ||
@@ -5,0 +5,0 @@ "exports": { |
1215448
0.09%571
8.97%