@darkwolf/validator
Advanced tools
Comparing version 6.7.1 to 6.7.2
{ | ||
"name": "@darkwolf/validator", | ||
"version": "6.7.1", | ||
"version": "6.7.2", | ||
"description": "Validator", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
@@ -41,2 +41,3 @@ # Validator | ||
### isFunction(value?) | ||
### isCallback(value?) | ||
### isBoolean(value?) | ||
@@ -43,0 +44,0 @@ ### isNumber(value?) |
const TIMESTAMP_REGEX = /^[1-9]\d{11,12}$/ | ||
const UNIX_TIMESTAMP_REGEX = /^[1-9]\d{8,9}$/ | ||
const UUID_REGEX = /^[a-f\d]{8}-[a-f\d]{4}-[a-f\d]{4}-[a-f\d]{4}-[a-f\d]{12}$/i | ||
const IPV4_REGEX = /^((\d|[1-9]\d|1\d{2}|2[0-4]\d|25[0-5])\.){3}(\d|[1-9]\d|1\d{2}|2[0-4]\d|25[0-5])$/ | ||
const IPv4_REGEX = /^((\d|[1-9]\d|1\d{2}|2[0-4]\d|25[0-5])\.){3}(\d|[1-9]\d|1\d{2}|2[0-4]\d|25[0-5])$/ | ||
const URL_REGEX = /^(https?:\/\/)?((([a-z\d]([a-z\d-]*[a-z\d])*)\.)+[a-z]{2,}|((\d|[1-9]\d|1\d{2}|2[0-4]\d|25[0-5])\.){3}(\d|[1-9]\d|1\d{2}|2[0-4]\d|25[0-5]))(:\d+)?(\/[\w-.%+@&:~]*)*(\?[\w-.%+@&=:;,~]*)?(#[\w-]*)?$/i | ||
@@ -18,3 +18,3 @@ const EMAIL_REGEX = /^[\w-.]+@(([a-z\d]([a-z\d-]*[a-z\d])*)\.)+[a-z]{2,}$/i | ||
UUID_REGEX, | ||
IPV4_REGEX, | ||
IPv4_REGEX, | ||
URL_REGEX, | ||
@@ -21,0 +21,0 @@ EMAIL_REGEX, |
@@ -361,3 +361,3 @@ const CodeError = require('@darkwolf/code-error') | ||
_isIPv4(value) { | ||
return this._isRegex(value, constants.IPV4_REGEX) | ||
return this._isRegex(value, constants.IPv4_REGEX) | ||
} | ||
@@ -496,2 +496,6 @@ | ||
isCallback(...args) { | ||
return this.validate((...args) => this._isFunction(...args), () => `${this.name} must be a callback function`, ...args) | ||
} | ||
isBoolean(...args) { | ||
@@ -498,0 +502,0 @@ return this.validate((...args) => this._isBoolean(...args), () => `${this.name} must be boolean`, ...args) |
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
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
30433
663
110