Last active
June 11, 2020 10:25
Revisions
-
mlippens revised this gist
Jun 11, 2020 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,2 @@ /// <reference path="node-cidr.d.ts" /> import { cidr } from 'node-cidr'; -
mlippens created this gist
Jun 11, 2020 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,40 @@ /** * Manual copy of node_modules/node-cidr/dist/index.d.ts, slightly edited to make it work correctly with TypeScript. * An error in the package's configuration makes the types not usable by the compiler. **/ declare module 'node-cidr' { export const ip: { toInt: (ipAddress: string) => number; toString: (ipInt: number) => string; commonCidr: (ips: string[]) => string; toHex: (ip: string | number) => string; toOctets: (input: string | number) => number[]; toBinary: (ip: string | number) => string; reverse: (ip: string | number) => string; previous: (ip: string) => string; next: (ip: string) => string; toCidr: (ip: string | number) => string; validate: (ip: string) => string | null; }; export const cidr: { toRange: (cidr: string) => string[]; usable: (cidr: string) => string[]; toIntRange: (cidr: string) => number[]; commonCidr: (cidrs: string[]) => string; max: (cidr: string) => string; min: (cidr: string) => string; count: (cidr: string) => number; netmask: (cidr: string) => string; wildcardmask: (cidr: string) => string; broadcast: (cidr: string) => string; subnets: (cidr: string, subMask: number, limit: number) => string[]; ips: (cidr: string) => string[]; includes: (cidr: string, ip: string) => boolean; random: (cidr: string) => string; next: (cidr: string) => string; previous: (cidr: string) => string; address: (ip: string) => string; mask: (ip: string) => number; validate: (cidr: string) => string | null; }; }