New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

cidr-split

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cidr-split

Split facility for CIDRs.

latest
Source
npmnpm
Version
0.1.2
Version published
Weekly downloads
52K
0.91%
Maintainers
1
Weekly downloads
 
Created
Source

cidr-split

Stability: 1 - Experimental

NPM version

Split facility for CIDRs.

Contributors

@tristanls

Contents

Installation

npm install cidr-split

Usage

To run the below example, run:

npm run readme
"use strict";

const CIDR = require("../index.js");

console.log("Split 10.0.0.0/16 into two and print out");
CIDR.fromString("10.0.0.0/16").split().map(cidr => console.log(cidr.toString()));

console.log("Split 10.0.0.0/16 into four and print out");
CIDR.fromString("10.0.0.0/16")
    .split()
    .map(cidr => cidr.split())
    .reduce((all, halves) => all.concat(...halves))
    .map(cidr => console.log(cidr.toString()));

Tests

No tests at this time.

Documentation

CIDR

Public API

CIDR.fromString(cidr)

  • cidr: String String representation of a CIDR, ex: 10.0.0.0/16
  • Return: CIDR CIDR created from the string.

Parses cidr string and creates a CIDR object.

cidr.split()

  • Retrun: Array Array of two CIDRs, each being one half of the cidr.

If possible, splits the cidr into two CIDRs that are half the size.

Releases

We follow semantic versioning policy (see: semver.org):

Given a version number MAJOR.MINOR.PATCH, increment the:

MAJOR version when you make incompatible API changes,
MINOR version when you add functionality in a backwards-compatible manner, and
PATCH version when you make backwards-compatible bug fixes.

caveat: Major version zero is a special case indicating development version that may make incompatible API changes without incrementing MAJOR version.

Keywords

cidr

FAQs

Package last updated on 02 Jun 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts