Skip to content

Commit dbdd97f

Browse files
CreGodCreGod
authored andcommitted
fix empty string error
1 parent 712b386 commit dbdd97f

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/index.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -187,8 +187,6 @@ Schema.prototype = {
187187
format(options.messages.required, rule.field),
188188
),
189189
];
190-
} else {
191-
errors = [];
192190
}
193191
return doIt(errors);
194192
}
@@ -248,7 +246,10 @@ Schema.prototype = {
248246
}
249247
}
250248
if (res && res.then) {
251-
res.then(() => cb(), e => cb(e));
249+
res.then(
250+
() => cb(),
251+
e => cb(e),
252+
);
252253
}
253254
},
254255
results => {
@@ -262,7 +263,7 @@ Schema.prototype = {
262263
}
263264
if (
264265
typeof rule.validator !== 'function' &&
265-
(rule.type && !validators.hasOwnProperty(rule.type))
266+
rule.type && !validators.hasOwnProperty(rule.type)
266267
) {
267268
throw new Error(format('Unknown rule type %s', rule.type));
268269
}

0 commit comments

Comments
 (0)