-
Notifications
You must be signed in to change notification settings - Fork 10
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
1 parent
c40d18f
commit 538ef33
Showing
10 changed files
with
11,244 additions
and
64 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 |
---|---|---|
|
@@ -11,4 +11,3 @@ insert_final_newline = true | |
|
||
[Makefile] | ||
indent_style = tab | ||
indent_size = 2 |
File renamed without changes.
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
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
node_modules | ||
npm-debug.log* | ||
yarn-error.log | ||
yarn.lock | ||
.vscode/ | ||
/.vscode | ||
/node_modules | ||
/npm-debug.log* | ||
/yarn-error.log | ||
/yarn.lock |
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 |
---|---|---|
@@ -1 +1,5 @@ | ||
package-lock=false | ||
audit=false | ||
fund=false | ||
package-lock=true | ||
save-exact=true | ||
update-notifier=false |
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 |
---|---|---|
@@ -1,33 +1,41 @@ | ||
test: | ||
yarn -s run eslint --color . | ||
yarn -s run tsd | ||
yarn -s run jest --color | ||
node_modules: package-lock.json | ||
npm install --no-save | ||
@touch node_modules | ||
|
||
unittest: | ||
yarn -s run jest --color --watchAll | ||
.PHONY: deps | ||
deps: node_modules | ||
|
||
publish: | ||
git push -u --tags origin master | ||
npm publish | ||
|
||
deps: | ||
rm -rf node_modules | ||
yarn | ||
|
||
update: | ||
yarn -s run updates -cu | ||
$(MAKE) deps | ||
.PHONY: lint | ||
lint: node_modules | ||
npx eslint --color . | ||
|
||
patch: test | ||
yarn -s run versions -C patch | ||
$(MAKE) publish | ||
.PHONY: test | ||
test: node_modules | ||
NODE_OPTIONS="--experimental-vm-modules --no-warnings" npx jest --color | ||
|
||
minor: test | ||
yarn -s run versions -C minor | ||
$(MAKE) publish | ||
|
||
major: test | ||
yarn -s run versions -C major | ||
$(MAKE) publish | ||
.PHONY: publish | ||
publish: node_modules | ||
git push -u --tags origin master | ||
npm publish | ||
|
||
.PHONY: test unittest publish deps update patch minor major | ||
.PHONY: update | ||
update: node_modules | ||
npx updates -cu | ||
rm package-lock.json | ||
npm install | ||
@touch node_modules | ||
|
||
.PHONY: path | ||
patch: node_modules lint test | ||
npx versions -C patch | ||
@$(MAKE) --no-print-directory publish | ||
|
||
.PHONY: minor | ||
minor: node_modules lint test | ||
npx versions -C minor | ||
@$(MAKE) --no-print-directory publish | ||
|
||
.PHONY: major | ||
major: node_modules lint test | ||
npx versions -C major | ||
@$(MAKE) --no-print-directory publish |
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 |
---|---|---|
@@ -1,18 +1,15 @@ | ||
"use strict"; | ||
|
||
const ipRegex = require("ip-regex"); | ||
import ipRegex from "ip-regex"; | ||
|
||
const defaultOpts = {exact: false}; | ||
|
||
const v4str = `${ipRegex.v4().source}\\/(3[0-2]|[12]?[0-9])`; | ||
const v6str = `${ipRegex.v6().source}\\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])`; | ||
|
||
// can not precompile the non-exact regexes because global flag makes the regex object stateful | ||
// which would require the user to reset .lastIndex on subsequent calls | ||
// pre-compile only the exact regexes as global flag makes regex objects stateful | ||
const v4exact = new RegExp(`^${v4str}$`); | ||
const v6exact = new RegExp(`^${v6str}$`); | ||
const v46exact = new RegExp(`(?:^${v4str}$)|(?:^${v6str}$)`); | ||
|
||
module.exports = ({exact} = defaultOpts) => exact ? v46exact : new RegExp(`(?:${v4str})|(?:${v6str})`, "g"); | ||
module.exports.v4 = ({exact} = defaultOpts) => exact ? v4exact : new RegExp(v4str, "g"); | ||
module.exports.v6 = ({exact} = defaultOpts) => exact ? v6exact : new RegExp(v6str, "g"); | ||
const cidrRegex = ({exact} = defaultOpts) => exact ? v46exact : new RegExp(`(?:${v4str})|(?:${v6str})`, "g"); | ||
export const v4 = cidrRegex.v4 = ({exact} = defaultOpts) => exact ? v4exact : new RegExp(v4str, "g"); | ||
export const v6 = cidrRegex.v6 = ({exact} = defaultOpts) => exact ? v6exact : new RegExp(v6str, "g"); | ||
export default cidrRegex; |
Oops, something went wrong.