npm.devtool.tech
👏 You can access @jridgewell/resolve-uri package with using jridgewellResolveUri variable in browser devtools!
Resolve a URI relative to an optional base URI

basic

package
Npm Version
Node Version

popularity

Star
Npm Weekly Downloads
Jsdeliver Month Downloads
Dependents Pkg
Dependents Repo

size

Code Size
Publish Size
Install Size
Minified Size
Gzip Size

quality

Open Issues
Tree Shaking Support
Type Support
Last Commit

health

Package health
Dependency Count
Outdated Dep
Vulnerablities

@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