1.0.0 • Published 11 years ago
url-relative v1.0.0
url-relative
calculate RFC 1808 relative URLs (inverse of url.resolve)
usage
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.
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-relativerunning the tests
From package root:
$ npm install
$ npm testcontributors
- jden jason@denizac.org
license
ISC. (c) MMXV jden jason@denizac.org. See LICENSE.md
1.0.0
11 years ago