JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 38393
  • Score
    100M100P100Q149735F
  • License MIT

Check if an IPv4 or IPv6 address is contained in the given subnet

Package Exports

  • is-in-subnet

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (is-in-subnet) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

is-in-subnet npm dependencies license node

Check if an IPv4 or IPv6 address is contained in the given subnet.

  • Small
  • Fast
  • Simple syntax
  • Full test coverage
  • TypeScript-friendly
  • Zero dependencies

Usage

const { isInSubnet } = require('is-in-subnet');

console.log( isInSubnet('10.5.0.1', '10.4.5.0/16') );   // false
console.log( isInSubnet('10.5.0.1', '10.4.5.0/15') );   // true

console.log( isInSubnet('2001:db8:f53a::1', '2001:db8:f53b::1:1/48') );   // false
console.log( isInSubnet('2001:db8:f53a::1', '2001:db8:f531::1:1/44') );   // true