Skip to content

Commit

Permalink
fix: validator call array arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
JimmyDaddy committed Aug 17, 2021
1 parent b0b3616 commit ae4d198
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/validator.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@ function executeValidator(ctx, name, attribute, setValue) {
}
return;
}
const callableArgs = [ String(value) ];
callableArgs.push(args);
let callableArgs = [ String(value) ];
callableArgs = callableArgs.concat(args);
if (!validator.apply(ctx, callableArgs)) throw new LeoricValidateError(name, field, msg);
}
}
Expand Down
4 changes: 2 additions & 2 deletions test/unit/validator.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ describe('validator', () => {
allowNull: false,
validate: {
isNumeric: false,
notIn: [ 'Yhorm', 'Gwyn' ],
notIn: [ [ 'Yhorm', 'Gwyn' ] ],
notContains: 'closePease',
}
},
Expand All @@ -40,7 +40,7 @@ describe('validator', () => {
validate: {
isNumeric: true,
isIn: {
args: [ '1', '2' ],
args: [ [ '1', '2' ] ],
msg: 'Error status',
},
}
Expand Down

0 comments on commit ae4d198

Please sign in to comment.