From 29089eb71aedee25f94125fa05bc63c2109b4720 Mon Sep 17 00:00:00 2001 From: Rebecca Turner Date: Thu, 22 Mar 2018 18:06:23 -0700 Subject: is-cidr@2.0.5 New interface with renamed exports. Credit: @silverwind --- node_modules/is-cidr/.npmignore | 1 - node_modules/is-cidr/.travis.yml | 21 --- node_modules/is-cidr/LICENSE | 22 +++ node_modules/is-cidr/README.md | 57 +++--- node_modules/is-cidr/example/example.js | 14 -- node_modules/is-cidr/index.js | 6 + node_modules/is-cidr/lib/index.js | 18 -- .../is-cidr/node_modules/cidr-regex/.npmignore | 1 - .../is-cidr/node_modules/cidr-regex/LICENSE | 22 +++ .../is-cidr/node_modules/cidr-regex/README.md | 57 +++--- .../is-cidr/node_modules/cidr-regex/index.js | 13 ++ .../is-cidr/node_modules/cidr-regex/lib/index.js | 10 -- .../cidr-regex/node_modules/ip-regex/index.js | 24 +++ .../cidr-regex/node_modules/ip-regex/license | 21 +++ .../cidr-regex/node_modules/ip-regex/package.json | 77 ++++++++ .../cidr-regex/node_modules/ip-regex/readme.md | 63 +++++++ .../is-cidr/node_modules/cidr-regex/package.json | 82 +++++---- .../is-cidr/node_modules/cidr-regex/test.js | 200 --------------------- node_modules/is-cidr/package.json | 101 +++++------ node_modules/is-cidr/test/index.test.js | 200 --------------------- 20 files changed, 400 insertions(+), 610 deletions(-) delete mode 100644 node_modules/is-cidr/.npmignore delete mode 100644 node_modules/is-cidr/.travis.yml create mode 100644 node_modules/is-cidr/LICENSE delete mode 100644 node_modules/is-cidr/example/example.js create mode 100644 node_modules/is-cidr/index.js delete mode 100644 node_modules/is-cidr/lib/index.js delete mode 100644 node_modules/is-cidr/node_modules/cidr-regex/.npmignore create mode 100644 node_modules/is-cidr/node_modules/cidr-regex/LICENSE create mode 100644 node_modules/is-cidr/node_modules/cidr-regex/index.js delete mode 100644 node_modules/is-cidr/node_modules/cidr-regex/lib/index.js create mode 100644 node_modules/is-cidr/node_modules/cidr-regex/node_modules/ip-regex/index.js create mode 100644 node_modules/is-cidr/node_modules/cidr-regex/node_modules/ip-regex/license create mode 100644 node_modules/is-cidr/node_modules/cidr-regex/node_modules/ip-regex/package.json create mode 100644 node_modules/is-cidr/node_modules/cidr-regex/node_modules/ip-regex/readme.md delete mode 100644 node_modules/is-cidr/node_modules/cidr-regex/test.js delete mode 100644 node_modules/is-cidr/test/index.test.js (limited to 'node_modules/is-cidr') diff --git a/node_modules/is-cidr/.npmignore b/node_modules/is-cidr/.npmignore deleted file mode 100644 index 8eba6c8dd..000000000 --- a/node_modules/is-cidr/.npmignore +++ /dev/null @@ -1 +0,0 @@ -src/ diff --git a/node_modules/is-cidr/.travis.yml b/node_modules/is-cidr/.travis.yml deleted file mode 100644 index 6eeec8aa9..000000000 --- a/node_modules/is-cidr/.travis.yml +++ /dev/null @@ -1,21 +0,0 @@ -sudo: false -language: node_js -cache: - directories: - - node_modules -notifications: - email: false -node_js: - - '4' -before_install: - - npm i -g npm@^3.0.0 -before_script: - - npm prune -script: - - npm run test - - npm run build -after_success: - - npm run semantic-release -branches: - except: - - "/^v\\d+\\.\\d+\\.\\d+$/" diff --git a/node_modules/is-cidr/LICENSE b/node_modules/is-cidr/LICENSE new file mode 100644 index 000000000..9669c20f8 --- /dev/null +++ b/node_modules/is-cidr/LICENSE @@ -0,0 +1,22 @@ +Copyright (c) silverwind +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/node_modules/is-cidr/README.md b/node_modules/is-cidr/README.md index 51aaaf1e1..64ea8f572 100644 --- a/node_modules/is-cidr/README.md +++ b/node_modules/is-cidr/README.md @@ -1,58 +1,55 @@ # 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 `input` is a IPv4 or IPv6 CIDR address. + +### isCidr.v4(input) + +Check if `input` is IPv4 CIDR address. -Check if a string is CIDR IPv4. +### isCidr.v6(input) -### isCidrV4(string) +Check if `input` is IPv6 CIDR address. -Check if a string is CIDR IPv4. -### isCidrV6(string) +## Related -Check if a string is CIDR IPv6. +- [cidr-regex](https://github.com/silverwind/cidr-regex) - Regular expression for matching IP addresses in CIDR notation +- [is-ip](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) diff --git a/node_modules/is-cidr/example/example.js b/node_modules/is-cidr/example/example.js deleted file mode 100644 index 2ac23af4e..000000000 --- a/node_modules/is-cidr/example/example.js +++ /dev/null @@ -1,14 +0,0 @@ -var r = require('../lib') - -var v4true = r.isCidrV4('1.1.1.1/24') -console.log('cidrv4 true is', v4true) - -var v4false = r.isCidrV4('1.1.1.256/24') -console.log('cidrv4 false is', v4false) - -var v6true = r.isCidrV6('fe80:0000:0000:0000:0204:61ff:fe9d:f156') -console.log('cidrv6 true is', v6true) - -var v6false = r.isCidrV6('fe80:0000:0000:0000:0204:61ff:fe9d:f156/sdfsdfs') -console.log('cidrv6 false is', v6false) - diff --git a/node_modules/is-cidr/index.js b/node_modules/is-cidr/index.js new file mode 100644 index 000000000..b5a502643 --- /dev/null +++ b/node_modules/is-cidr/index.js @@ -0,0 +1,6 @@ +"use strict"; +const cidrRegex = require("cidr-regex"); + +const isCidr = module.exports = string => cidrRegex({exact: true}).test(string); +isCidr.v4 = string => cidrRegex.v4({exact: true}).test(string); +isCidr.v6 = string => cidrRegex.v6({exact: true}).test(string); diff --git a/node_modules/is-cidr/lib/index.js b/node_modules/is-cidr/lib/index.js deleted file mode 100644 index a36706049..000000000 --- a/node_modules/is-cidr/lib/index.js +++ /dev/null @@ -1,18 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.isCidrV6 = exports.isCidrV4 = undefined; - -var _cidrRegex = require('cidr-regex'); - -var isCidrV4 = exports.isCidrV4 = function isCidrV4(str) { - return _cidrRegex.cidrv4.test(str); -}; - -var isCidrV6 = exports.isCidrV6 = function isCidrV6(str) { - return _cidrRegex.cidrv6.test(str); -}; - -exports.default = isCidrV4; \ No newline at end of file diff --git a/node_modules/is-cidr/node_modules/cidr-regex/.npmignore b/node_modules/is-cidr/node_modules/cidr-regex/.npmignore deleted file mode 100644 index 8eba6c8dd..000000000 --- a/node_modules/is-cidr/node_modules/cidr-regex/.npmignore +++ /dev/null @@ -1 +0,0 @@ -src/ diff --git a/node_modules/is-cidr/node_modules/cidr-regex/LICENSE b/node_modules/is-cidr/node_modules/cidr-regex/LICENSE new file mode 100644 index 000000000..9669c20f8 --- /dev/null +++ b/node_modules/is-cidr/node_modules/cidr-regex/LICENSE @@ -0,0 +1,22 @@ +Copyright (c) silverwind +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/node_modules/is-cidr/node_modules/cidr-regex/README.md b/node_modules/is-cidr/node_modules/cidr-regex/README.md index de8df4d01..d24d7071a 100644 --- a/node_modules/is-cidr/node_modules/cidr-regex/README.md +++ b/node_modules/is-cidr/node_modules/cidr-regex/README.md @@ -1,5 +1,7 @@ # cidr-regex -Regular expression for matching CIDR (Classless Inter-Domain Routing) +[![](https://img.shields.io/npm/v/cidr-regex.svg?style=flat)](https://www.npmjs.org/package/cidr-regex) [![](https://img.shields.io/npm/dm/cidr-regex.svg)](https://www.npmjs.org/package/cidr-regex) [![](https://api.travis-ci.org/silverwind/cidr-regex.svg?style=flat)](https://travis-ci.org/silverwind/cidr-regex) + +> Regular expression for matching IP addresses in CIDR notation ## Install @@ -10,40 +12,53 @@ $ npm install --save cidr-regex ## Usage ```js -import cidr from 'cidr-regex' // default regex is cidr v4 -import { cidrv4, cidrv6 } from 'cidr-regex' -// OR -var cidrv4 = require('cidr-regex').cidrv4 -var cidrv6 = require('cidr-regex').cidrv6 +const cidrRegex = require('cidr-regex'); -// is a CIDR v4 -cidr.test('18.101.25.153/24') // true +// Contains a CIDR IP address? +cidrRegex().test('foo 192.168.0.1/24'); +//=> true -// is not a CIDR v4 -cidrv4.test('999.999.999.999/12') // false +// Is a CIDR IP address? +cidrRegex({exact: true}).test('foo 192.168.0.1/24'); +//=> false -// is a CIDR v6 -cidrv6.test('fe80:0000:0000:0000:0204:61ff:fe9d:f156') // true +cidrRegex.v6({exact: true}).test('1:2:3:4:5:6:7:8/64'); +//=> true -// is not a CIDR v6 -cidrv6.test('fe80:0000:0000:0000:0204:61ff:fe9d:f156/a') // false +'foo 192.168.0.1/24 bar 1:2:3:4:5:6:7:8/64 baz'.match(cidrRegex()); +//=> ['192.168.0.1/24', '1:2:3:4:5:6:7:8/64'] ``` ## API -### cidr +### cidrRegex([options]) + +Returns a regex for matching both IPv4 and IPv6 CIDR IP addresses. + +### cidrRegex.v4([options]) + +Returns a regex for matching IPv4 CIDR IP addresses. + +### cidrRegex.v6([options]) + +Returns a regex for matching IPv6 CIDR IP addresses. + +#### options.exact -A regex for matching CIDR IPv4 +Type: `boolean`
+Default: `false` *(Matches any CIDR IP address in a string)* -### cidrv4 +Only match an exact string. Useful with `RegExp#test()` to check if a string is a CIDR IP address. -A regex for matching CIDR IPv4 -### cidrv6 +## Related -A regex for matching CIDR IPv6 +- [is-cidr](https://github.com/silverwind/is-cidr) - Check if a string is an IP address in CIDR notation +- [is-ip](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) diff --git a/node_modules/is-cidr/node_modules/cidr-regex/index.js b/node_modules/is-cidr/node_modules/cidr-regex/index.js new file mode 100644 index 000000000..190cefa7b --- /dev/null +++ b/node_modules/is-cidr/node_modules/cidr-regex/index.js @@ -0,0 +1,13 @@ +"use strict"; + +const ipRegex = require("ip-regex"); + +const v4 = ipRegex.v4().source + "\\/(3[0-2]|[12]?[0-9])"; +const v6 = ipRegex.v6().source + "\\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])"; + +const ip = module.exports = opts => opts && opts.exact ? + new RegExp(`(?:^${v4}$)|(?:^${v6}$)`) : + new RegExp(`(?:${v4})|(?:${v6})`, "g"); + +ip.v4 = opts => opts && opts.exact ? new RegExp(`^${v4}$`) : new RegExp(v4, "g"); +ip.v6 = opts => opts && opts.exact ? new RegExp(`^${v6}$`) : new RegExp(v6, "g"); diff --git a/node_modules/is-cidr/node_modules/cidr-regex/lib/index.js b/node_modules/is-cidr/node_modules/cidr-regex/lib/index.js deleted file mode 100644 index 44533ae3a..000000000 --- a/node_modules/is-cidr/node_modules/cidr-regex/lib/index.js +++ /dev/null @@ -1,10 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -var cidrv4 = exports.cidrv4 = /^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])(\/([0-9]|[1-2][0-9]|3[0-2]))$/; - -var cidrv6 = exports.cidrv6 = /^s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3}))|:)))(%.+)?s*(\/([0-9]|[1-9][0-9]|1[0-1][0-9]|12[0-8]))?$/; - -exports.default = cidrv4; \ No newline at end of file diff --git a/node_modules/is-cidr/node_modules/cidr-regex/node_modules/ip-regex/index.js b/node_modules/is-cidr/node_modules/cidr-regex/node_modules/ip-regex/index.js new file mode 100644 index 000000000..973e5f41c --- /dev/null +++ b/node_modules/is-cidr/node_modules/cidr-regex/node_modules/ip-regex/index.js @@ -0,0 +1,24 @@ +'use strict'; + +const v4 = '(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])(?:\\.(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])){3}'; + +const v6seg = '[0-9a-fA-F]{1,4}'; +const v6 = ` +( +(?:${v6seg}:){7}(?:${v6seg}|:)| // 1:2:3:4:5:6:7:: 1:2:3:4:5:6:7:8 +(?:${v6seg}:){6}(?:${v4}|:${v6seg}|:)| // 1:2:3:4:5:6:: 1:2:3:4:5:6::8 1:2:3:4:5:6::8 1:2:3:4:5:6::1.2.3.4 +(?:${v6seg}:){5}(?::${v4}|(:${v6seg}){1,2}|:)| // 1:2:3:4:5:: 1:2:3:4:5::7:8 1:2:3:4:5::8 1:2:3:4:5::7:1.2.3.4 +(?:${v6seg}:){4}(?:(:${v6seg}){0,1}:${v4}|(:${v6seg}){1,3}|:)| // 1:2:3:4:: 1:2:3:4::6:7:8 1:2:3:4::8 1:2:3:4::6:7:1.2.3.4 +(?:${v6seg}:){3}(?:(:${v6seg}){0,2}:${v4}|(:${v6seg}){1,4}|:)| // 1:2:3:: 1:2:3::5:6:7:8 1:2:3::8 1:2:3::5:6:7:1.2.3.4 +(?:${v6seg}:){2}(?:(:${v6seg}){0,3}:${v4}|(:${v6seg}){1,5}|:)| // 1:2:: 1:2::4:5:6:7:8 1:2::8 1:2::4:5:6:7:1.2.3.4 +(?:${v6seg}:){1}(?:(:${v6seg}){0,4}:${v4}|(:${v6seg}){1,6}|:)| // 1:: 1::3:4:5:6:7:8 1::8 1::3:4:5:6:7:1.2.3.4 +(?::((?::${v6seg}){0,5}:${v4}|(?::${v6seg}){1,7}|:)) // ::2:3:4:5:6:7:8 ::2:3:4:5:6:7:8 ::8 ::1.2.3.4 +)(%[0-9a-zA-Z]{1,})? // %eth0 %1 +`.replace(/\s*\/\/.*$/gm, '').replace(/\n/g, '').trim(); + +const ip = module.exports = opts => opts && opts.exact ? + new RegExp(`(?:^${v4}$)|(?:^${v6}$)`) : + new RegExp(`(?:${v4})|(?:${v6})`, 'g'); + +ip.v4 = opts => opts && opts.exact ? new RegExp(`^${v4}$`) : new RegExp(v4, 'g'); +ip.v6 = opts => opts && opts.exact ? new RegExp(`^${v6}$`) : new RegExp(v6, 'g'); diff --git a/node_modules/is-cidr/node_modules/cidr-regex/node_modules/ip-regex/license b/node_modules/is-cidr/node_modules/cidr-regex/node_modules/ip-regex/license new file mode 100644 index 000000000..654d0bfe9 --- /dev/null +++ b/node_modules/is-cidr/node_modules/cidr-regex/node_modules/ip-regex/license @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Sindre Sorhus (sindresorhus.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/node_modules/is-cidr/node_modules/cidr-regex/node_modules/ip-regex/package.json b/node_modules/is-cidr/node_modules/cidr-regex/node_modules/ip-regex/package.json new file mode 100644 index 000000000..427bc9917 --- /dev/null +++ b/node_modules/is-cidr/node_modules/cidr-regex/node_modules/ip-regex/package.json @@ -0,0 +1,77 @@ +{ + "_from": "ip-regex@^2.1.0", + "_id": "ip-regex@2.1.0", + "_inBundle": false, + "_integrity": "sha1-+ni/XS5pE8kRzp+BnuUUa7bYROk=", + "_location": "/is-cidr/cidr-regex/ip-regex", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "ip-regex@^2.1.0", + "name": "ip-regex", + "escapedName": "ip-regex", + "rawSpec": "^2.1.0", + "saveSpec": null, + "fetchSpec": "^2.1.0" + }, + "_requiredBy": [ + "/is-cidr/cidr-regex" + ], + "_resolved": "https://registry.npmjs.org/ip-regex/-/ip-regex-2.1.0.tgz", + "_shasum": "fa78bf5d2e6913c911ce9f819ee5146bb6d844e9", + "_spec": "ip-regex@^2.1.0", + "_where": "/Users/rebecca/code/npm/node_modules/is-cidr/node_modules/cidr-regex", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "bugs": { + "url": "https://github.com/sindresorhus/ip-regex/issues" + }, + "bundleDependencies": false, + "deprecated": false, + "description": "Regular expression for matching IP addresses (IPv4 & IPv6)", + "devDependencies": { + "ava": "*", + "xo": "*" + }, + "engines": { + "node": ">=4" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/sindresorhus/ip-regex#readme", + "keywords": [ + "ip", + "ipv6", + "ipv4", + "regex", + "regexp", + "re", + "match", + "test", + "find", + "text", + "pattern", + "internet", + "protocol", + "address", + "validate" + ], + "license": "MIT", + "name": "ip-regex", + "repository": { + "type": "git", + "url": "git+https://github.com/sindresorhus/ip-regex.git" + }, + "scripts": { + "test": "xo && ava" + }, + "version": "2.1.0", + "xo": { + "esnext": true + } +} diff --git a/node_modules/is-cidr/node_modules/cidr-regex/node_modules/ip-regex/readme.md b/node_modules/is-cidr/node_modules/cidr-regex/node_modules/ip-regex/readme.md new file mode 100644 index 000000000..66bc7f273 --- /dev/null +++ b/node_modules/is-cidr/node_modules/cidr-regex/node_modules/ip-regex/readme.md @@ -0,0 +1,63 @@ +# ip-regex [![Build Status](https://travis-ci.org/sindresorhus/ip-regex.svg?branch=master)](https://travis-ci.org/sindresorhus/ip-regex) + +> Regular expression for matching IP addresses + + +## Install + +``` +$ npm install --save ip-regex +``` + + +## Usage + +```js +const ipRegex = require('ip-regex'); + +// Contains an IP address? +ipRegex().test('unicorn 192.168.0.1'); +//=> true + +// Is an IP address? +ipRegex({exact: true}).test('unicorn 192.168.0.1'); +//=> false + +ipRegex.v6({exact: true}).test('1:2:3:4:5:6:7:8'); +//=> true + +'unicorn 192.168.0.1 cake 1:2:3:4:5:6:7:8 rainbow'.match(ipRegex()); +//=> ['192.168.0.1', '1:2:3:4:5:6:7:8'] +``` + + +## API + +### ipRegex([options]) + +Returns a regex for matching both IPv4 and IPv6. + +### ipRegex.v4([options]) + +Returns a regex for matching IPv4. + +### ipRegex.v6([options]) + +Returns a regex for matching IPv6. + +#### options.exact + +Type: `boolean`
+Default: `false` *(Matches any IP address in a string)* + +Only match an exact string. Useful with `RegExp#test()` to check if a string is an IP address. + + +## Related + +- [is-ip](https://github.com/sindresorhus/is-ip) - Check if a string is an IP address + + +## License + +MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/node_modules/is-cidr/node_modules/cidr-regex/package.json b/node_modules/is-cidr/node_modules/cidr-regex/package.json index 0c23adf20..869d90aad 100644 --- a/node_modules/is-cidr/node_modules/cidr-regex/package.json +++ b/node_modules/is-cidr/node_modules/cidr-regex/package.json @@ -1,68 +1,78 @@ { - "_from": "cidr-regex@1.0.6", - "_id": "cidr-regex@1.0.6", + "_from": "cidr-regex@^2.0.8", + "_id": "cidr-regex@2.0.8", "_inBundle": false, - "_integrity": "sha1-dKv9YZ3zcLnVSrFEdVaOl91kwME=", + "_integrity": "sha512-3r0E5P6Oeg4SCvEERX7W5fPkPz8nKWwGzU6RJ/VvROOsqiq5g6sf43c/g+sUpA29Htc7R0SG15P/Scr5lfap4g==", "_location": "/is-cidr/cidr-regex", "_phantomChildren": {}, "_requested": { - "type": "version", + "type": "range", "registry": true, - "raw": "cidr-regex@1.0.6", + "raw": "cidr-regex@^2.0.8", "name": "cidr-regex", "escapedName": "cidr-regex", - "rawSpec": "1.0.6", + "rawSpec": "^2.0.8", "saveSpec": null, - "fetchSpec": "1.0.6" + "fetchSpec": "^2.0.8" }, "_requiredBy": [ "/is-cidr" ], - "_resolved": "https://registry.npmjs.org/cidr-regex/-/cidr-regex-1.0.6.tgz", - "_shasum": "74abfd619df370b9d54ab14475568e97dd64c0c1", - "_spec": "cidr-regex@1.0.6", + "_resolved": "https://registry.npmjs.org/cidr-regex/-/cidr-regex-2.0.8.tgz", + "_shasum": "c79bae6223d241c0860d93bfde1fb1c1c4fdcab6", + "_spec": "cidr-regex@^2.0.8", "_where": "/Users/rebecca/code/npm/node_modules/is-cidr", "author": { - "name": "Felipe Apostol", - "email": "flipjs.io@gmail.com", - "url": "http://flipjs.io/" - }, - "babel": { - "presets": [ - "es2015" - ] + "name": "silverwind", + "email": "me@silverwind.io" }, "bugs": { - "url": "https://github.com/flipjs/cidr-regex/issues" + "url": "https://github.com/silverwind/cidr-regex/issues" }, "bundleDependencies": false, + "contributors": [ + { + "name": "Felipe Apostol", + "email": "flipjs.io@gmail.com", + "url": "http://flipjs.io/" + } + ], + "dependencies": { + "ip-regex": "^2.1.0" + }, "deprecated": false, - "description": "Regular expression for matching CIDR (Classless Inter-Domain Routing)", + "description": "Regular expression for matching IP addresses in CIDR notation", "devDependencies": { - "ava": "0.13.0", - "babel-cli": "6.6.5", - "babel-preset-es2015": "6.6.0", - "babel-register": "6.7.2" + "ava": "^0.25.0", + "eslint": "^4.18.2", + "eslint-config-silverwind": "^1.0.37", + "updates": "^2.3.1" + }, + "engines": { + "node": ">=4" }, - "homepage": "https://github.com/flipjs/cidr-regex#readme", + "files": [ + "index.js" + ], + "homepage": "https://github.com/silverwind/cidr-regex#readme", "keywords": [ - "ip", - "ip address", "cidr", - "netblock", - "regex" + "regex", + "notation", + "cidr notation", + "prefix", + "prefixes", + "ip", + "ip address" ], - "license": "MIT", - "main": "lib/index.js", + "license": "BSD-2-Clause", "name": "cidr-regex", "repository": { "type": "git", - "url": "git+https://github.com/flipjs/cidr-regex.git" + "url": "git+https://github.com/silverwind/cidr-regex.git" }, "scripts": { - "compile": "babel --presets es2015 -d lib/ src/", - "prepublish": "npm run compile", - "test": "ava --require babel-register" + "test": "make test" }, - "version": "1.0.6" + "version": "2.0.8" } diff --git a/node_modules/is-cidr/node_modules/cidr-regex/test.js b/node_modules/is-cidr/node_modules/cidr-regex/test.js deleted file mode 100644 index c4e4d218b..000000000 --- a/node_modules/is-cidr/node_modules/cidr-regex/test.js +++ /dev/null @@ -1,200 +0,0 @@ -'use strict' - -import test from 'ava' -import cidr, { cidrv4, cidrv6 } from './src' - -const v4 = [ - '0.0.0.0/16', - '8.8.8.8/17', - '127.0.0.1/18', - '100.100.100.100/19', - '192.168.0.1/20', - '18.101.25.153/24', - '123.23.34.2/25', - '172.26.168.134/26', - '212.58.241.131/27', - '128.0.0.0/28', - '23.71.254.72/29', - '223.255.255.255/30', - '192.0.2.235/31', - '99.198.122.146/32', - '46.51.197.88/8', - '173.194.34.134/12' -] - -const v4not = [ - '.100.100.100.100/16', - '100..100.100.100./24', - '100.100.100.100./32', - '999.999.999.999/12', - '256.256.256.256/30', - '256.100.100.100.100/26', - '123.123.123/31', - 'http://123.123.123/28', - '1000.2.3.4/14', - '999.2.3.4/8' -] - -const v6 = [ - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/0', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/1', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/2', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/3', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/5', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/6', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/7', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/8', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/9', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/11', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/12', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/13', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/14', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/15', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/16', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/17', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/18', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/19', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/20', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/21', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/22', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/23', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/24', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/25', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/26', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/27', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/28', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/29', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/30', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/31', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/32', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/33', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/34', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/35', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/36', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/37', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/38', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/39', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/40', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/41', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/42', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/43', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/44', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/45', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/46', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/47', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/48', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/49', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/50', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/51', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/52', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/53', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/54', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/55', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/56', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/57', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/58', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/59', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/60', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/61', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/62', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/63', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/64', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/65', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/66', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/67', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/68', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/69', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/70', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/71', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/72', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/73', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/74', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/75', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/76', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/77', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/78', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/79', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/80', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/81', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/82', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/83', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/84', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/85', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/86', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/87', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/88', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/89', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/90', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/91', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/92', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/93', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/94', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/95', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/96', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/97', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/98', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/99', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/100', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/101', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/102', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/103', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/104', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/105', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/106', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/107', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/108', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/109', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/110', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/111', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/112', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/113', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/114', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/115', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/116', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/117', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/118', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/119', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/120', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/121', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/122', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/123', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/124', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/125', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/126', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/127', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/128', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156' -] - -const v6not = [ - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/129', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/a', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/√', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/00', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/03', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/sdfsdfs', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/' -] - -test('cidr v4', (t) => { - v4.forEach((string) => { - t.true(cidr.test(string)) - }) - - v4not.forEach((string) => { - t.false(cidrv4.test(string)) - }) -}) - -test('cidr v6', (t) => { - v6.forEach((string) => { - t.true(cidrv6.test(string)) - }) - - v6not.forEach((string) => { - t.false(cidrv6.test(string)) - }) -}) - diff --git a/node_modules/is-cidr/package.json b/node_modules/is-cidr/package.json index 982863d83..5e81ad10b 100644 --- a/node_modules/is-cidr/package.json +++ b/node_modules/is-cidr/package.json @@ -1,94 +1,79 @@ { - "_from": "is-cidr", - "_id": "is-cidr@1.0.0", + "_from": "is-cidr@2.0.5", + "_id": "is-cidr@2.0.5", "_inBundle": false, - "_integrity": "sha1-+1qs9lklUxA1naMsrgPkDGocKvw=", + "_integrity": "sha512-KUGux04sdwBgpr/YREUyuefs4s1Ib4mRmOCIX1KdPnxjUCZMg13BXEp68Uw5IiDl3N4ZZtStDgPu4MWJxNBpKQ==", "_location": "/is-cidr", "_phantomChildren": {}, "_requested": { - "type": "tag", + "type": "version", "registry": true, - "raw": "is-cidr", + "raw": "is-cidr@2.0.5", "name": "is-cidr", "escapedName": "is-cidr", - "rawSpec": "", + "rawSpec": "2.0.5", "saveSpec": null, - "fetchSpec": "latest" + "fetchSpec": "2.0.5" }, "_requiredBy": [ "#USER", "/" ], - "_resolved": "https://registry.npmjs.org/is-cidr/-/is-cidr-1.0.0.tgz", - "_shasum": "fb5aacf659255310359da32cae03e40c6a1c2afc", - "_spec": "is-cidr", + "_resolved": "https://registry.npmjs.org/is-cidr/-/is-cidr-2.0.5.tgz", + "_shasum": "13227927d71865d1177fe0e5b60e6ddd3dee0034", + "_spec": "is-cidr@2.0.5", "_where": "/Users/rebecca/code/npm", "author": { - "name": "Felipe Apostol", - "email": "flipjs.io@gmail.com", - "url": "http://flipjs.io/" - }, - "babel": { - "presets": [ - "es2015" - ] + "name": "silverwind", + "email": "me@silverwind.io" }, "bugs": { - "url": "https://github.com/flipjs/is-cidr/issues" + "url": "https://github.com/silverwind/is-cidr/issues" }, "bundleDependencies": false, - "config": { - "commitizen": { - "path": "node_modules/cz-conventional-changelog" - }, - "ghooks": { - "pre-commit": "npm run test && npm run build" + "contributors": [ + { + "name": "Felipe Apostol", + "email": "flipjs.io@gmail.com", + "url": "http://flipjs.io/" } - }, + ], "dependencies": { - "cidr-regex": "1.0.6" + "cidr-regex": "^2.0.8" }, "deprecated": false, - "description": "Check if a string is a valid CIDR", + "description": "Check if a string is an IP address in CIDR notation", "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.25.0", + "eslint": "^4.18.2", + "eslint-config-silverwind": "^1.0.37", + "updates": "^2.3.1" + }, + "engines": { + "node": ">=4" }, - "homepage": "https://github.com/flipjs/is-cidr#readme", + "files": [ + "index.js" + ], + "homepage": "https://github.com/silverwind/is-cidr#readme", "keywords": [ - "ip", - "ip address", "cidr", - "netblock", - "regex" + "regex", + "notation", + "cidr notation", + "prefix", + "prefixes", + "ip", + "ip address" ], - "license": "MIT", - "main": "lib/index.js", + "license": "BSD-2-Clause", "name": "is-cidr", "repository": { "type": "git", - "url": "git+https://github.com/flipjs/is-cidr.git" + "url": "git+https://github.com/silverwind/is-cidr.git" }, "scripts": { - "build": "babel --presets es2015 -d lib/ src/", - "clean": "rimraf lib && mkdir lib", - "commit": "git-cz", - "lint": "eslint src/ test/", - "prebuild": "npm run lint && npm run clean", - "semantic-release": "semantic-release pre && npm publish && semantic-release post", - "test": "ava --require babel-register" + "test": "make test" }, - "version": "1.0.0" + "version": "2.0.5" } diff --git a/node_modules/is-cidr/test/index.test.js b/node_modules/is-cidr/test/index.test.js deleted file mode 100644 index 93a801295..000000000 --- a/node_modules/is-cidr/test/index.test.js +++ /dev/null @@ -1,200 +0,0 @@ -'use strict' - -import test from 'ava' -import isCidr, { isCidrV4, isCidrV6 } from '../src' - -const v4 = [ - '0.0.0.0/16', - '8.8.8.8/17', - '127.0.0.1/18', - '100.100.100.100/19', - '192.168.0.1/20', - '18.101.25.153/24', - '123.23.34.2/25', - '172.26.168.134/26', - '212.58.241.131/27', - '128.0.0.0/28', - '23.71.254.72/29', - '223.255.255.255/30', - '192.0.2.235/31', - '99.198.122.146/32', - '46.51.197.88/8', - '173.194.34.134/12' -] - -const v4not = [ - '.100.100.100.100/16', - '100..100.100.100./24', - '100.100.100.100./32', - '999.999.999.999/12', - '256.256.256.256/30', - '256.100.100.100.100/26', - '123.123.123/31', - 'http://123.123.123/28', - '1000.2.3.4/14', - '999.2.3.4/8' -] - -const v6 = [ - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/0', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/1', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/2', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/3', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/5', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/6', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/7', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/8', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/9', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/11', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/12', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/13', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/14', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/15', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/16', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/17', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/18', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/19', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/20', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/21', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/22', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/23', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/24', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/25', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/26', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/27', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/28', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/29', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/30', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/31', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/32', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/33', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/34', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/35', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/36', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/37', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/38', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/39', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/40', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/41', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/42', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/43', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/44', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/45', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/46', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/47', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/48', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/49', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/50', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/51', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/52', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/53', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/54', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/55', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/56', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/57', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/58', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/59', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/60', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/61', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/62', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/63', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/64', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/65', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/66', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/67', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/68', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/69', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/70', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/71', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/72', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/73', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/74', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/75', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/76', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/77', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/78', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/79', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/80', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/81', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/82', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/83', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/84', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/85', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/86', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/87', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/88', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/89', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/90', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/91', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/92', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/93', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/94', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/95', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/96', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/97', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/98', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/99', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/100', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/101', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/102', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/103', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/104', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/105', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/106', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/107', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/108', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/109', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/110', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/111', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/112', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/113', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/114', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/115', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/116', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/117', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/118', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/119', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/120', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/121', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/122', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/123', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/124', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/125', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/126', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/127', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/128', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156' -] - -const v6not = [ - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/129', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/a', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/√', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/00', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/03', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/sdfsdfs', - 'fe80:0000:0000:0000:0204:61ff:fe9d:f156/' -] - -test('cidr v4', (t) => { - v4.forEach((string) => { - t.true(isCidr(string)) - }) - - v4not.forEach((string) => { - t.false(isCidrV4(string)) - }) -}) - -test('cidr v6', (t) => { - v6.forEach((string) => { - t.true(isCidrV6(string)) - }) - - v6not.forEach((string) => { - t.false(isCidrV6(string)) - }) -}) - -- cgit v1.2.3