# validate() function · @imqueue/net

Source: https://imqueue.org/api/net/latest/net.validate/
Published: 2026-08-01
Author: @imqueue maintainers (https://github.com/imqueue)
Package: @imqueue/net 3.0.2 — generated reference, not hand-written

Asserts that a string is a valid address of either family.

**Signature:**

```typescript
export declare function validate(ip: string): void;
```

## Parameters


| Parameter | Type | Description |
| --- | --- | --- |
| ip | string | the string to check |


**Returns:**

void

Nothing. It either passes or throws.

## Exceptions

TypeError `'Given network address "<ip>" is invalid!'`

## Remarks

The throwing counterpart of [isValid()](https://imqueue.org/api/net/latest/net.isvalid/), used internally before conversion. Prefer [isValid()](https://imqueue.org/api/net/latest/net.isvalid/) when a bad address is an expected input rather than a programming error.

