@darkwolf/validator
Advanced tools
Comparing version 13.21.71 to 13.21.72
@@ -0,1 +1,3 @@ | ||
const BASE58_ALPHABET = 'AveDarkwo1f23456789BCEFGHJKLMNPQRSTUVWXYZbcdghijmnpqstuxyz' | ||
const TIMESTAMP_REGEX = /^[1-9]\d{11,12}$/ | ||
@@ -11,6 +13,9 @@ const UNIX_TIMESTAMP_REGEX = /^[1-9]\d{8,9}$/ | ||
const BASE64URL_REGEX = /^[\w-]+$/ | ||
const BASE58_REGEX = /^[AveDarkwo1f23456789BCEFGHJKLMNPQRSTUVWXYZbcdghijmnpqstuxyz]+$/ | ||
const BASE58_REGEX = new RegExp(`^[${BASE58_ALPHABET}]+$`) | ||
const JWT_REGEX = /^[\w-]+\.[\w-]+\.[\w-]*$/ | ||
const HASH_REGEX = new RegExp(`^[${BASE58_ALPHABET}]{64}$`) | ||
const UID_REGEX = new RegExp(`^[${BASE58_ALPHABET}]{20}$`) | ||
module.exports = { | ||
BASE58_ALPHABET, | ||
TIMESTAMP_REGEX, | ||
@@ -27,3 +32,5 @@ UNIX_TIMESTAMP_REGEX, | ||
BASE58_REGEX, | ||
JWT_REGEX | ||
JWT_REGEX, | ||
HASH_REGEX, | ||
UID_REGEX | ||
} |
@@ -56,2 +56,3 @@ const CodeError = require('@darkwolf/code-error') | ||
const isNonPositive = value => isLessEqual(value, 0) | ||
const isNatural = value => isInteger(value) && isPositive(value) | ||
const isEven = value => isInteger(value) && !(value % 2) | ||
@@ -138,2 +139,4 @@ const isOdd = value => isInteger(value) && !!(value % 2) | ||
const isJWT = value => constants.JWT_REGEX.test(value) | ||
const isHash = value => constants.HASH_REGEX.test(value) | ||
const isUid = value => constants.UID_REGEX.test(value) | ||
@@ -185,2 +188,3 @@ module.exports = { | ||
isNonPositive, | ||
isNatural, | ||
isEven, | ||
@@ -214,3 +218,5 @@ isOdd, | ||
isBase58, | ||
isJWT | ||
isJWT, | ||
isHash, | ||
isUid | ||
} |
{ | ||
"name": "@darkwolf/validator", | ||
"version": "13.21.71", | ||
"version": "13.21.72", | ||
"description": "Validator", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -58,2 +58,3 @@ # Validator | ||
### isNonPositive(value) | ||
### isNatural(value) | ||
### isEven(value) | ||
@@ -88,1 +89,3 @@ ### isOdd(value) | ||
### isJWT(value) | ||
### isHash(value) | ||
### isUid(value) |
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
12618
239
90