Skip to content

Commit

Permalink
fix: codeStyle and params condition
Browse files Browse the repository at this point in the history
  • Loading branch information
ycjcl868 committed Aug 8, 2018
1 parent a0c7cd5 commit 85e257b
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,7 @@ class Parameter {
if (opts.validateRoot) {
this.validateRoot = true;
}
this.defaultRequired = opts.defaultRequired !== undefined ?
opts.defaultRequired :
true;
this.defaultRequired = opts.defaultRequired !== false;
}

t() {
Expand Down Expand Up @@ -74,10 +72,9 @@ class Parameter {
for (var key in rules) {
var rule = formatRule(rules[key]);
var has = obj.hasOwnProperty(key);

if (!has) {
var required = rule.required !== undefined ?
rule.required :
this.defaultRequired;
var required = rule.required !== undefined ? rule.required : this.defaultRequired;
if (required) {
errors.push({
message: this.t('required'),
Expand Down

0 comments on commit 85e257b

Please sign in to comment.