GitXplorerGitXplorer
j

resolve-uri

public
11 stars
7 forks
17 issues

Commits

List of commits on branch main.
Unverified
caa7a299d6c688570773c81732f77d3c7035ded6

3.1.2

jjridgewell committed 7 months ago
Verified
e4b1e34cac37560ff5081526c90723277adce5d5

Merge pull request #120 from sapphi-red/main

jjridgewell committed 7 months ago
Unverified
3b69ba039a83ffa4314a9dbe7ec0565c3ac35d31

Use const enum for UrlType

ssapphi-red committed 7 months ago
Unverified
8189d8d3a10bccc7c7b425ca07aeb86999e90bcb

3.1.1

jjridgewell committed a year ago
Unverified
45e34173fb851afc895c7145d80a92a8cf6c6b67

Use types instead of typings

jjridgewell committed a year ago
Unverified
7cc23209430909a54f44b740e07cb27573535c95

3.1.0

jjridgewell committed 2 years ago

README

The README file for this repository.

@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'
Input Base Resolution Explanation
https://example.com any https://example.com/ Input is normalized only
//example.com https://base.com/ https://example.com/ Input inherits the base's protocol
//example.com rest //example.com/ Input is normalized only
/example https://base.com/ https://base.com/example Input inherits the base's origin
/example //base.com/ //base.com/example Input inherits the base's host and remains protocol relative
/example rest /example Input is normalized only
example https://base.com/dir/ https://base.com/dir/example Input is joined with the base
example https://base.com/file https://base.com/example Input is joined with the base without its file
example //base.com/dir/ //base.com/dir/example Input is joined with the base's last directory
example //base.com/file //base.com/example Input is joined with the base without its file
example /base/dir/ /base/dir/example Input is joined with the base's last directory
example /base/file /base/example Input is joined with the base without its file
example base/dir/ base/dir/example Input is joined with the base's last directory
example base/file base/example Input is joined with the base without its file