From 71ae898a05164dc2a583ab75541ee67bee697b1d Mon Sep 17 00:00:00 2001 From: Moshe Atlow Date: Thu, 29 Sep 2016 22:56:24 +0300 Subject: [PATCH 1/2] add contains fn --- ip/ip.d.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ip/ip.d.ts b/ip/ip.d.ts index 0542ae0785..1c00f1320e 100644 --- a/ip/ip.d.ts +++ b/ip/ip.d.ts @@ -14,6 +14,7 @@ interface SubnetInfo { subnetMaskLength: number; numHosts: number; length: number; + contains(ip: string): boolean; } declare module "ip" { @@ -112,4 +113,4 @@ declare module "ip" { * @param cidr CIDR address. */ export function cidrSubnet(cidr: string): SubnetInfo; -} \ No newline at end of file +} From 43d17ebbfe625e339cdf4b30dcca5dc2cef51292 Mon Sep 17 00:00:00 2001 From: Moshe Atlow Date: Thu, 29 Sep 2016 22:57:17 +0300 Subject: [PATCH 2/2] Update ip-tests.ts --- ip/ip-tests.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/ip/ip-tests.ts b/ip/ip-tests.ts index 338c2bc040..3210871ee0 100644 --- a/ip/ip-tests.ts +++ b/ip/ip-tests.ts @@ -19,3 +19,4 @@ var buff:any = ip.toBuffer(myIP); ip.toString(buff); ip.subnet('192.168.1.134', '255.255.255.192'); ip.cidrSubnet('192.168.1.134/26'); +ip.cidrSubnet('192.168.1.134/26').contains('192.168.1.134');