DefinitelyTyped/ip/ip-tests.ts
CodeAnimal 5c7e823506 Rename node-ip directory to ip
Rename node-ip to ip so the folder name matches the library name on npm.
2014-09-24 15:42:07 +01:00

19 lines
445 B
TypeScript

/// <reference path="ip.d.ts" />
import ip = require('ip');
var myIP = ip.address();
ip.cidr("192.168.0.1/24");
ip.fromLong(ip.toLong(myIP));
ip.fromPrefixLen(24);
ip.isEqual("192.168.0.1", myIP);
ip.isLoopback("127.0.0.1");
ip.isPrivate(myIP);
ip.isPublic(myIP);
ip.loopback("ipv6");
ip.mask("192.168.0.1", "255.255.255.0");
ip.not("255.255.255.0");
ip.or("192.168.0.1", "255.255.255.0");
var buff:any = ip.toBuffer(myIP);
ip.toString(buff);