Skip to content

Apply to all functions#8

Open
davearata-snorack wants to merge 2 commits intounbug:developfrom
Snorack:applyToAllFunctions
Open

Apply to all functions#8
davearata-snorack wants to merge 2 commits intounbug:developfrom
Snorack:applyToAllFunctions

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