# cidr-split

> Split facility for CIDRs.

Latest version **0.1.2** (published 2018-06-02) · MIT license · 0 weekly downloads

## Install

```sh
npm install cidr-split
pnpm add cidr-split
yarn add cidr-split
bun add cidr-split
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.2 |
| Published | 2018-06-02 |
| First published | 2017-11-09 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 12.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | tristanls |
| Keywords | cidr, subnet, math |

## Links

- npm: https://www.npmjs.com/package/cidr-split
- Repository: https://github.com/tristanls/cidr-math
- Homepage: https://github.com/tristanls/cidr-math#readme
- Issues: https://github.com/tristanls/cidr-math/issues
- npm.io page: https://npm.io/package/cidr-split

## Dependencies (1)

- [bignumber.js](https://npm.io/package/bignumber.js.md) 7.2.1

## Alternatives

- [@sindresorhus/slugify](https://npm.io/package/@sindresorhus/slugify.md) — 3.7M weekly downloads
- [solid-js](https://npm.io/package/solid-js.md) — 2.7M weekly downloads
- [expo-glass-effect](https://npm.io/package/expo-glass-effect.md) — 2.5M weekly downloads
- [nanoassert](https://npm.io/package/nanoassert.md) — 780.8K weekly downloads
- [@ffmpeg/ffmpeg](https://npm.io/package/@ffmpeg/ffmpeg.md) — 529.5K weekly downloads

## Recent versions

- 0.1.2 (latest) — 2018-06-02
- 0.1.1 — 2017-11-09

## README

# cidr-split

_Stability: 1 - [Experimental](https://github.com/tristanls/stability-index#stability-1---experimental)_

[![NPM version](https://badge.fury.io/js/cidr-split.png)](http://npmjs.org/package/cidr-split)

Split facility for CIDRs.

## Contributors

[@tristanls](https://github.com/tristanls)

## Contents

  * [Installation](#installation)
  * [Usage](#usage)
  * [Tests](#tests)
  * [Documentation](#documentation)
    * [CIDR](#cidr)
  * [Releases](#releases)

## Installation

    npm install cidr-split

## Usage

To run the below example, run:

    npm run readme

```javascript
"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](#cidr)

### CIDR

**Public API**

  * [CIDR.fromString(cidr)](#cidrfromstringcidr)
  * [cidr.split()](#cidrsplit)

### 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](http://semver.org/)):

> Given a version number MAJOR.MINOR.PATCH, increment the:
>
>MAJOR version when you make incompatible API changes,<br/>
>MINOR version when you add functionality in a backwards-compatible manner, and<br/>
>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.

---
_Source: https://npm.io/package/cidr-split · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
