Skip to content

Commit 4673184

Browse files
committed
minor
1 parent 337be14 commit 4673184

File tree

2 files changed

+25
-44
lines changed

2 files changed

+25
-44
lines changed

CHANGES.md renamed to CHANGELOG.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
1-
# 2.0.0
1+
# 2.0.1
2+
* Updated `README`
3+
4+
## 2.0.0
25
* Refactored to TypeScript
36

4-
# 1.1.7
7+
## 1.1.7
58
* Added `LICENSE` file
69

710
## 1.1.0
8-
* `isIp()` and `isDecimalIp()` functions
11+
* Added `isIp()` and `isDecimalIp()` functions
912
* Added tests
1013
* Added `.editorconfig`, `.eslintrc`, and `.jshintrc` files
1114
* `calculate()`, `calculateSubnetMask()`, and `calculateCIDRPrefix()` now accept IPs in string and number format
1215

1316
## 1.0.0
14-
Initial release
17+
* Initial release

README.md

Lines changed: 18 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,27 @@
1-
IP Subnet Calculator
2-
=================
3-
4-
JavaScript class for calculating optimal subnet masks for non-standard IP ranges, e.g. `5.4.3.21 - 6.7.8.9`
1+
# IP Subnet Calculator
2+
This module calculates optimal subnet masks for non-standard IP ranges, e.g. `5.4.3.21 - 6.7.8.9`
53

64
[View demo](http://salieri.github.io/IPSubnetCalculator/)
75

86

9-
What does it do?
10-
----------------
11-
7+
## What does it do?
128
* Calculates subnet masks for standard and non-standard IP ranges. For example, `10.0.0.5 - 10.0.0.23` will result in `10.0.0.5/32, 10.0.0.6/31, 10.0.0.8/29, 10.0.0.16/29`.
139
* Calculates CIDR prefixes from subnet masks, e.g. `10.0.0.5/255.255.128.0` will result in `10.0.0.0/17`.
1410
* Calculates subnet masks from CIDR prefixes, e.g. `10.0.0.5/17` will result in `255.255.128.0`.
1511

1612

17-
Support
18-
-------
19-
13+
## Support
2014
* Node.js
2115
* Direct browser use
2216

2317

24-
Installation
25-
------------
26-
18+
## Installation
2719
```sh
2820
> npm install ip-subnet-calculator
2921
```
3022

3123

32-
Node.js
33-
-------
24+
## Node.js
3425
```javascript
3526
import * as IPSubnetCalculator from 'ip-subnet-calculator';
3627
// or: const IPSubnetCalculator = require('ip-subnet-calculator');
@@ -41,9 +32,7 @@ console.log(IpSubnetCalculator.toDecimal('127.0.0.1')); // 2130706433
4132
console.log(IpSubnetCalculator.calculate('5.4.3.21', '6.7.8.9'));
4233
```
4334

44-
45-
Direct browser use
46-
------------------
35+
## Direct browser use
4736
```html
4837
<script src='lib/ip-subnet-calculator.browser.js'></script>
4938

@@ -56,10 +45,9 @@ Direct browser use
5645
```
5746
5847
59-
API
60-
---
61-
### IpSubnetCalculator.calculate(ipStart, ipEnd) ###
48+
## API
6249
50+
### IpSubnetCalculator.calculate(ipStart, ipEnd)
6351
Calculates an optimal set of IP masks for the given IP address range.
6452
6553
> *ipStart* (`string|number`) Lowest IP in the range to be calculated in string (`123.123.123.0`) or numeric (`2071689984`) format.
@@ -103,9 +91,7 @@ Each object in question contain the following properties:
10391
| `invertedMaskStr` | String representation of the inverted prefix mask |
10492
| `invertedSize` | Size of the inverted prefix max in bits |
10593
106-
107-
### IpSubnetCalculator.calculateSubnetMask(ip, prefixSize) ###
108-
94+
### IpSubnetCalculator.calculateSubnetMask(ip, prefixSize)
10995
Calculates a subnet mask from CIDR prefix.
11096
11197
> *ip* (`string|number`) IP address in string or numeric format
@@ -114,9 +100,7 @@ Calculates a subnet mask from CIDR prefix.
114100
115101
The function returns an object containing full description of the IP range, as described in `IpSubnetCalculator.calculate()`.
116102
117-
118-
### IpSubnetCalculator.calculateCIDRPrefix(ip, subnetMask) ###
119-
103+
### IpSubnetCalculator.calculateCIDRPrefix(ip, subnetMask)
120104
Calculates a CIDR prefix from subnet mask.
121105
122106
> *ip* (`string|number`) IP address in string or numeric format
@@ -126,29 +110,26 @@ Calculates a CIDR prefix from subnet mask.
126110
The function returns an object containing full description of the IP range, as described in `IpSubnetCalculator.calculate()`.
127111
128112
129-
## Test Functions ##
130-
131-
### IpSubnetCalculator.isIp(ipStr) ###
113+
## Test Functions
132114
115+
### IpSubnetCalculator.isIp(ipStr)
133116
Tests whether string is an IP address.
134117
135118
> *ipStr* (`string`) A string
136119
137120
The function returns a `true` if the string is an IP address, `false` otherwise.
138121
139-
### IpSubnetCalculator.isDecimalIp(ipNum) ###
140-
122+
### IpSubnetCalculator.isDecimalIp(ipNum)
141123
Tests whether `ipNum` is a decimal IP address.
142124
143125
> *ipNum* (`number`) A number
144126
145127
The function returns a `true` if the number is an IP address, `false` otherwise.
146128
147129
148-
## Conversion Functions ##
149-
150-
### IpSubnetCalculator.toDecimal(ip) ###
130+
## Conversion Functions
151131
132+
### IpSubnetCalculator.toDecimal(ip)
152133
Calculates a decimal integer from an string IP address.
153134
154135
> *ip* (`string|number`) IP address in string format
@@ -159,8 +140,7 @@ of an IP is passed to this function, it is returned unmodified.
159140
If an invalid value is passed to the function, it will `throw` an `Error` object.
160141
161142
162-
### IpSubnetCalculator.toString(num) ###
163-
143+
### IpSubnetCalculator.toString(num)
164144
> *num* (`number|string`) Decimal representation of an IP address.
165145
166146
The function returns an IP address as a string. If a valid string representation of an IP is passed to this function,
@@ -169,9 +149,7 @@ it is returned unmodified.
169149
If an invalid value is passed to the function, it will `throw` an `Error` object.
170150
171151
172-
License
173-
-------
174-
152+
## License
175153
[MIT](http://opensource.org/licenses/MIT)
176154
177155

0 commit comments

Comments
 (0)