ip address testing with Chai assertions.
- esm module only, support node >= 16 and modern browsers
- chai
expectandshouldinterfaces
$ npm install chai-ip
import { use } from 'chai';
import ip from 'chai-ip';
use(ip);Assert that a string represents valid ip address.
expect('127.0.0.1').to.be.an.ip;
expect('2001:0db8:85a3:0000:0000:8a2e:0370:7334').to.be.an.ip;Assert that a string represents valid ipv4 address.
expect('127.0.0.1').to.be.an.ipv4;
expect('2001:0db8:85a3:0000:0000:8a2e:0370:7334').to.not.be.an.ipv4;Assert that a string represents valid ipv6 address.
expect('127.0.0.1').to.not.be.an.ipv6;
expect('2001:0db8:85a3:0000:0000:8a2e:0370:7334').to.be.an.ipv6;See the LICENSE file for license rights and limitations (MIT).