Skip to content

Commit 13f9639

Browse files
committed
build package
1 parent 6d6a6d0 commit 13f9639

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

dist/index.js

+8-3
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,16 @@ function validate(objectToValidate, config) {
88
hasErrors: false
99
};
1010
const pushError = (field, message, bag = null) => {
11-
var _a;
12-
var _b;
11+
var _a, _b;
12+
var _c, _d;
1313
bag !== null && bag !== void 0 ? bag : (bag = errorBag);
14-
(_a = (_b = bag.errors)[field]) !== null && _a !== void 0 ? _a : (_b[field] = []);
14+
(_a = (_c = bag.errors)[field]) !== null && _a !== void 0 ? _a : (_c[field] = []);
1515
if (!(bag.errors[field] instanceof Array)) {
16+
(_b = (_d = bag.errors[field]).errors) !== null && _b !== void 0 ? _b : (_d.errors = []);
17+
if (!(bag.errors[field].errors instanceof Array)) {
18+
throw new Error(`Errors field name is reserved when using nested validation with top level validation!`);
19+
}
20+
bag.errors[field].errors.push(message);
1621
return;
1722
}
1823
bag.errors[field].push(message);

0 commit comments

Comments
 (0)