Skip to content

Commit

Permalink
Add support for validation message callback
Browse files Browse the repository at this point in the history
- Adds a type check for message just before attempting to process validation params on it
- Resolves the callback if it was one using the validation rule for the 'this' context
  • Loading branch information
floorz authored Jan 8, 2019
1 parent 523a83e commit 63c592a
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ define([
params :
[params];

if (typeof message === 'function') {
message = message.call(rule);
}

message = params.reduce(function (msg, param, idx) {
return msg.replace(new RegExp('\\{' + idx + '\\}', 'g'), param);
}, message);
Expand Down

0 comments on commit 63c592a

Please sign in to comment.