IP Util Functions Library
A library of useful functions related to IP (v4 and v6).
Installation
# Using npm $ npm install --save ip-utils# or Using yarn $ yarn install --save ip-utils
Browser// Import the Library;// Use any of the contained methodsip; // True // Alternatively - import functions selectively; // True NodeJS// Import the Libraryconst ip = ;// Use any of the contained methodsip; // True
Usage
// IP Object// Can be chained with // True // False // False // '1' // ['1', '1', '1', '1'] // True // Subnet Object// Can be chained with // '192.168.1.0 // '192.168.1.255 // '192.168.1.1 // '192.168.1.254 // '255.255.255.0 // True/* { networkAddress: '192.168.1.0', broadcastAddress: '192.168.1.255', numberHosts: 254, inclusiveNumberHosts: 256, firstHostAddress: '192.168.1.1', lastHostAddress: '192.168.1.254', mask: '255.255.255.0', cidrMask: 24 } */ // All individual Functions // True // True // True //3232235777 // 192.168.1.1 // As Above (deprecated) // False // True // ['50', '11', '12', '13'] // '11' /* { networkAddress: '192.168.1.0', broadcastAddress: '192.168.1.255', numberHosts: 254, inclusiveNumberHosts: 256, firstHostAddress: '192.168.1.1', lastHostAddress: '192.168.1.254', mask: '255.255.255.0', cidrMask: 24 } */ // As above // '12.13.14.255' // '12.13.14.128' // '12.13.14.129' // '12.13.14.254' // 126 // '255.255.255.128' // '24' // 27 // True
Contributing
Any and contributions are very welcome - be it:
- features that you implement yourself and then PR back.
- Ideas/Requests for new features.
- Suggestions for improvements.
New Functions can be written in src directory and then added as export in src/index.ts Corresponding unit tests can be written in spec directory
Commit Format
The project uses commitizen to standardise commits in format:
<type>(<scope>): <subject>
Workflow is as follows:
- Mark issue your working with label - Status:In Progress
- Implement fix/feature
- Submit PR to develop branch
- PR will be reviewed/merged
- Upon milestones develop will be merged to master
- Master commits spawn a CI job to deploy new version to npm
License
ip-utils is released under the MIT license