{"_id":"relative-url","_rev":"7-12febc25e23d83cd68e4909758f8ce9f","name":"relative-url","description":"convert a partial url into an absolute url from your current location.","dist-tags":{"latest":"1.0.2"},"versions":{"1.0.0":{"name":"relative-url","description":"convert a partial url into an absolute url from your current location.","version":"1.0.0","homepage":"https://github.com/dominictarr/relative-url","repository":{"type":"git","url":"git://github.com/dominictarr/relative-url.git"},"dependencies":{},"devDependencies":{"tape":"^4.5.1"},"scripts":{"test":"set -e; for t in test/*.js; do node $t; done"},"author":{"name":"'Dominic Tarr'","email":"dominic.tarr@gmail.com","url":"dominictarr.com"},"license":"MIT","gitHead":"63089673c4b08c10dcd1aaedbe608e9c26d0fda4","bugs":{"url":"https://github.com/dominictarr/relative-url/issues"},"_id":"relative-url@1.0.0","_shasum":"68c680a090f1aaf8b700d9302bcdd0cfabf14013","_from":".","_npmVersion":"3.8.6","_nodeVersion":"5.11.1","_npmUser":{"name":"dominictarr","email":"dominic.tarr@gmail.com"},"dist":{"shasum":"68c680a090f1aaf8b700d9302bcdd0cfabf14013","tarball":"https://registry.npmjs.org/relative-url/-/relative-url-1.0.0.tgz","integrity":"sha512-WEJblwo+n5+CBjWVMfwyWcaVyp7WqQLw7yfbmQBBrVoqtwjg41NIeaLzzHSLHkBrBwYGNggv7PTyDW24MYT/9Q==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIQDrrnkCBFPw0MpiAsV5hRU/rgOc8hwz13+h6CAKbzrepQIfFCTSKGnBQBRyIDjS+unAOVY+RZv8G2jrb/jnV8E6LQ=="}]},"maintainers":[{"name":"dominictarr","email":"dominic.tarr@gmail.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/relative-url-1.0.0.tgz_1464816554025_0.9791025393642485"},"directories":{}},"1.0.1":{"name":"relative-url","description":"convert a partial url into an absolute url from your current location.","version":"1.0.1","homepage":"https://github.com/dominictarr/relative-url","repository":{"type":"git","url":"git://github.com/dominictarr/relative-url.git"},"dependencies":{},"devDependencies":{"tape":"^4.5.1"},"scripts":{"test":"set -e; for t in test/*.js; do node $t; done"},"author":{"name":"'Dominic Tarr'","email":"dominic.tarr@gmail.com","url":"dominictarr.com"},"license":"MIT","gitHead":"4a1ad8e422bec6e3ebcacdefb665b1e9534a1d35","bugs":{"url":"https://github.com/dominictarr/relative-url/issues"},"_id":"relative-url@1.0.1","_shasum":"aacd618d6e149f9f327c34a6d2c7f3a1726e6bd9","_from":".","_npmVersion":"3.8.6","_nodeVersion":"5.11.1","_npmUser":{"name":"dominictarr","email":"dominic.tarr@gmail.com"},"dist":{"shasum":"aacd618d6e149f9f327c34a6d2c7f3a1726e6bd9","tarball":"https://registry.npmjs.org/relative-url/-/relative-url-1.0.1.tgz","integrity":"sha512-Y1JqqHx3twPyaHEjwScKwLSFFyioX/dBN3zhIKw7IB98uPrEU5GnQ/c/lRto5gGQhMwv0sAY2ueTvxbXWuaR7w==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCp6dPKULlub41zNLm1NNnSw2P5ZAOuLF70oRd65cA1rAIhAI3Q7oOCgJtPvpyXrbayisMWZSnWuwOvd6i8CeiZ6Ztk"}]},"maintainers":[{"name":"dominictarr","email":"dominic.tarr@gmail.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/relative-url-1.0.1.tgz_1464820872553_0.9257475782651454"},"directories":{}},"1.0.2":{"name":"relative-url","description":"convert a partial url into an absolute url from your current location.","version":"1.0.2","homepage":"https://github.com/dominictarr/relative-url","repository":{"type":"git","url":"git://github.com/dominictarr/relative-url.git"},"dependencies":{},"devDependencies":{"tape":"^4.5.1"},"scripts":{"test":"set -e; for t in test/*.js; do node $t; done"},"author":{"name":"'Dominic Tarr'","email":"dominic.tarr@gmail.com","url":"dominictarr.com"},"license":"MIT","gitHead":"1650c32adfd987a4edba68eb3748b55a83695981","bugs":{"url":"https://github.com/dominictarr/relative-url/issues"},"_id":"relative-url@1.0.2","_shasum":"d21c52a72d6061018bcee9f9c9fc106bf7d65287","_from":".","_npmVersion":"3.8.6","_nodeVersion":"5.11.1","_npmUser":{"name":"dominictarr","email":"dominic.tarr@gmail.com"},"dist":{"shasum":"d21c52a72d6061018bcee9f9c9fc106bf7d65287","tarball":"https://registry.npmjs.org/relative-url/-/relative-url-1.0.2.tgz","integrity":"sha512-jI1AmBVFFMXwQ3I6tIYVmVOjy8f+ogHbqkeb8/LL9tszEQiTV8I0l8XT4oEomUOoxfm698f92gYlNKeA/9LJVQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIAOReK9Pipk6+UAdrSZxqpr0WIie8fMZJ8K6tPILcZeFAiEA+56utJzeFSET8aE7TDdRxGns7FT+1wQ3dTvnAVf30Z0="}]},"maintainers":[{"name":"dominictarr","email":"dominic.tarr@gmail.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/relative-url-1.0.2.tgz_1465427322998_0.9249375476501882"},"directories":{}}},"readme":"# relative-url\n\nconvert a partial url into an absolute url from your current\nlocation.\n\nIn the WebSocket api, it expects a fully qualified url,\nbut this is awkward because we want to develop on localhost,\nand then deploy to a server with a proper domain,\nwith a different port.\n\nWe want to create a WebSocket at a path, and get whatever domain\nwe are on.\n\nThis module generalized [wsurl](https://www.npmjs.com/package/wsurl)\n\n## api: rurl(url, location, protocolMap, defaultProtocol)\n\n`url` is your partial url, it will be described below.\n`location` should be your is `window.location` or the output\nof `require('url').parse(absoluteUrl)`\n\nif you want to change the protocol, protocol map is a object\nmapping current to desired protocol.\n\nfor websockets, you'll probably want: `{http: 'ws', https: 'wss'}`\n\n`defaultProtocol` is what to set the protocol to otherwise.\nfor example, `'ws'` if `defaultProtocol` is not provided\nthe output protocol will the the same as `location.protocol`\n\n## examples\n\nfor the following location:\n``` js\nvar location = {\n  protocol: 'http',\n  host: 'server.com',\n  pathname '/foo'\n} //OR get this from window.location\n\nvar protocolMap = {http: 'ws', https: 'wss'}\n\nvar defaultProtocol : 'ws'\n\nvar rurl = require('relative-url')\nfunction relative (url) {\n  return rurl(url, location, protocolMap, defaultProtocol) \n}\n\n\n```\nand the above mentioned settings (suitable for websockets)\noutput will be as following.\n``` js\n\nrelative('/')            // => ws://server.com/\nrelative('/bar')         // => ws://server.com/bar\nrelative('//client.com') // => ws://client.com/\nrelative('//:9999')      // => ws://server.com:9999/\nrelative('?q=search'     // => ws://server.com/foo?q=search\n```\n\nnote that // denotes the start of the host.\nif you want to set the port without changing the domain,\nyou must still use // otherwise the url module will\nthink it's a path. I considered detecting that,\nbut then i saw [this comment](https://github.com/nodejs/node/blob/master/lib/url.js#L207-L220)\nand got scared of learning too much about urls.\n\n## License\n\nMIT\n\n\n\n\n\n\n\n\n\n\n\n\n\n","maintainers":[{"email":"nopersonsmodules@gmail.com","name":"nopersonsmodules"}],"time":{"modified":"2022-06-26T10:54:13.833Z","created":"2016-06-01T21:29:14.450Z","1.0.0":"2016-06-01T21:29:14.450Z","1.0.1":"2016-06-01T22:41:13.023Z","1.0.2":"2016-06-08T23:08:43.512Z"},"homepage":"https://github.com/dominictarr/relative-url","repository":{"type":"git","url":"git://github.com/dominictarr/relative-url.git"},"author":{"name":"'Dominic Tarr'","email":"dominic.tarr@gmail.com","url":"dominictarr.com"},"bugs":{"url":"https://github.com/dominictarr/relative-url/issues"},"license":"MIT","readmeFilename":"README.md"}