Comparing version 1.0.0 to 2.0.0
{ | ||
"name": "is-cidr", | ||
"version": "1.0.0", | ||
"description": "Check if a string is a valid CIDR", | ||
"main": "lib/index.js", | ||
"version": "2.0.0", | ||
"description": "Check if a string is an IP address in CIDR notation", | ||
"author": "silverwind <me@silverwind.io>", | ||
"contributors": [ | ||
"Felipe Apostol <flipjs.io@gmail.com> (http://flipjs.io/)" | ||
], | ||
"repository": "silverwind/is-cidr", | ||
"license": "BSD-2-Clause", | ||
"scripts": { | ||
"commit": "git-cz", | ||
"prebuild": "npm run lint && npm run clean", | ||
"build": "babel --presets es2015 -d lib/ src/", | ||
"clean": "rimraf lib && mkdir lib", | ||
"lint": "eslint src/ test/", | ||
"test": "ava --require babel-register", | ||
"semantic-release": "semantic-release pre && npm publish && semantic-release post" | ||
"test": "make test" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/flipjs/is-cidr.git" | ||
}, | ||
"files": [ | ||
"index.js" | ||
], | ||
"keywords": [ | ||
"cidr", | ||
"regex", | ||
"notation", | ||
"cidr notation", | ||
"prefix", | ||
"prefixes", | ||
"ip", | ||
"ip address", | ||
"cidr", | ||
"netblock", | ||
"regex" | ||
"ip address" | ||
], | ||
"author": "Felipe Apostol <flipjs.io@gmail.com> (http://flipjs.io/)", | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://github.com/flipjs/is-cidr/issues" | ||
}, | ||
"homepage": "https://github.com/flipjs/is-cidr#readme", | ||
"devDependencies": { | ||
"ava": "0.13.0", | ||
"babel-cli": "6.6.5", | ||
"babel-preset-es2015": "6.6.0", | ||
"babel-register": "6.7.2", | ||
"commitizen": "2.7.3", | ||
"cz-conventional-changelog": "1.1.5", | ||
"eslint": "2.4.0", | ||
"eslint-config-standard": "5.1.0", | ||
"eslint-plugin-babel": "3.1.0", | ||
"eslint-plugin-promise": "1.1.0", | ||
"eslint-plugin-standard": "1.3.2", | ||
"ghooks": "1.0.3", | ||
"rimraf": "2.5.2", | ||
"semantic-release": "4.3.5" | ||
"ava": "^0.24.0", | ||
"eslint": "^4.13.0", | ||
"updates": "^2.0.3" | ||
}, | ||
"babel": { | ||
"presets": [ | ||
"es2015" | ||
] | ||
}, | ||
"config": { | ||
"commitizen": { | ||
"path": "node_modules/cz-conventional-changelog" | ||
}, | ||
"ghooks": { | ||
"pre-commit": "npm run test && npm run build" | ||
} | ||
}, | ||
"dependencies": { | ||
"cidr-regex": "1.0.6" | ||
"cidr-regex": "^2.0.1" | ||
} | ||
} |
# is-cidr | ||
Check if a string is a valid CIDR | ||
[![](https://img.shields.io/npm/v/is-cidr.svg?style=flat)](https://www.npmjs.org/package/is-cidr) [![](https://img.shields.io/npm/dm/is-cidr.svg)](https://www.npmjs.org/package/is-cidr) [![](https://api.travis-ci.org/silverwind/is-cidr.svg?style=flat)](https://travis-ci.org/silverwind/is-cidr) | ||
[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg?style=flat-square)](https://github.com/semantic-release/semantic-release) | ||
[![version](https://img.shields.io/npm/v/is-cidr.svg?style=flat-square)](http://npm.im/is-cidr) | ||
[![MIT License](https://img.shields.io/npm/l/is-cidr.svg?style=flat-square)](http://opensource.org/licenses/MIT) | ||
[![travis build](https://img.shields.io/travis/flipjs/is-cidr.svg?style=flat-square)](https://travis-ci.org/flipjs/is-cidr) | ||
[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard) | ||
[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg?style=flat-square)](http://commitizen.github.io/cz-cli/) | ||
[![downloads](https://img.shields.io/npm/dm/is-cidr.svg?style=flat-square)](http://npm-stat.com/charts.html?package=is-cidr&from=2016-03-24) | ||
> Check if a string is an IP address in CIDR notation | ||
## Install | ||
```sh | ||
``` | ||
$ npm install --save is-cidr | ||
``` | ||
## Usage | ||
```js | ||
import isCidr from 'is-cidr' // default is isCidrV4 | ||
import { isCidrV4, isCidrV6 } from 'is-cidr' | ||
// OR | ||
var isCidrV4 = require('is-cidr').isCidrV4 | ||
var isCidrV6 = require('is-cidr').isCidrV6 | ||
const isCidr = require('is-cidr'); | ||
// is a CIDR v4 | ||
isCidr('18.101.25.153/24') // true | ||
isCidr('192.168.0.1/24'); | ||
//=> true | ||
// is not a CIDR v4 | ||
isCidrV4('999.999.999.999/12') // false | ||
isCidr('1:2:3:4:5:6:7:8/64'); | ||
//=> true | ||
// is a CIDR v6 | ||
isCidrV6('fe80:0000:0000:0000:0204:61ff:fe9d:f156') // true | ||
// is not a CIDR v6 | ||
isCidrV6('fe80:0000:0000:0000:0204:61ff:fe9d:f156/a') // false | ||
isCidr.v4('1:2:3:4:5:6:7:8/64'); | ||
//=> false | ||
``` | ||
## API | ||
### isCidr(string) | ||
### isCidr(input) | ||
Check if a string is CIDR IPv4. | ||
Check if `input` is a IPv4 or IPv6 CIDR address. | ||
### isCidrV4(string) | ||
### isCidr.v4(input) | ||
Check if a string is CIDR IPv4. | ||
Check if `input` is IPv4 CIDR address. | ||
### isCidrV6(string) | ||
### isCidr.v6(input) | ||
Check if a string is CIDR IPv6. | ||
Check if `input` is IPv6 CIDR address. | ||
## Related | ||
- [cidr-regex](https://github.com/silverwind/cidr-regex) - Regular expression for matching IP addresses in CIDR notation | ||
- [is-cidr](https://github.com/sindresorhus/is-ip) - Check if a string is an IP address | ||
- [ip-regex](https://github.com/sindresorhus/ip-regex) - Regular expression for matching IP addresses | ||
## License | ||
MIT © [Felipe Apostol](https://github.com/flipjs) | ||
© [silverwind](https://github.com/silverwind), distributed under BSD licence | ||
Based on previous work by [Felipe Apostol](https://github.com/flipjs) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
Trivial Package
Supply chain riskPackages less than 10 lines of code are easily copied into your own project and may not warrant the additional supply chain risk of an external dependency.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
3
3522
4
5
1
1
57
1
3
+ Addedcidr-regex@2.0.10(transitive)
+ Addedip-regex@2.1.0(transitive)
- Removedcidr-regex@1.0.6(transitive)
Updatedcidr-regex@^2.0.1