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

Need validation for comparing 2 value must not be equal #58

Open
ThuyTrang144 opened this issue Mar 20, 2023 · 0 comments
Open

Need validation for comparing 2 value must not be equal #58

ThuyTrang144 opened this issue Mar 20, 2023 · 0 comments

Comments

@ThuyTrang144
Copy link

ThuyTrang144 commented Mar 20, 2023

Missing validation for compare 2 value must be different

compareValue(value, fieldProps, validationName, validationParams, globalValue) {
    const { field, function: fn } = validationParams;
    const valueToCompare = globalValue[field];

    const allowed = {
      match: () => valueToCompare === value,
      notMatch: () => valueToCompare !== value,
    };

    if (!Object.hasOwnProperty.call(allowed, fn)) {
      throw new CollectError(
        `compareValue function "${fn}" does not exist. Allowed: ${Object.keys(allowed).join(', ')}`
      );
    }
    return allowed[fn]();
  },

I want to update one more validation for 2 value must be not equal. Please help me to check a look and this. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant