Determines whether or not a network address is a private or internal.
Supports all Reserved IP Addresses used for private networks.
npm install @cityssm/is-private-network-address
import { isLocal, isPrivate } from "@cityssm/is-private-network-address";
/* Test Local IPs */
console.log(isLocal("127.0.0.1"));
// => true
console.log(isLocal("::1"));
// => true
console.log(isLocal("12.34.56.78"));
// => false
/* Test Private IPs */
console.log(isPrivate("10.0.100.100"));
// => true
console.log(isPrivate("192.168.2.1"));
// => true