source: trip-planner-front/node_modules/@jridgewell/resolve-uri/README.md@ 6a3a178

Last change on this file since 6a3a178 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

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