{"_id":"relateurl","_rev":"196805","name":"relateurl","description":"Minify URLs by converting them from absolute to relative.","dist-tags":{"latest":"0.2.7"},"maintainers":[{"name":"stevenvachon","email":"contact@svachon.com"}],"time":{"modified":"2021-06-03T12:29:51.000Z","created":"2014-03-28T01:44:28.779Z","0.2.7":"2016-07-14T13:31:25.910Z","0.2.6":"2014-12-17T03:31:41.034Z","0.2.5":"2014-08-13T18:41:29.230Z","0.2.4":"2014-08-05T17:28:41.165Z","0.2.3":"2014-08-05T02:28:53.988Z","0.2.2":"2014-05-23T19:42:41.170Z","0.2.1":"2014-04-05T01:04:14.937Z","0.2.0":"2014-04-01T21:06:37.071Z","0.1.0":"2014-03-28T01:44:28.779Z"},"users":{"rubiadias":true,"gormus":true},"author":{"name":"Steven Vachon","email":"contact@svachon.com","url":"http://www.svachon.com/"},"repository":{"type":"git","url":"git://github.com/stevenvachon/relateurl.git"},"versions":{"0.2.7":{"name":"relateurl","description":"Minify URLs by converting them from absolute to relative.","version":"0.2.7","license":"MIT","homepage":"https://github.com/stevenvachon/relateurl","author":{"name":"Steven Vachon","email":"contact@svachon.com","url":"http://www.svachon.com/"},"main":"lib","repository":{"type":"git","url":"git://github.com/stevenvachon/relateurl.git"},"bugs":{"url":"https://github.com/stevenvachon/relateurl/issues"},"devDependencies":{"browserify":"^13.0.1","chai":"^3.5.0","mocha":"^2.5.3","uglify-js":"^2.7.0"},"engines":{"node":">= 0.10"},"scripts":{"browserify":"browserify lib/ --standalone RelateUrl | uglifyjs --compress --mangle -o relateurl-browser.js","test":"mocha test/ --bail --reporter spec --check-leaks"},"files":["lib","license"],"keywords":["uri","url","minifier","minify","lint","relative","absolute"],"gitHead":"65498004d9663fc320c22ffe9204f3c2e59ab65a","_id":"relateurl@0.2.7","_shasum":"54dbf377e51440aca90a4cd274600d3ff2d888a9","_from":".","_npmVersion":"3.10.3","_nodeVersion":"6.3.0","_npmUser":{"name":"stevenvachon","email":"contact@svachon.com"},"dist":{"shasum":"54dbf377e51440aca90a4cd274600d3ff2d888a9","size":9716,"noattachment":false,"key":"/relateurl/-/relateurl-0.2.7.tgz","tarball":"http://registry.cnpm.dingdandao.com/relateurl/download/relateurl-0.2.7.tgz"},"maintainers":[{"name":"stevenvachon","email":"contact@svachon.com"}],"_npmOperationalInternal":{"host":"packages-16-east.internal.npmjs.com","tmp":"tmp/relateurl-0.2.7.tgz_1468503083573_0.04723989125341177"},"directories":{},"publish_time":1468503085910,"_cnpm_publish_time":1468503085910,"_hasShrinkwrap":false},"0.2.6":{"name":"relateurl","description":"Minify URLs by converting them from absolute to relative.","version":"0.2.6","homepage":"https://github.com/stevenvachon/relateurl","author":{"name":"Steven Vachon","email":"contact@svachon.com","url":"http://www.svachon.com/"},"main":"lib","repository":{"type":"git","url":"git://github.com/stevenvachon/relateurl.git"},"bugs":{"url":"https://github.com/stevenvachon/relateurl/issues"},"licenses":[{"type":"MIT","url":"https://github.com/stevenvachon/relateurl/blob/master/LICENSE"}],"devDependencies":{"browserify":"^7.0.1","chai":"^1.10","mocha":"^2.0.1","uglify-js":"^2.4.16"},"engines":{"node":">= 0.10"},"scripts":{"browserify":"browserify lib/ --standalone RelateUrl | uglifyjs --compress --mangle -o relateurl-browser.js","test":"mocha test/ --bail --reporter spec --check-leaks"},"files":["lib"],"keywords":["uri","url","minifier","minify","lint","relative","absolute"],"gitHead":"2f82027181cdbb53cdd782edc625e97ff21eda3b","_id":"relateurl@0.2.6","_shasum":"9fc22635971091c5ea5133c736e3468e79e2aaf9","_from":"../../var/folders/13/6g4pgfvj72b7j3yny2n0sr1c0000gn/T/npm-31920-8cea5136/1418786989250-0.26757102250121534/2f82027181cdbb53cdd782edc625e97ff21eda3b","_resolved":"git://github.com/stevenvachon/relateurl.git#2f82027181cdbb53cdd782edc625e97ff21eda3b","_npmVersion":"2.1.12","_nodeVersion":"0.11.14","_npmUser":{"name":"stevenvachon","email":"contact@svachon.com"},"maintainers":[{"name":"stevenvachon","email":"contact@svachon.com"}],"dist":{"shasum":"9fc22635971091c5ea5133c736e3468e79e2aaf9","size":9502,"noattachment":false,"key":"/relateurl/-/relateurl-0.2.6.tgz","tarball":"http://registry.cnpm.dingdandao.com/relateurl/download/relateurl-0.2.6.tgz"},"directories":{},"publish_time":1418787101034,"_cnpm_publish_time":1418787101034,"_hasShrinkwrap":false},"0.2.5":{"name":"relateurl","description":"Minify URLs by converting them from absolute to relative.","version":"0.2.5","homepage":"https://github.com/stevenvachon/relateurl","author":{"name":"Steven Vachon","email":"contact@svachon.com","url":"http://www.svachon.com/"},"main":"lib","repository":{"type":"git","url":"git://github.com/stevenvachon/relateurl.git"},"bugs":{"url":"https://github.com/stevenvachon/relateurl/issues"},"devDependencies":{"browserify":"^5.9","chai":"^1.9","mocha":"^1.21","uglify-js":"^2.4"},"engines":{"node":">= 0.10"},"scripts":{"browserify":"browserify lib/ --standalone RelateUrl | uglifyjs --compress --mangle -o relateurl-browser.js","test":"mocha test/ --bail --reporter spec --check-leaks"},"files":["lib"],"keywords":["url","minifier","minify","lint","relative","absolute"],"_id":"relateurl@0.2.5","_shasum":"c0e489b7beb8d7a9db371260e224ed86a1bdd482","_resolved":"git://github.com/stevenvachon/relateurl.git#2816c1c465d9bba2d1608e1a825693c0064233ed","_npmVersion":"1.4.9","_npmUser":{"name":"stevenvachon","email":"contact@svachon.com"},"maintainers":[{"name":"stevenvachon","email":"contact@svachon.com"}],"dist":{"shasum":"c0e489b7beb8d7a9db371260e224ed86a1bdd482","size":15781,"noattachment":false,"key":"/relateurl/-/relateurl-0.2.5.tgz","tarball":"http://registry.cnpm.dingdandao.com/relateurl/download/relateurl-0.2.5.tgz"},"directories":{},"publish_time":1407955289230,"_cnpm_publish_time":1407955289230,"_hasShrinkwrap":false},"0.2.4":{"name":"relateurl","description":"Minify URLs by converting them from absolute to relative.","version":"0.2.4","homepage":"https://github.com/stevenvachon/relateurl","author":{"name":"Steven Vachon","email":"contact@svachon.com","url":"http://www.svachon.com/"},"main":"lib","repository":{"type":"git","url":"git://github.com/stevenvachon/relateurl.git"},"bugs":{"url":"https://github.com/stevenvachon/relateurl/issues"},"devDependencies":{"browserify":"^5.9","chai":"^1.9","mocha":"^1.21","uglify-js":"^2.4"},"engines":{"node":">= 0.6.0"},"scripts":{"browserify":"browserify lib/ --standalone RelateUrl | uglifyjs --compress --mangle -o relateurl-browser.js","test":"mocha test/ --bail --reporter spec --check-leaks"},"keywords":["url","minifier","minify","lint","relative","absolute"],"_id":"relateurl@0.2.4","_shasum":"43776bec79ce2f1c88c9909511efcb060f0c096a","_resolved":"git://github.com/stevenvachon/relateurl.git#9b2e7731ef0df3d8d064ff5650b06557ebf804d6","_npmVersion":"1.4.9","_npmUser":{"name":"stevenvachon","email":"contact@svachon.com"},"maintainers":[{"name":"stevenvachon","email":"contact@svachon.com"}],"dist":{"shasum":"43776bec79ce2f1c88c9909511efcb060f0c096a","size":15617,"noattachment":false,"key":"/relateurl/-/relateurl-0.2.4.tgz","tarball":"http://registry.cnpm.dingdandao.com/relateurl/download/relateurl-0.2.4.tgz"},"directories":{},"publish_time":1407259721165,"_cnpm_publish_time":1407259721165,"_hasShrinkwrap":false},"0.2.3":{"name":"relateurl","description":"Minify URLs by converting them from absolute to relative.","version":"0.2.3","homepage":"https://github.com/stevenvachon/relateurl","author":{"name":"Steven Vachon","email":"contact@svachon.com","url":"http://www.svachon.com/"},"main":"lib","repository":{"type":"git","url":"git://github.com/stevenvachon/relateurl.git"},"bugs":{"url":"https://github.com/stevenvachon/relateurl/issues"},"devDependencies":{"browserify":"^5.9","chai":"^1.9","mocha":"^1.21","uglify-js":"^2.4"},"engines":{"node":">= 0.6.0"},"scripts":{"browserify":"browserify lib/ --standalone RelateUrl | uglifyjs --compress --mangle -o relateurl-browser.js","test":"mocha test/ --bail --reporter spec --check-leaks"},"keywords":["url","minifier","minify","lint","relative","absolute"],"_id":"relateurl@0.2.3","_shasum":"68697bd6cb4ddf6de17527b1d49e5922a8780c95","_resolved":"git://github.com/stevenvachon/relateurl.git#e4998c78e19ec5dd57324e74a1b93234993f0872","_npmVersion":"1.4.9","_npmUser":{"name":"stevenvachon","email":"contact@svachon.com"},"maintainers":[{"name":"stevenvachon","email":"contact@svachon.com"}],"dist":{"shasum":"68697bd6cb4ddf6de17527b1d49e5922a8780c95","size":15060,"noattachment":false,"key":"/relateurl/-/relateurl-0.2.3.tgz","tarball":"http://registry.cnpm.dingdandao.com/relateurl/download/relateurl-0.2.3.tgz"},"directories":{},"publish_time":1407205733988,"_cnpm_publish_time":1407205733988,"_hasShrinkwrap":false},"0.2.2":{"name":"relateurl","description":"Minify URLs by converting them from absolute to relative.","version":"0.2.2","homepage":"https://github.com/stevenvachon/relateurl","author":{"name":"Steven Vachon","email":"contact@svachon.com","url":"http://www.svachon.com/"},"main":"lib","repository":{"type":"git","url":"git://github.com/stevenvachon/relateurl.git"},"bugs":{"url":"https://github.com/stevenvachon/relateurl/issues"},"devDependencies":{"chai":"~1.9","mocha":"~1.18"},"engines":{"node":">= 0.6.0"},"scripts":{"test":"node node_modules/mocha/bin/mocha test/ --bail --reporter spec --check-leaks"},"keywords":["url","minifier","minify","lint","relative","absolute"],"_id":"relateurl@0.2.2","_shasum":"be1687b1bf6a593665aee8cc319c2a5e2b4f1bb3","_resolved":"git://github.com/stevenvachon/relateurl#b0db175fa7ada068662eb7db0bf01f34e12cf0d4","_npmVersion":"1.4.9","_npmUser":{"name":"stevenvachon","email":"contact@svachon.com"},"maintainers":[{"name":"stevenvachon","email":"contact@svachon.com"}],"dist":{"shasum":"be1687b1bf6a593665aee8cc319c2a5e2b4f1bb3","size":14984,"noattachment":false,"key":"/relateurl/-/relateurl-0.2.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/relateurl/download/relateurl-0.2.2.tgz"},"directories":{},"publish_time":1400874161170,"_cnpm_publish_time":1400874161170,"_hasShrinkwrap":false},"0.2.1":{"name":"relateurl","description":"Minify URLs by converting them from absolute to relative.","version":"0.2.1","homepage":"https://github.com/stevenvachon/relateurl","author":{"name":"Steven Vachon","email":"contact@svachon.com","url":"http://www.svachon.com/"},"main":"lib","repository":{"type":"git","url":"git://github.com/stevenvachon/relateurl.git"},"bugs":{"url":"https://github.com/stevenvachon/relateurl/issues"},"devDependencies":{"chai":"~1.9","grunt":"~0.4","grunt-mocha-test":"~0.9"},"engines":{"node":">= 0.6.0"},"keywords":["url","minifier","minify","lint","relative","absolute"],"_id":"relateurl@0.2.1","dist":{"shasum":"8ad89062fbd5fc3aef5616cc50e671968cde6eba","size":8659,"noattachment":false,"key":"/relateurl/-/relateurl-0.2.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/relateurl/download/relateurl-0.2.1.tgz"},"_resolved":"git://github.com/stevenvachon/relateurl.git#b8f1744034b794f9ec48e5c1f0ddaad5c8aab068","scripts":{},"_npmVersion":"1.4.3","_npmUser":{"name":"stevenvachon","email":"contact@svachon.com"},"maintainers":[{"name":"stevenvachon","email":"contact@svachon.com"}],"directories":{},"publish_time":1396659854937,"_cnpm_publish_time":1396659854937,"_hasShrinkwrap":false},"0.2.0":{"name":"relateurl","description":"Shorten URLs by converting them from absolute to relative.","version":"0.2.0","homepage":"https://github.com/stevenvachon/relateurl","author":{"name":"Steven Vachon","email":"contact@svachon.com","url":"http://www.svachon.com/"},"main":"lib","repository":{"type":"git","url":"git://github.com/stevenvachon/relateurl.git"},"bugs":{"url":"https://github.com/stevenvachon/relateurl/issues"},"devDependencies":{"chai":"~1.9","grunt":"~0.4","grunt-mocha-test":"~0.9"},"engines":{"node":">= 0.6.0"},"keywords":["absolute","relative","minify","shorten","url"],"_id":"relateurl@0.2.0","dist":{"shasum":"3d2a6f563c641df178901070a63aaa098e1a3e2b","size":8167,"noattachment":false,"key":"/relateurl/-/relateurl-0.2.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/relateurl/download/relateurl-0.2.0.tgz"},"_resolved":"git://github.com/stevenvachon/relateurl.git#a44a67ff61e4409e5c5e77c5c5d5897307c58b80","scripts":{},"_npmVersion":"1.4.3","_npmUser":{"name":"stevenvachon","email":"contact@svachon.com"},"maintainers":[{"name":"stevenvachon","email":"contact@svachon.com"}],"directories":{},"publish_time":1396386397071,"_cnpm_publish_time":1396386397071,"_hasShrinkwrap":false},"0.1.0":{"name":"relateurl","description":"Shorten URLs by converting them from absolute to relative.","version":"0.1.0","homepage":"https://github.com/stevenvachon/relateurl","author":{"name":"Steven Vachon","email":"contact@svachon.com","url":"http://www.svachon.com/"},"main":"lib","repository":{"type":"git","url":"git://github.com/stevenvachon/relateurl.git"},"bugs":{"url":"https://github.com/stevenvachon/relateurl/issues"},"devDependencies":{"chai":"~1.9","grunt":"~0.4","grunt-mocha-test":"~0.9"},"engines":{"node":">= 0.6.0"},"keywords":["absolute","relative","shorten","url"],"_id":"relateurl@0.1.0","dist":{"shasum":"3fd186c93250b7bd39b82e5873bfe558629bdfc6","size":7900,"noattachment":false,"key":"/relateurl/-/relateurl-0.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/relateurl/download/relateurl-0.1.0.tgz"},"_resolved":"git://github.com/stevenvachon/relateurl.git#b1a68ad14282e8ec3bcc5f44ceb91f834700b030","scripts":{},"_npmVersion":"1.4.3","_npmUser":{"name":"stevenvachon","email":"contact@svachon.com"},"maintainers":[{"name":"stevenvachon","email":"contact@svachon.com"}],"directories":{},"publish_time":1395971068779,"_cnpm_publish_time":1395971068779,"_hasShrinkwrap":false}},"readme":"# relateurl [![NPM Version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Dependency Status][david-image]][david-url]\n\n> Minify URLs by converting them from absolute to relative.\n\nIf you were to use this library on a website like `http://example.com/dir1/dir1-1/`, you would get results such as:\n\n| Before                                      | After                                |\n| :------------------------------------------ | :----------------------------------- |\n| `http://example.com/dir1/dir1-2/index.html` | `../dir1-2/`                         |\n| `http://example.com/dir2/dir2-1/`           | `/dir2/dir2-1/`                      |\n| `http://example.com/dir1/dir1-1/`           | ` `                                  |\n| `https://example.com/dir1/dir1-1/`          | `https://example.com/dir1/dir1-1/`   |\n| `http://google.com:80/dir/`                 | `//google.com/dir/`                  |\n| `../../../../../../../../#anchor`           | `/#anchor`                           |\n\n**All string parsing.** *No* directory browsing. It is thoroughly tested, very fast and lightweight with zero external dependencies.\n\n## Getting Started\n\nThis utility requires [Node.js](http://nodejs.org/) `>= 0.10`. To install, type this at the command line:\n```\nnpm install relateurl --save-dev\n```\n\n### Options\n\n#### options.defaultPorts\nType: `Object`   \nDefault value: `{ftp:21, http:80, https:443}`  \n\nExtend the list with any ports you need. Any URLs containing these default ports will have them removed. Example: `http://example.com:80/` will become `http://example.com/`.\n\n#### options.directoryIndexes\nType: `Array`   \nDefault value: `[\"index.html\"]`  \n\nExtend the list with any resources you need. Works with [`options.removeDirectoryIndexes`](#options.removeDirectoryIndexes).\n\n#### options.ignore_www\nType: `Boolean`  \nDefault value: `false`  \n\nThis will, for example, consider any domains containing `http://www.example.com/` to be related to any that contain `http://example.com/`.\n\n#### options.output\nType: constant or `String`  \nChoices: `RelateUrl.ABSOLUTE`,`RelateUrl.PATH_RELATIVE`,`RelateUrl.ROOT_RELATIVE`,`RelateUrl.SHORTEST`  \nChoices: `\"absolute\"`,`\"pathRelative\"`,`\"rootRelative\"`,`\"shortest\"`  \nDefault value: `RelateUrl.SHORTEST`  \n\n`RelateUrl.ABSOLUTE` will produce an absolute URL. Overrides [`options.schemeRelative`](#options.schemeRelative) with a value of `false`.  \n`RelateUrl.PATH_RELATIVE` will produce something like `../child-of-parent/etc/`.  \n`RelateUrl.ROOT_RELATIVE` will produce something like `/child-of-root/etc/`.  \n`RelateUrl.SHORTEST` will choose whichever is shortest between root- and path-relative.  \n\n#### options.rejectedSchemes\nType: `Array`   \nDefault value: `[\"data\",\"javascript\",\"mailto\"]`  \n\nExtend the list with any additional schemes. Example: `javascript:something` will not be modified.\n\n#### options.removeAuth\nType: `Boolean`   \nDefault value: `false`  \n\nRemove user authentication information from the output URL.\n\n#### options.removeDirectoryIndexes\nType: `Boolean`   \nDefault value: `true`  \n\nRemove any resources that match any found in [`options.directoryIndexes`](#options.directoryIndexes).\n\n#### options.removeEmptyQueries\nType: `Boolean`   \nDefault value: `false`  \n\nRemove empty query variables. Example: `http://domain.com/?var1&var2=&var3=asdf` will become `http://domain.com/?var3=adsf`. This does not apply to unrelated URLs (with other protocols, auths, hosts and/or ports).\n\n#### options.removeRootTrailingSlash\nType: `Boolean`   \nDefault value: `true`  \n\nRemove trailing slashes from root paths. Example: `http://domain.com/?var` will become `http://domain.com?var` while `http://domain.com/dir/?var` will not be modified.\n\n#### options.schemeRelative\nType: `Boolean`   \nDefault value: `true`  \n\nOutput URLs relative to the scheme. Example: `http://example.com/` will become `//example.com/`.\n\n#### options.site\nType: `String`   \nDefault value: `undefined`  \n\nAn options-based version of the [`from`](#examples) argument. If both are specified, `from` takes priority.\n\n#### options.slashesDenoteHost\nType: `Boolean`   \nDefault value: `true`  \n\nPassed to Node's [`url.parse`](http://nodejs.org/api/url.html#url_url_parse_urlstr_parsequerystring_slashesdenotehost).\n\n### Examples\nThis library can be used as a [function for single-use](#single-instance) or as a [class for multiple conversions](#reusable-instances).\n\nUpon successful conversion, a `String` will be returned. If an issue is encountered while parsing `from`, an error will be thrown.\n\n#### Single Instance\n```js\nvar RelateUrl = require(\"relateurl\");\n\nvar result = RelateUrl.relate(from, to, options);\n```\n\n#### Reusable Instances\n```js\nvar RelateUrl = require(\"relateurl\");\n\nvar instance = new RelateUrl(from, options);\n\nvar result1 = instance.relate(to1);\nvar result2 = instance.relate(to2, customOptions);\nvar result3 = instance.relate(to3);\n```\n\n## FAQ\n1. **Why bother writing/using this?**  \nTo aid in further minifying HTML, mainly for the purpose of faster page loads and SEO. It's been integrated into [HTMLMinifier](https://github.com/kangax/html-minifier).\n\n2. **Why not just use Node's `url.parse`, `url.resolve` and `path.relative`?**  \n`url.parse` *is* used, but `url.resolve` and `path.relative` are both slower and less powerful than this library.\n\n\n## Release History\n* 0.2.7 Node v6 support\n* 0.2.6 minor enhancements\n* 0.2.5 added `options.removeRootTrailingSlash`\n* 0.2.4 added `options.site`\n* 0.2.3 added browserify npm-script\n* 0.2.2 removed task runner\n* 0.2.1 shorten resource- and query-relative URLs, test variations list with other site URLs\n* 0.2.0 code cleanup, `options.removeEmptyQueries=true` only applied to unrelated URLs\n* 0.1.0 initial release\n\n\n## Roadmap\n* 0.2.8 check if queries are the same, regardless of param order\n* 0.2.8 possible [scheme exclusions](http://www.iana.org/assignments/uri-schemes/uri-schemes.xhtml) such as `tel:`\n* 0.2.8 decipher and return invalid input (special cases) to complete test suite\n* 0.3.0 test `options.slashesDenoteHost=false`, add something like `options.externalDirectoryIndexes=[]` for external sites\n\n\n[npm-image]: https://img.shields.io/npm/v/relateurl.svg\n[npm-url]: https://npmjs.org/package/relateurl\n[travis-image]: https://img.shields.io/travis/stevenvachon/relateurl.svg\n[travis-url]: https://travis-ci.org/stevenvachon/relateurl\n[david-image]: https://img.shields.io/david/stevenvachon/relateurl.svg\n[david-url]: https://david-dm.org/stevenvachon/relateurl\n","_attachments":{},"homepage":"https://github.com/stevenvachon/relateurl","bugs":{"url":"https://github.com/stevenvachon/relateurl/issues"},"license":"MIT"}