Home > @opengovsg/validators > RelUrlValidator > (constructor)
RelUrlValidator.(constructor)
Creates a new RelUrlValidator instance which only allows relative URLs.
Signature:
typescript
constructor(origin: string | URL);Parameters
| Parameter | Type | Description |
|---|---|---|
| origin | string | URL | The base origin against which relative URLs will be resolved. Must be a valid absolute URL (e.g., 'https://example.com'). |
Exceptions
TypeError If the provided origin is not a valid URL.