@digitalpersona/core
Version:
DigitalPersona Web Access Core library
37 lines (22 loc) • 1.17 kB
Markdown
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[](./index.md) > [@digitalpersona/core](./core.md) > [Url](./core.url.md) > [(constructor)](./core.url.(constructor).md)
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);
```
| Parameter | Type | Description |
| --- | --- | --- |
| base | <code>string</code> | base URL, e.g. <code>https://contoso.com</code> |
| path | <code>string &
| query | <code>object &
The URL is built by concatenation of a base URL with sanitized path and query object, adding all needed delimiters. 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
```