Projects STRLCPY kitsec-core Files
🤬
..
LICENSE Loading last commit info...
README.md
package.json
README.md

@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
Please wait...
Page is in error, reload to recover