UNPKG

@digitalpersona/core

Version:
37 lines (22 loc) 1.17 kB
<!-- Do not edit this file. It is automatically generated by API Documenter. --> [Home](./index.md) &gt; [@digitalpersona/core](./core.md) &gt; [Url](./core.url.md) &gt; [(constructor)](./core.url.(constructor).md) ## Url.(constructor) Constructs an URL object from a base URL, a path and a query object. <b>Signature:</b> ```typescript constructor(base: string, path?: string | null, query?: object | null); ``` ## Parameters | Parameter | Type | Description | | --- | --- | --- | | base | <code>string</code> | base URL, e.g. <code>https://contoso.com</code> | | path | <code>string &#124; null</code> | optional path, e.g. <code>api/v1/user</code> | | query | <code>object &#124; null</code> | optional set of query parameters, e.g. <code>{ name: &quot;john&quot;, type: &quot;5&quot; }</code> | ## Remarks The URL is built by concatenation of a base URL with sanitized path and query object, adding all needed delimiters. Example: ## Example ``` const url = new Url("https://contoso.com", "api/v1/user", { name: "john", type: "5" }); console.log(url.href); > https://contoso.com/api/v1/user?name=john&type=5 ```