isIP
Pure Javascript implementation for truly checking if the provided input is an IP address. Based on RFC 791 (IPv4), RFC 4291 (IPv6), and RFC 4632 (CIDR).
Install
NPM
$ npm install isipaddress
Node.js
var isIP = require('isipaddress');
isIP.test('127.0.0.1');
isIP.test('FEDC:BA98:7654:3210:FEDC:BA98:7654:3210/16');
isIP.test('Bananas in pajamas are coming down the stairs');
isIP.v4('127.0.0.1');
isIP.v4('127.0.0.1/18');
isIP.v4('FEDC:BA98:7654:3210:FEDC:BA98:7654:3210');
isIP.v6('127.0.0.1');
isIP.v6('FEDC:BA98:7654:3210:FEDC:BA98:7654:3210');
isIP.v6('FEDC:BA98:7654:3210:FEDC:BA98:7654:3210/32');
License
MIT