🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more

is-ip

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

is-ip

Check if a string is an IP address

5.0.1
latest
Version published
Weekly downloads
1.1M
-3.17%
Maintainers
1
Weekly downloads
 
Created

What is is-ip?

The is-ip npm package is a utility library for checking if a given string is a valid IP address. It supports both IPv4 and IPv6 addresses and provides simple, easy-to-use functions for validation.

What are is-ip's main functionalities?

Check if a string is a valid IP address

This feature allows you to check if a given string is a valid IP address, whether it's IPv4 or IPv6.

const isIp = require('is-ip');

console.log(isIp('192.168.0.1')); // true
console.log(isIp('::1')); // true
console.log(isIp('invalid-ip')); // false

Check if a string is a valid IPv4 address

This feature allows you to specifically check if a given string is a valid IPv4 address.

const isIp = require('is-ip');

console.log(isIp.v4('192.168.0.1')); // true
console.log(isIp.v4('::1')); // false

Check if a string is a valid IPv6 address

This feature allows you to specifically check if a given string is a valid IPv6 address.

const isIp = require('is-ip');

console.log(isIp.v6('::1')); // true
console.log(isIp.v6('192.168.0.1')); // false

Other packages similar to is-ip

FAQs

Package last updated on 05 Aug 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts