diff --git a/docs/advanced_examples.md b/docs/advanced_examples.md index 5519ac6..525c36f 100644 --- a/docs/advanced_examples.md +++ b/docs/advanced_examples.md @@ -303,13 +303,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); } }); });