dv-ip-range
v0.0.5
Published
A pilot library that provides a function that accepts two valid IPv4 addresses in the form of strings, and returns the number of addresses between them (including the first one, excluding the last one).
Downloads
3
Readme
IP Range
A pilot library that provides a function that accepts two valid IPv4 addresses in the form of strings, and returns the number of addresses between them (including the first one, excluding the last one).
Inspired by Count IP Addresses Kata from Codewars: https://www.codewars.com/kata/526989a41034285187000de4
Use
Run npm install dv-ip-range
to install the package
Import IpRange service:
import { DvIpRangeService as IpRangeService } from "dv-ip-range";
Add IpRange property to your components constructor:
constructor(private ipRange: IpRangeService) {
Call the countIpAddresses
function:
this.range = ipRange.countIpAddresses("10.0.0.0", "10.0.0.50"); // 50