Skip to content

Commit

Permalink
change context for extended validators
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexeyKhristov committed May 4, 2016
1 parent be8a1c9 commit e7ecae8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/mongoose-validator.js
Expand Up @@ -73,7 +73,7 @@ function validate (options) {
*/
validate.extend = function (name, fn, errorMsg) {
if (!validatorjs[name]) {
validatorjs[name] = function () { return fn.apply(validatorjs, Array.prototype.slice.call(arguments)); };
validatorjs[name] = function () { return fn.apply(this, Array.prototype.slice.call(arguments)); };
errorMessages[name] = errorMsg || 'Error';
}
else {
Expand Down

0 comments on commit e7ecae8

Please sign in to comment.