The Wayback Machine - https://web.archive.org/web/20200910034243/https://github.com/oussamahamdaoui/forgJs/issues/65
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Duplicate error messages when check for multiple types. #65

Open
XX-NF-XX opened this issue Mar 16, 2019 · 2 comments
Open

Duplicate error messages when check for multiple types. #65

XX-NF-XX opened this issue Mar 16, 2019 · 2 comments

Comments

@XX-NF-XX
Copy link
Contributor

@XX-NF-XX XX-NF-XX commented Mar 16, 2019

Example:

const { Validator, Rule } = require('@cesium133/forgjs');

const validator = new Validator({
  value: new Rule(
    {
      type: 'int|float',
      min: 1
    },
    'Error message'
  ),
});

validator.getErrors({
  value: 0,
});  // [ 'Error message', 'Error message' ]

One rule, one custom error message, but multiple errors in array.

I was trying to fix it and send a PR, but it seems like you have unfinished or undocumented work there.

@oussamahamdaoui
Copy link
Owner

@oussamahamdaoui oussamahamdaoui commented May 12, 2019

Hello, sorry didn't have much time these days, ill look up and try to fix this

@WalterCJ
Copy link

@WalterCJ WalterCJ commented Jul 20, 2019

Hey guys, I didn't quit tested but... can't you just do something like this before adding to errors list?

if(anotherOperand && this.errorCollector.errors.length > 0){
    return false
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
3 participants
You can’t perform that action at this time.