Security News
The Dark Side of Open Source
At Node Congress, Socket CEO Feross Aboukhadijeh uncovers the darker aspects of open source, where applications that rely heavily on third-party dependencies can be exploited in supply chain attacks.
Readme
Check if a string is an IP address
If you only need this for Node.js and don't care about browser support, you may want to use net.isIP
instead. Note that it returns an integer instead of a boolean.
npm install is-ip
import {isIP, isIPv4} from 'is-ip';
isIP('1:2:3:4:5:6:7:8');
//=> true
isIP('192.168.0.1');
//=> true
isIPv4('1:2:3:4:5:6:7:8');
//=> false
Check if string
is IPv6 or IPv4.
Check if string
is IPv6.
Check if string
is IPv4.
Returns 6
if string
is IPv6, 4
if string
is IPv4, or undefined
if string
is neither.
import {ipVersion} from 'is-ip';
ipVersion('1:2:3:4:5:6:7:8');
//=> 6
ipVersion('192.168.0.1');
//=> 4
ipVersion('abc');
//=> undefined
FAQs
Check if a string is an IP address
The npm package is-ip receives a total of 765,323 weekly downloads. As such, is-ip popularity was classified as popular.
We found that is-ip demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
At Node Congress, Socket CEO Feross Aboukhadijeh uncovers the darker aspects of open source, where applications that rely heavily on third-party dependencies can be exploited in supply chain attacks.
Research
Security News
The Socket Research team found this npm package includes code for collecting sensitive developer information, including your operating system username, Git username, and Git email.
Security News
OpenJS is warning of social engineering takeovers targeting open source projects after receiving a credible attempt on the foundation.