nsuite / isLanAddress
Function: isLanAddress()
isLanAddress(
hostOrIp):boolean
Defined in: UtilsNetwork.ts:53
Returns whether the given hostname or IP address is a local-area network address.
Only IP literals and the well-known localhost hostnames are handled; arbitrary hostnames are not resolved via DNS. IPv4 covers the RFC1918 private ranges (10/8, 172.16/12, 192.168/16) and loopback (127/8). IPv6 covers the loopback (::1), ULA (fc00::/7) and link-local (fe80::/10) ranges.
Parameters
hostOrIp
string
The hostname or IP address to inspect.
Returns
boolean
true when the input is a local-area address, otherwise false.
Example
ts
import { isLanAddress } from "nsuite";
isLanAddress("192.168.1.10"); // true
isLanAddress("8.8.8.8"); // false