Skip to content

Commit

Permalink
fix(mongoose): sets the correct this for deprecated methods
Browse files Browse the repository at this point in the history
Fixes #116
  • Loading branch information
stalniy committed Oct 14, 2018
1 parent 24bea9f commit 488a227
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/casl-mongoose/src/accessible_fields.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ function wrapArray(value) {
}

function deprecate(name, { by: replacementName, fn }) {
return (...args) => {
return function wrapDeprecated(...args) {
if (process.env.NODE_ENV !== 'production') {
console.warn(`"${name}" is deprecated, use "${replacementName}"`);
}

return fn(...args);
return fn.apply(this, args);
};
}

Expand Down

0 comments on commit 488a227

Please sign in to comment.