Skip to content

Conversation

@erfanium
Copy link
Collaborator

to change default rules behavior.
For example: object strict

‍‍‍const v = new Validator({
   defaults: {
      object: {
         strict: 'remove'
      }
   }
})

@coveralls
Copy link

coveralls commented Mar 21, 2020

Coverage Status

Coverage remained the same at 100.0% when pulling 3c39521 on erfanium:newF into 5a699b9 on icebob:master.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 100.0% when pulling 57cd3b8 on erfanium:newF into d1edb33 on icebob:master.

Copy link
Owner

@icebob icebob left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be better to merge the rule schema with defaults in validator.js in one place instead of all individual rules with all properties.

Somewhere here:

const alias = this.aliases[schema.type];
if (alias) {
delete schema.type;
schema = Object.assign({}, alias, schema);
}
const ruleFunction = this.rules[schema.type];
if (!ruleFunction)
throw new Error("Invalid '" + schema.type + "' type in validator schema.");
const rule = {

@erfanium erfanium requested a review from icebob March 24, 2020 15:39
@erfanium erfanium requested a review from icebob March 28, 2020 20:17
@icebob icebob merged commit 7f08bd5 into icebob:master Mar 31, 2020
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

Successfully merging this pull request may close these issues.

3 participants