3.1.2 • Published 3 months ago

@jridgewell/resolve-uri v3.1.2

Weekly downloads
10,635
License
MIT
Repository
github
Last release
3 months ago

@jridgewell/resolve-uri

Resolve a URI relative to an optional base URI

Resolve any combination of absolute URIs, protocol-realtive URIs, absolute paths, or relative paths.

Installation

npm install @jridgewell/resolve-uri

Usage

function resolve(input: string, base?: string): string;
import resolve from '@jridgewell/resolve-uri';

resolve('foo', 'https://example.com'); // => 'https://example.com/foo'
InputBaseResolutionExplanation
https://example.comanyhttps://example.com/Input is normalized only
//example.comhttps://base.com/https://example.com/Input inherits the base's protocol
//example.comrest//example.com/Input is normalized only
/examplehttps://base.com/https://base.com/exampleInput inherits the base's origin
/example//base.com///base.com/exampleInput inherits the base's host and remains protocol relative
/examplerest/exampleInput is normalized only
examplehttps://base.com/dir/https://base.com/dir/exampleInput is joined with the base
examplehttps://base.com/filehttps://base.com/exampleInput is joined with the base without its file
example//base.com/dir///base.com/dir/exampleInput is joined with the base's last directory
example//base.com/file//base.com/exampleInput is joined with the base without its file
example/base/dir//base/dir/exampleInput is joined with the base's last directory
example/base/file/base/exampleInput is joined with the base without its file
examplebase/dir/base/dir/exampleInput is joined with the base's last directory
examplebase/filebase/exampleInput is joined with the base without its file
3.1.2

3 months ago

3.1.1

1 year ago

3.1.0

2 years ago

3.0.8

2 years ago

3.0.7

2 years ago

3.0.6

2 years ago

3.0.4

2 years ago

3.0.3

2 years ago

3.0.2

2 years ago

3.0.1

2 years ago

3.0.5

2 years ago

3.0.0

2 years ago

2.0.0

3 years ago

1.0.0

5 years ago

0.1.0

5 years ago