anchor-validation
Advanced tools
Comparing version 1.2.5 to 1.2.6
27
index.js
@@ -21,3 +21,4 @@ 'use strict'; | ||
}); | ||
var required = exports.required = function required(value, error) { | ||
var required = exports.required = function required(value) { | ||
var error = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; | ||
return value ? undefined : error; | ||
@@ -27,3 +28,4 @@ }; | ||
var maxLength = exports.maxLength = function maxLength(max) { | ||
return function (value, error) { | ||
return function (value) { | ||
var error = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; | ||
return value && value.length > max ? error : undefined; | ||
@@ -34,3 +36,4 @@ }; | ||
var minLength = exports.minLength = function minLength(min) { | ||
return function (value, error) { | ||
return function (value) { | ||
var error = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; | ||
return value && value.length < min ? error : undefined; | ||
@@ -40,7 +43,10 @@ }; | ||
var isAlphanumeric = exports.isAlphanumeric = function isAlphanumeric(value, error) { | ||
var isAlphanumeric = exports.isAlphanumeric = function isAlphanumeric(value) { | ||
var error = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; | ||
return value && /[^a-zA-Z0-9]/.test(value) ? error : undefined; | ||
}; | ||
var isEmail = exports.isEmail = function isEmail(value, error) { | ||
var isEmail = exports.isEmail = function isEmail(value) { | ||
var error = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; | ||
var emailRegex = /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i; | ||
@@ -50,8 +56,15 @@ return value && !emailRegex.test(value) ? error : undefined; | ||
var isEqual = exports.isEqual = function isEqual(value, comparison, error) { | ||
var isEqual = exports.isEqual = function isEqual(value, comparison) { | ||
var error = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true; | ||
return value && comparison && value !== comparison ? error : undefined; | ||
}; | ||
var isNotEqual = exports.isNotEqual = function isNotEqual(value, comparison, error) { | ||
var isNotEqual = exports.isNotEqual = function isNotEqual(value, comparison) { | ||
var error = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true; | ||
return value && comparison && value === comparison ? error : undefined; | ||
}; | ||
var oneOf = exports.oneOf = function oneOf(fn1, fn2) { | ||
var error = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true; | ||
return fn1 || fn2 ? error : undefined; | ||
}; |
{ | ||
"name": "anchor-validation", | ||
"version": "1.2.5", | ||
"version": "1.2.6", | ||
"description": "anchor-validation for anchor-ui kit", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
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
5469
78