# url-relative

> calculate RFC 1808 relative URLs (inverse of url.resolve)

Latest version **1.0.0** (published 2015-01-27) · ISC license · 0 weekly downloads

## Install

```sh
npm install url-relative
pnpm add url-relative
yarn add url-relative
bun add url-relative
```

## Health

**Score 5/100 (F)** — status: abandoned.

Warnings: low downloads; no types; no esm support; has vulnerabilities.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2015-01-27 |
| First published | 2015-01-27 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 1 |
| Install scripts | no |
| GitHub stars | 3 |
| Author | jden |
| Maintainers | jden |
| Keywords | url, uri, relative, resolve |

## Links

- npm: https://www.npmjs.com/package/url-relative
- Repository: git@github.com:jden/url-relative
- Homepage: https://github.com/jden/url-relative
- Issues: https://github.com/jden/url-relative/issues
- npm.io page: https://npm.io/package/url-relative

## Alternatives

- [base64url](https://npm.io/package/base64url.md) — 6.1M weekly downloads
- [get-installed-path](https://npm.io/package/get-installed-path.md) — 502.9K weekly downloads
- [@uppy/url](https://npm.io/package/@uppy/url.md) — 185.8K weekly downloads
- [@d3fc/d3fc-shape](https://npm.io/package/@d3fc/d3fc-shape.md) — 16.2K weekly downloads
- [localizer](https://npm.io/package/localizer.md) — 226 weekly downloads

## Recent versions

- 1.0.0 (latest) — 2015-01-27

## README

# url-relative
calculate RFC 1808 relative URLs (inverse of url.resolve)

## 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 <jason@denizac.org>


## license

ISC. (c) MMXV jden <jason@denizac.org>. See LICENSE.md

---
_Source: https://npm.io/package/url-relative · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
