-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit f700b27
Showing
15 changed files
with
6,311 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
**/*.test.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
node_modules | ||
coverage | ||
.vscode/ | ||
lib | ||
npm-debug.log* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
module.exports = { | ||
testPathIgnorePatterns: ['/node_modules/'], | ||
testMatch: ['**/*.test.js'], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"verbose": true, | ||
"ext": "js json" | ||
} |
Oops, something went wrong.