Validador de reacción simple
constructor() {
this.validator = new SimpleReactValidator({
validators: {
ip: { // name the rule
message: 'The :attribute must be a valid IP address and must be :values.',
rule: (val, params, validator) => {
return validator.helpers.testRegex(val,/^(?!0)(?!.*\.$)((1?\d?\d|25[0-5]|2[0-4]\d)(\.|$)){4}$/i) && params.indexOf(val) === -1
},
messageReplace: (message, params) => message.replace(':values', this.helpers.toSentence(params)), // optional
required: true // optional
}
}
});
}
Gaurav Grover