We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 8d1ba9e commit 5f2f7a7Copy full SHA for 5f2f7a7
lib/validator.js
@@ -64,6 +64,7 @@ function Validator(opts) {
64
deepExtend(this.opts, opts);
65
66
this.messages = this.opts.messages;
67
+ this.messageKeys = Object.keys(this.messages);
68
69
// Load rules
70
this.rules = loadRules();
@@ -176,7 +177,7 @@ Validator.prototype.compileSchemaType = function(schemaType) {
176
177
Validator.prototype.compileMessages = function(schemaType) {
178
179
if (schemaType.messages) {
- return Object.keys(this.messages).reduce((a, key) => {
180
+ return this.messageKeys.reduce((a, key) => {
181
a[key] = schemaType.messages[key] || this.messages[key];
182
return a;
183
}, {});
0 commit comments