UNPKG

@digitalpersona/core

Version:
41 lines (24 loc) 1.2 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; [create](./core.url.create.md) ## Url.create() method Constructs an URL string from a base URL, a path and a query object. <b>Signature:</b> ```typescript static create(base: string, path?: string | null, query?: object | null): string; ``` ## 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> | <b>Returns:</b> `string` ## Remarks The URL is built by concatenation of a base URL with sanitized path and query object, adding all needed delimiters. ## Example ```typescript const href = Url.create("https://contoso.com", "api/v1/user", { name: "john", type: "5" }); console.log(href); ``` `> https://contoso.com/api/v1/user?name=john&type=5`