NetworkList.includes() method

Whether an address falls inside any network in this list.

Signature:

includes(ip: string): boolean;

Parameters

Parameter

Type

Description

ip

string

a bare address, with no /prefix

Returns:

boolean

true if some network contains it.

Exceptions

TypeError if ip is not a valid address — an empty string included. Screen untrusted input with isValid() first.

Remarks

Binary search over the sorted, disjoint records, so O(log n) in the number of networks. Disjointness is not incidental — toBinaryList() coalesces overlaps precisely so that discarding one half of the list at each probe can never discard a record that covers the address. An address of the other family returns false rather than throwing, which is what lets Networks ask both of its lists without checking first.

Ranges are inclusive at both ends, so a /32 matches exactly its one address.

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