Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/junosuarez/url-relative
calculate RFC 1808 relative URLs (inverse of url.resolve)
https://github.com/junosuarez/url-relative
Last synced: 8 days ago
JSON representation
calculate RFC 1808 relative URLs (inverse of url.resolve)
- Host: GitHub
- URL: https://github.com/junosuarez/url-relative
- Owner: junosuarez
- License: isc
- Created: 2015-01-27T08:36:21.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2021-02-21T19:39:47.000Z (over 3 years ago)
- Last Synced: 2024-10-30T16:51:47.305Z (15 days ago)
- Language: JavaScript
- Size: 25.4 KB
- Stars: 3
- Watchers: 1
- Forks: 5
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# url-relative
calculate RFC 1808 relative URLs (inverse of url.resolve)## NOTE:
I no longer am able to support this package; please use it at your own risk, as is. I recommend switching to an alternative.## usage
```js
var urlRelative = require('url-relative')urlRelative('http://foo.com/a/b','http://foo.com/c/d')
// => '../c/d'urlRelative('/a/b', '/a/b/c')
// => 'b/c'
```## api
### `urlRelative : (from : String, to : String) => String`
Returns the shortest relative URL difference between a `from` and a `to` URL. Relative URLs are described in [RFC 1808](https://tools.ietf.org/html/rfc1808).`from` and `two` can be full URLs (e.g. `http://foo.com/bar`), network location URLs (protocol-relative, e.g. `//foo.com/bar`), or absolute path URLs (e.g. `/bar`).
## installation
$ npm install url-relative
## running the tests
From package root:
$ npm install
$ npm test## contributors
- jden
## license
ISC. (c) MMXV jden . See LICENSE.md