Networks.includes() method

Whether an address falls inside any network in this set.

Signature:

includes(ip: string): boolean;

Parameters

Parameter

Type

Description

ip

string

a bare address of either family, with no /prefix

Returns:

boolean

true if some network contains it.

Exceptions

TypeError if ip is not a valid address. An empty string throws rather than returning false, so screen untrusted input with isValid() first — this is the call @imqueue/http-protect guards for that reason.

Remarks

Dispatches on the address's own family and asks only that list, so an IPv6 lookup costs nothing on a v4-only set. A family this set has no networks for answers false.

Read this page as plain markdown — no HTML, no navigation. For pasting into an LLM, or for an agent to fetch.