Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
result = validator.isAlpha('sample', 'en-AU');
result = validator.isAlpha('sample', 'en-GB');
result = validator.isAlpha('sample', 'en-HK');
result = validator.isAlpha('sample', 'en-IN');
result = validator.isAlpha('sample', 'en-NZ');
result = validator.isAlpha('sample', 'en-US');
result = validator.isAlpha('sample', 'en-ZA');
result = validator.isAlpha('sample', 'en-ZM');
result = validator.isAlpha('sample', 'es-ES');
result = validator.isAlpha('sample', 'fr-FR');
result = validator.isAlpha('sample', 'hu-HU');
result = validator.isAlpha('sample', 'nl-NL');
result = validator.isAlpha('sample', 'pl-PL');
result = validator.isAlpha('sample', 'pt-BR');
result = validator.isAlpha('sample', 'pt-PT');
result = validator.isAlpha('sample', 'ru-RU');
result = validator.isAlpha('sample', 'sr-RS');
result = validator.isAlpha('sample', 'sr-RS@latin');
result = validator.isAlpha('sample', 'tr-TR');
result = validator.isAlphanumeric('sample', 'ar');
result = validator.isAlphanumeric('sample', 'ar-AE');
result = validator.isAlphanumeric('sample', 'ar-BH');
result = validator.isAlphanumeric('sample', 'ar-DZ');
result = validator.isAlphanumeric('sample', 'ar-EG');
result = validator.isAlphanumeric('sample', 'ar-IQ');
result = validator.isAlphanumeric('sample', 'ar-JO');
result = validator.isAlphanumeric('sample', 'ar-KW');
result = validator.isAlphanumeric('sample', 'ar-LB');
result = validator.isAlphanumeric('sample', 'ar-LY');
result = validator.isAlphanumeric('sample', 'ar-MA');
result = validator.isAlphanumeric('sample', 'ar-QA');
result = validator.isAlpha('sample', 'en-IN');
result = validator.isAlpha('sample', 'en-NZ');
result = validator.isAlpha('sample', 'en-US');
result = validator.isAlpha('sample', 'en-ZA');
result = validator.isAlpha('sample', 'en-ZM');
result = validator.isAlpha('sample', 'es-ES');
result = validator.isAlpha('sample', 'fr-FR');
result = validator.isAlpha('sample', 'hu-HU');
result = validator.isAlpha('sample', 'nl-NL');
result = validator.isAlpha('sample', 'pl-PL');
result = validator.isAlpha('sample', 'pt-BR');
result = validator.isAlpha('sample', 'pt-PT');
result = validator.isAlpha('sample', 'ru-RU');
result = validator.isAlpha('sample', 'sr-RS');
result = validator.isAlpha('sample', 'sr-RS@latin');
result = validator.isAlpha('sample', 'tr-TR');
result = validator.isAlphanumeric('sample', 'ar');
result = validator.isAlphanumeric('sample', 'ar-AE');
result = validator.isAlphanumeric('sample', 'ar-BH');
result = validator.isAlphanumeric('sample', 'ar-DZ');
result = validator.isAlphanumeric('sample', 'ar-EG');
result = validator.isAlphanumeric('sample', 'ar-IQ');
result = validator.isAlphanumeric('sample', 'ar-JO');
result = validator.isAlphanumeric('sample', 'ar-KW');
result = validator.isAlphanumeric('sample', 'ar-LB');
result = validator.isAlphanumeric('sample', 'ar-LY');
result = validator.isAlphanumeric('sample', 'ar-MA');
result = validator.isAlphanumeric('sample', 'ar-QA');
result = validator.isAlphanumeric('sample', 'ar-QM');
result = validator.isAlphanumeric('sample', 'ar-SA');
result = validator.isAlphanumeric('sample', 'ar-SD');
result = validator.isAlpha('sample', 'en-ZA');
result = validator.isAlpha('sample', 'en-ZM');
result = validator.isAlpha('sample', 'es-ES');
result = validator.isAlpha('sample', 'fr-FR');
result = validator.isAlpha('sample', 'hu-HU');
result = validator.isAlpha('sample', 'it-IT');
result = validator.isAlpha('sample', 'nb-NO');
result = validator.isAlpha('sample', 'nl-NL');
result = validator.isAlpha('sample', 'nn-NO');
result = validator.isAlpha('sample', 'pl-PL');
result = validator.isAlpha('sample', 'pt-BR');
result = validator.isAlpha('sample', 'pt-PT');
result = validator.isAlpha('sample', 'ru-RU');
result = validator.isAlpha('sample', 'sk-SK');
result = validator.isAlpha('sample', 'sr-RS');
result = validator.isAlpha('sample', 'sr-RS@latin');
result = validator.isAlpha('sample', 'sv-SE');
result = validator.isAlpha('sample', 'tr-TR');
result = validator.isAlpha('sample', 'uk-UA');
result = validator.isAlphanumeric('sample');
result = validator.isAlphanumeric('sample', 'ar');
result = validator.isAlphanumeric('sample', 'ar-AE');
result = validator.isAlphanumeric('sample', 'ar-BH');
result = validator.isAlphanumeric('sample', 'ar-DZ');
result = validator.isAlphanumeric('sample', 'ar-EG');
result = validator.isAlphanumeric('sample', 'ar-IQ');
result = validator.isAlphanumeric('sample', 'ar-JO');
result = validator.isAlphanumeric('sample', 'ar-KW');
result = validator.isAlphanumeric('sample', 'ar-LB');
result = validator.isAlphanumeric('sample', 'ar-LY');
result = validator.isAlphanumeric('sample', 'ar-MA');
rule: value => {
return validator.isAlpha(value);
},
hint: value => {
is_valid = false;
}
break;
case "real":
case "float":
if (!this.isNumeric(text) && !validator.isFloat(text)) {
is_valid = false;
}
break;
case "decimal":
if (!this.isNumeric(text) && !validator.isDecimal(text)) {
is_valid = false;
}
break;
case "alpha":
if (!validator.isAlpha(text)) {
is_valid = false;
}
break;
case "alphanumeric":
if (!validator.isAlphanumeric(text)) {
is_valid = false;
}
break;
}
if (validator.isEmpty(text)){
is_valid = !(this.props.required);
}
return is_valid;
}
is_valid = false;
}
break;
case "real":
case "float":
if (!this.isNumeric(text) && !validator.isFloat(text)) {
is_valid = false;
}
break;
case "decimal":
if (!this.isNumeric(text) && !validator.isDecimal(text)) {
is_valid = false;
}
break;
case "alpha":
if (!validator.isAlpha(text)) {
is_valid = false;
}
break;
case "alphanumeric":
if (!validator.isAlphanumeric(text)) {
is_valid = false;
}
break;
}
if (validator.isEmpty(text)){
is_valid = !(this.props.required);
}
return is_valid;
}
Validator.alpha = value => {
return !value || validator.isAlpha(value);
};
/**
? this.formatMessage(index, this.buildMessage('url', formName))
: resetMessage
case 'ip':
return value && !validator.isIP(value)
? this.formatMessage(index, this.buildMessage('ip', formName))
: resetMessage
case 'date':
return value && !validator.isDate(value)
? this.formatMessage(index, this.buildMessage('date', formName))
: resetMessage
case 'bool':
return value && !validator.isBoolean(value)
? this.formatMessage(index, this.buildMessage('bool', formName))
: resetMessage
case 'alpha':
return value && !validator.isAlpha(value)
? this.formatMessage(index, this.buildMessage('alpha', formName))
: resetMessage
case 'num':
return value && !validator.isNumeric(value)
? this.formatMessage(index, this.buildMessage('num', formName))
: resetMessage
case 'alphanumeric':
return value && !validator.isAlphanumeric(value)
? this.formatMessage(index, this.buildMessage('alphanumeric', formName))
: resetMessage
case 'min':
return value && value.length < rule.min
? this.formatMessage(index, this.buildMessage('min', formName, rule.min))
: resetMessage
case 'max':
return value && value.length > rule.max
function isAlpha(str, options){
var isValid = validator.isAlpha(str);
if(isValid && !_.isUndefined(options)){
isValid = validator.isLength(str, options.min, options.max);
}
return isValid;
}