JSPM

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

This is a simple module to vaildate IP address, check ip address version, check if ip is within a range.

Package Exports

  • range_check

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 (range_check) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Range Check

This is a simple module to vaildate IP address, check ip address version, check if ip is within a range.

Setup

To set up Range Check on your Node.js server use npm.

    npm install range_check

##Check if IP is vaild##

var range_check = require('range_check');
console.log(range_check.vaild_ip('10.0.1.5')); //returns true or false

##Check IP version##

var range_check = require('range_check');
console.log(range_check.ver('10.0.1.5')); //returns 4
console.log(range_check.ver('2001:4860:8006::62')); //returns 6

##Check within range ##

var range_check = require('range_check');
console.log(range_check.in_range('10.0.1.5', '10.0.0.0/8')); //returns true

console.log(range_check.in_range('192.0.1.5', '10.0.0.0/8')); //returns false

console.log(range_check.in_range('2001:db8:1234::1', '2001:db8::/32')); //returns true

You can also give a list of ranges

var range_check = require('range_check');
console.log(range_check.in_range('192.168.1.1', ['10.0.0.0/8', '192.0.0.0/8'])); //returns true