Skip to content
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

Refactor wrap function for better readability and efficiency #51

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Ayoub-Mabrouk
Copy link

Refactor wrap function for better readability and efficiency

  • Removed unnecessary res initialization outside the condition.
  • Simplified the flow by checking asyncHooks.AsyncResource and runInAsyncScope in a more direct manner.
  • Enhanced clarity by removing redundant comments and streamlining the code structure.
  • Maintained the backporting of the AsyncResource.bind static method for compatibility.

- Removed unnecessary 
es initialization outside the condition.
- Simplified the flow by checking �syncHooks.AsyncResource and 
unInAsyncScope in a more direct manner.
- Enhanced clarity by removing redundant comments and streamlining the code structure.
- Maintained the backporting of the AsyncResource.bind static method for compatibility.
Copy link
Member

@wesleytodd wesleytodd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unless we are going to break compat with node <16 I am opposed to this change.

As I said in the other PR I reviewed this morning, we dont typically accept formatting changes like this. I made an exception to my opinion for that one because it was simple and did improve readability. This one is much more ambigous and looks like an unnecesssary change to me.

Could you open a separate PR just for the JSDoc improvement? And then if you are interested in pushing a real featre open a PR to remove the check on line 223 so that we just always initalize the async resource now that we dont support node <18?

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.

2 participants