Skip to Content

joinUrlPath()

joinUrlPath(base, path?): string

Defined in: utils/joinUrlPath.ts:23 

Joins a base URL and a path with one slash, as an explorer URL may end in a slash and a path may start with one.

Parameters

base

string

The base URL.

path?

string

The path. Without it the base comes back as it is.

Returns

string

The joined URL.

Example

joinUrlPath('https://etherscan.io/', '/tx/0x1'); // "https://etherscan.io/tx/0x1"
Last updated on