Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
koresar committed Sep 23, 2016
2 parents 2d6f6cf + 4e2f6b5 commit 8dfdc5a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions docs/advanced_examples.md
Expand Up @@ -307,13 +307,13 @@ const JoiPrevalidator = stampit
.init(function () { // This will be called for each new object instance.
_.forOwn(this.prevalidations, (value, key) => { // overriding functions
const actualFunc = this[key];
this[key] = () => { // Overwrite a real function with ours.
this[key] = ( ...args ) => { // Overwrite a real function with ours.
const result = joi.validate(this, value, {allowUnknown: true});
if (result.error) {
throw new Error(`Can't call ${key}(), prevalidation failed: ${result.error}`);
}

return actualFunc.apply(this, arguments);
return actualFunc.apply(this, args);
}
});
});
Expand Down

0 comments on commit 8dfdc5a

Please sign in to comment.