![JavaScript Style Guide](https://camo.githubusercontent.com/b9bdb5c56c5c75b490aeb3600d6891d23a0e604d1451a7217f67234cac76c940/68747470733a2f2f63646e2e7261776769742e636f6d2f7374616e646172642f7374616e646172642f6d61737465722f62616467652e737667)
$ npm install --save xs-url
# or
$ yarn add xs-url
const url = require('xs-url')
const str = url.parse('http://www.example.com:8080/path/subpath?search=test#hs=hash')
/* {
protocol: 'http',
host: 'www.example.com',
port: 8080,
path: 'path/subpath',
search: 'search=test',
hash: 'hs=hash'
} */
url.format(str)
// http://www.example.com:8080/path/subpath?search=test#hs=hash
url.format(str, { search1: 'test1', search2: ['test2', 'test3'] })
// http://www.example.com:8080/path/subpath?search=test&search1=test1&search2=test2&search2=test3#hs=hash