Skip to content
This repository has been archived by the owner on Apr 19, 2022. It is now read-only.

Commit

Permalink
fix(validator:extend): make sure to set the extended rule message
Browse files Browse the repository at this point in the history
  • Loading branch information
thetutlage committed Jun 11, 2016
1 parent 63003ed commit 2f1054c
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/Validator/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const _ = require('lodash')
const Parser = require('../Parser')
const Validations = require('../Validations')
const ValidationEngine = require('./engine')
const Messages = require('../Messages')
const Modes = require('../Modes')
const Q = require('q')

Expand Down Expand Up @@ -68,6 +69,7 @@ const Validator = exports = module.exports = {}
*
* @return {Object|Array}
*/

Validator.validate = function (data, rules, messages) {
messages = messages || {}
const transformedRules = Parser.transformRules(data, rules)
Expand Down Expand Up @@ -120,6 +122,7 @@ Validator.extend = function (name, method, message) {
throw new Error('Invalid arguments, extend expects a method to execute')
}
Validations[name] = method
Messages.set('name', message)
}

Validator.is = require('../Raw')
Expand Down

0 comments on commit 2f1054c

Please # to comment.