repocrypts / Validator

Client-side javascript validator library ports from Laravel 5.2
MIT License
46 stars 22 forks source link

Wrongly formatted error messages #25

Closed filipesantoss closed 4 years ago

filipesantoss commented 4 years ago

Whenever a variable name consists of more than two words, underscores are inserted between every word starting at the second one - instead of spaces - in the error messages.

The following code

const Validator = require('Validator');

const data = { theeWordName: '' };
const rules = { theeWordName: 'required|min:1' };

const validator = Validator.make(data, rules);

if (validator.fails()) {
    console.log(validator.getErrors());
}

Produces the following output

{
  theeWordName: [
    'The thee word_name field is required.',
    'The thee word_name must be at least 1 characters.'
  ]
}
jfstn commented 4 years ago

I'll take a look at this this weekend.