@types/cidr-matcher
TypeScript icon, indicating that this package has built-in type declarations

2.1.2 • Public • Published

Installation

npm install --save @types/cidr-matcher

Summary

This package contains type definitions for cidr-matcher (https://github.com/pracucci/node-cidr-matcher).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/cidr-matcher.

index.d.ts

declare class Matcher {
    /**
     * Constructs a matcher for a list of CIDR ranges
     *
     * @param cidrRanges - list of IPv4 & IPv6 CIDR ranges
     */
    constructor(cidrRanges?: readonly string[]);

    /**
     * Does the CIDR ranges include the IP address
     *
     * @param ipAddress - ip address to check
     * @returns whether the IP address is in the range
     */
    contains(ipAddress: string): boolean;

    /**
     * Does the CIDR ranges includes any of the IP addresses
     *
     * @param ipAddresses - ip addresses to check
     * @returns whether any of the IP addresses are in the range
     */
    containsAny(ipAddresses: string[]): boolean;

    /**
     * Adds a CIDR range to the matcher
     *
     * @param cidr - CIDR range to add
     */
    addNetworkClass(cidr: string): void;
}

export = Matcher;

Additional Details

  • Last updated: Mon, 06 Nov 2023 22:41:05 GMT
  • Dependencies: none

Credits

These definitions were written by Sam Murphy.

/@types/cidr-matcher/

    Package Sidebar

    Install

    npm i @types/cidr-matcher

    Weekly Downloads

    14,660

    Version

    2.1.2

    License

    MIT

    Unpacked Size

    4.25 kB

    Total Files

    5

    Last publish

    Collaborators

    • types