# cidr-clean

> Compare list of CIDR, remove duplicates and choose the heaviest network in case of overlap

Latest version **1.1.7** (published 2021-08-30) · MIT license · 0 weekly downloads

## Install

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

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.7 |
| Published | 2021-08-30 |
| First published | 2017-10-31 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 9.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 9 |
| Author | eviltik |
| Maintainers | eviltik |
| Keywords | cidr |

## Links

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

## Dependencies (3)

- [netmask](https://npm.io/package/netmask.md) 2.0.2
- [sanic.js](https://npm.io/package/sanic.js.md) 1.1.2
- [ip-to-int](https://npm.io/package/ip-to-int.md) 0.3.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

- 1.1.7 (latest) — 2021-08-30
- 1.1.6 — 2021-08-30
- 1.1.5 — 2021-01-27
- 1.1.4 — 2021-01-25
- 1.1.2 — 2019-06-03
- 1.1.1 — 2017-11-12
- 1.1.0 — 2017-10-31
- 1.0.0 — 2017-10-31

## README

# cidr-clean
-----------
![Node.js CI](https://github.com/eviltik/cidr-clean/workflows/Node.js%20CI/badge.svg)
[![npm version](https://badge.fury.io/js/cidr-clean.svg)](https://badge.fury.io/js/cidr-clean)
[![MIT Licence](https://badges.frapsoft.com/os/mit/mit.svg?v=103)](https://opensource.org/licenses/mit-license.php)
[![Dependencies](https://david-dm.org/eviltik/cidr-clean.svg)](https://david-dm.org/eviltik/cidr-clean)

What for ?
----------

Clean an array of CIDR
* remove duplicates
* remove comments
* remove bad CIDRs
* remove extra spaces
* choose the heaviest network in case of overlap


Installation
------------
```
$ npm install cidr-clean
```


Usage
-----
```
const cidrClean = require('cidr-clean');

let list = [
    '#mycomment',
    '10.1.2.0/23',
    '110.1.3.248/30',
    '1.2.3.4/10'
];

console.log(cidrClean(list));

# output: ['10.1.2.0/23', '110.1.3.248/30', '1.2.3.4/10'];

# note, you can cidrClean(list1, list2) for merging 2 cidr lists
```

Todo
----
* optional callback with all events (remove, overlap)

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