source: imaps-frontend/node_modules/@jridgewell/resolve-uri/README.md@ d565449

main
Last change on this file since d565449 was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago

Update repo after prototype presentation

  • Property mode set to 100644
File size: 2.8 KB
RevLine 
[d565449]1# @jridgewell/resolve-uri
2
3> Resolve a URI relative to an optional base URI
4
5Resolve any combination of absolute URIs, protocol-realtive URIs, absolute paths, or relative paths.
6
7## Installation
8
9```sh
10npm install @jridgewell/resolve-uri
11```
12
13## Usage
14
15```typescript
16function resolve(input: string, base?: string): string;
17```
18
19```js
20import resolve from '@jridgewell/resolve-uri';
21
22resolve('foo', 'https://example.com'); // => 'https://example.com/foo'
23```
24
25| Input | Base | Resolution | Explanation |
26|-----------------------|-------------------------|--------------------------------|--------------------------------------------------------------|
27| `https://example.com` | _any_ | `https://example.com/` | Input is normalized only |
28| `//example.com` | `https://base.com/` | `https://example.com/` | Input inherits the base's protocol |
29| `//example.com` | _rest_ | `//example.com/` | Input is normalized only |
30| `/example` | `https://base.com/` | `https://base.com/example` | Input inherits the base's origin |
31| `/example` | `//base.com/` | `//base.com/example` | Input inherits the base's host and remains protocol relative |
32| `/example` | _rest_ | `/example` | Input is normalized only |
33| `example` | `https://base.com/dir/` | `https://base.com/dir/example` | Input is joined with the base |
34| `example` | `https://base.com/file` | `https://base.com/example` | Input is joined with the base without its file |
35| `example` | `//base.com/dir/` | `//base.com/dir/example` | Input is joined with the base's last directory |
36| `example` | `//base.com/file` | `//base.com/example` | Input is joined with the base without its file |
37| `example` | `/base/dir/` | `/base/dir/example` | Input is joined with the base's last directory |
38| `example` | `/base/file` | `/base/example` | Input is joined with the base without its file |
39| `example` | `base/dir/` | `base/dir/example` | Input is joined with the base's last directory |
40| `example` | `base/file` | `base/example` | Input is joined with the base without its file |
Note: See TracBrowser for help on using the repository browser.