Skip to content

Ability to register a rule per validator instance #465

Description

@foxhound87

Hello,
right now to register a new rule you have to call Validator.register() and the rule is available in a new Validator instance.
But I have an issue when registering multiple rule functions with same key/name, the functions takes in input the arguments of the last registered rule.

Would be nice to have the ability to create specific rules for each validator instance.
Something like this:

const validator = new Validator(); // empty constructor 
validator.register(name, callbackFn, errorMessage);

const validation = validator.validate(data, rules);
validation.passes(); // true
validation.fails(); // false

Related Issue: foxhound87/mobx-formkit#579

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions