Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: eviltik/cidr-clean
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: master
Choose a base ref
...
head repository: bepsoccer/cidr-clean-bp
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
Can’t automatically merge. Don’t worry, you can still create the pull request.
  • 8 commits
  • 6 files changed
  • 1 contributor

Commits on Apr 4, 2018

  1. initial commit

    bepsoccer committed Apr 4, 2018
    Copy the full SHA
    7be88e1 View commit details

Commits on Apr 5, 2018

  1. reference changes

    bepsoccer committed Apr 5, 2018
    Copy the full SHA
    ed7f4ba View commit details
  2. specific version to test

    bepsoccer committed Apr 5, 2018
    Copy the full SHA
    303c39f View commit details
  3. branch specific

    bepsoccer committed Apr 5, 2018
    Copy the full SHA
    3933e77 View commit details
  4. Revert "branch specific"

    This reverts commit cb946e1.
    bepsoccer committed Apr 5, 2018
    Copy the full SHA
    9c5805b View commit details
  5. removed spread operator

    removed spread operator as ictrlLX does not support it
    bepsoccer committed Apr 5, 2018
    Copy the full SHA
    e6d95ee View commit details
  6. Update README.md

    bepsoccer authored Apr 5, 2018
    Copy the full SHA
    16fc13d View commit details

Commits on Apr 10, 2018

  1. updated readme

    updated readme to enable proper linking of travis-ci
    bepsoccer committed Apr 10, 2018
    Copy the full SHA
    e1d1c81 View commit details
Showing with 18 additions and 2,684 deletions.
  1. +1 −0 .travis.yml
  2. +1 −1 LICENSE
  3. +5 −5 README.md
  4. +4 −3 index.js
  5. +0 −2,667 package-lock.json
  6. +7 −8 package.json
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
language: node_js
node_js:
- "6.9.1"
- "8"
- "9"

2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2017 eviltik
Copyright (c) 2018 bepsoccer

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
# cidr-clean
-----------
[![Build Status](https://travis-ci.org/eviltik/cidr-clean.svg?branch=master)](https://travis-ci.org/eviltik/cidr-clean.svg)
[![Build Status](https://travis-ci.org/bepsoccer/cidr-clean-bp.svg?branch=master)](https://travis-ci.org/bepsoccer/cidr-clean-bp)
[![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 ?
----------
@@ -14,18 +13,19 @@ Clean an array of CIDR
* remove extra spaces
* choose the heaviest network in case of overlap

This is a fork of cidr-clean by Eviltik to make it work with an older nodejs implementation.

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


Usage
-----
```
const cidrClean = require('cidr-clean');
const cidrClean = require('cidr-clean-bp');
let list = [
'#mycomment',
@@ -43,4 +43,4 @@ console.log(cidrClean(list));

Todo
----
* optional callback with all events (remove, overlap)
* optional callback with all events (remove, overlap)
7 changes: 4 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require('sanic.js').changeMyWorld();
"use strict";
const Netmask = require('netmask').Netmask;
const ipInt = require('ip-to-int');

@@ -12,10 +12,11 @@ function cleaner(cidr1, cidr2) {

// merge both
if (cidr2) {
tmp = [...cidr1, ...cidr2];
tmp = cidr1.concat(cidr2);
} else {
tmp = cidr1;
}
cidr1 = cidr2 = null;

// remove extra spaces
tmp = tmp.map(c => {
@@ -28,7 +29,7 @@ function cleaner(cidr1, cidr2) {
});

// remove duplicates
tmp = [ ...new Set(tmp) ];
tmp = Array.from(new Set(tmp));

// detect overlaps
tmp = tmp.filter((c1,idx1) => {
Loading