2.0.0 • Published 11 months ago
chai-ip v2.0.0
chai-ip
ip address testing with Chai assertions.
Features
- esm module only, support node >= 16 and modern browsers
- chai
expect
andshould
interfaces
Install
$ npm install chai-ip
Plugin
import { use } from 'chai';
import ip from 'chai-ip';
use(ip);
Assertions
.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;
.ipv4
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;
.ipv6
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;
License
See the LICENSE file for license rights and limitations (MIT).