Skip to content

Commit

Permalink
build package
Browse files Browse the repository at this point in the history
  • Loading branch information
CommandString committed Aug 28, 2024
1 parent 6d6a6d0 commit 13f9639
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,16 @@ function validate(objectToValidate, config) {
hasErrors: false
};
const pushError = (field, message, bag = null) => {
var _a;
var _b;
var _a, _b;
var _c, _d;
bag !== null && bag !== void 0 ? bag : (bag = errorBag);
(_a = (_b = bag.errors)[field]) !== null && _a !== void 0 ? _a : (_b[field] = []);
(_a = (_c = bag.errors)[field]) !== null && _a !== void 0 ? _a : (_c[field] = []);
if (!(bag.errors[field] instanceof Array)) {
(_b = (_d = bag.errors[field]).errors) !== null && _b !== void 0 ? _b : (_d.errors = []);
if (!(bag.errors[field].errors instanceof Array)) {
throw new Error(`Errors field name is reserved when using nested validation with top level validation!`);
}
bag.errors[field].errors.push(message);
return;
}
bag.errors[field].push(message);
Expand Down

0 comments on commit 13f9639

Please sign in to comment.