isValid4() function
Whether a string is a valid IPv4 address.
Signature:
export declare function isValid4(ip: string): boolean;
Parameters
|
Parameter |
Type |
Description |
|---|---|---|
|
ip |
string |
the string to test |
Returns:
boolean
true only for IPv4; a valid IPv6 address gives false.
Remarks
Node's net.isIPv4. Note that the IPv4-mapped form ::ffff:1.2.3.4 is IPv6 as far as this is concerned.
Read this page as plain markdown — no HTML, no navigation. For pasting into an LLM, or for an agent to fetch.