Skip to content

Apply to all functions #8

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

davearata-snorack
Copy link

Added functionality so that if you pass null as the first parameter tomiddlewaremanager.use it will apply the middleware to all functions in the given object.

@davearata-snorack
Copy link
Author

@unbug any chance this can be reviewed and merged?

@unbug
Copy link
Owner

unbug commented Dec 22, 2021

Sorry @davearata-snorack , I prefer not to take advantage of the params. I suggest you could do :

Object.getOwnPropertyNames(Person.prototype).forEach(method => {
  if(method !== 'constructor') {
      middlewareManager.use(method, logger);
  }
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants