Skip to main content
Version: v0.0.6

Function: isSyntheticIp()

isSyntheticIp(value): boolean

Whether an IP string is in an RFC 5737 (IPv4 TEST-NET) or RFC 3849 (IPv6 documentation) reserved block. A real routable address returns false.

Parameters

value

string

The candidate IPv4 or IPv6 address.

Returns

boolean

true when the address is a reserved documentation address.

Example

import { isSyntheticIp } from "@cosyte/synth";
isSyntheticIp("192.0.2.44"); // true (TEST-NET-1)
isSyntheticIp("8.8.8.8"); // false (real)