@brandonhimpfen/is-ip-address

1.0.1 • Public • Published

is-ip-address

Check if a string is an IP address (IPv6 or IPv4).

Installation

You can install the package using npm:

npm install is-ip-address

Usage

The package exports a single function isIPAddress() that can be used to check if a string is a valid IPv4 or IPv6 address.

const isIPAddress = require('is-ip-address');

console.log(isIPAddress('192.168.0.1')); // true
console.log(isIPAddress('2001:0db8:85a3:0000:0000:8a2e:0370:7334')); // true
console.log(isIPAddress('example')); // false

Readme

Keywords

Package Sidebar

Install

npm i @brandonhimpfen/is-ip-address

Weekly Downloads

2

Version

1.0.1

License

MIT

Unpacked Size

2.97 kB

Total Files

5

Last publish

Collaborators

  • brandonhimpfen