@cityssm/is-private-network-address
v1.0.0
Published
Determines whether or not a network address is a private or internal.
Downloads
90
Maintainers
Readme
is-private-network-address
Determines whether or not a network address is a private or internal.
Supports all Reserved IP Addresses used for private networks.
Installation
npm install @cityssm/is-private-network-address
Usage
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