Skip to content

Instantly share code, notes, and snippets.

@wombleton
Last active December 22, 2015 09:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wombleton/6455793 to your computer and use it in GitHub Desktop.
Save wombleton/6455793 to your computer and use it in GitHub Desktop.
var obj = {
name: 'Good McGoodson',
last_menstrual_period: 41
};
validate(obj, [ "name.length between 1 and 100", "lmp between 0 and 40"]]); // returns ["lmp must be between 0 and 40"]
@wrumsby
Copy link

wrumsby commented Sep 5, 2013

Expression parsing vs.

{
    field: 'name',
    validations: [
        {
            minLength: 2,
            maxLength: 100
        }
    ]
}

validationMessage would be automatically created based on the rule, but could be overwritten?

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