Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
nesheroj committed Jul 9, 2017
0 parents commit f700b27
Show file tree
Hide file tree
Showing 15 changed files with 6,311 additions and 0 deletions.
1 change: 1 addition & 0 deletions .babelignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
**/*.test.js
15 changes: 15 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"presets": [
[
"env",
{
"targets": {
"node": 4
},
"useBuiltIns": true
}
],
"stage-1"
],
"sourceMaps": true
}
35 changes: 35 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
version: 2
jobs:
-test-node:
working_directory: ~/cidr-coalesce
docker:
- image: circleci/node
steps:
- checkout
- run:
name: update-npm
command: 'sudo npm install -g npm@latest'
- restore_cache:
key: dependency-cache-{{ checksum "package.json" }}
- run:
name: install-npm-dependencies
command: npm install
- save_cache:
key: dependency-cache-{{ checksum "package.json" }}
paths:
- ./node_modules
- run:
name: test
command: npm run circle
- store_artifacts:
path: coverage
prefix: coverage
workflows:
build-and-test:
# -test-node4
# -test-node6
# -test-node7
-test-node:
# filters:
# branches:
# only: master
21 changes: 21 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
root = true

[*]
end_of_line = lf
indent_style = space
indent_size = 4
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.js]
indent_size = 2

[*.json]
indent_size = 2

[*.yml]
indent_size = 2

[*.yaml]
indent_size = 2
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
node_modules
coverage
.vscode/
lib
npm-debug.log*
11 changes: 11 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
src/
test/
.babelignore
.babelrc
.circleci/
.editorconfig
.npmignore
.vscode
coverage
jest.config.js
nodemon.json
32 changes: 32 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# cidr-coalesce

Get the minimum set of CIDR that covers every and only the input addresses or ranges.

Accepts IPv4 addresses in the following formats
- Single IP: `127.0.0.1`
- IP range: `192.168.1.0-192.168.1.40`
- CIDR: `192.168.1.0/27`

## Usage

### CLI
```sh
$ cidr-coalesce 192.168.1.0-192.168.1.40
192.168.1.0/27
192.168.1.32/29
192.168.1.40/32
```

### API
```js
import coalsece from 'cidr-coalesce';

const result = coalesce(['192.168.1.0', '192.168.1.40']);
// result = ['192.168.1.0/27', '192.168.1.32/29', '192.168.1.40/32']
```

## options

### quiet

Suppreses all error output.
4 changes: 4 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module.exports = {
testPathIgnorePatterns: ['/node_modules/'],
testMatch: ['**/*.test.js'],
};
4 changes: 4 additions & 0 deletions nodemon.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"verbose": true,
"ext": "js json"
}
Loading

0 comments on commit f700b27

Please sign in to comment.