# isValid() function · @imqueue/net

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

Whether a string is a valid IPv4 or IPv6 address.

**Signature:**

```typescript
export declare function isValid(ip: string): boolean;
```

## Parameters


| Parameter | Type | Description |
| --- | --- | --- |
| ip | string | the string to test |


**Returns:**

boolean

`true` for a valid address of either family.

## Remarks

Node's own `net.isIP`, so it accepts a bare address only — `''`, `'unknown'` and `'10.0.0.0/8'` are all `false`, because a prefix length makes it a CIDR record rather than an address. Use this to screen untrusted input before [Networks](https://imqueue.org/api/net/latest/net.networks/), whose constructor throws on anything it cannot parse.

