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

perf: use object deconstruction, optional chaining and hot path optimisations #287

Merged
merged 1 commit into from
May 12, 2024

Conversation

VIKTORVAV99
Copy link
Contributor

This PR takes advantage of the changes in #286 to use object deconstruction, optional chaining and optimises some code hot paths with early returns and simplified nesting.

This should be functional equivalent to the current code but produce even smaller code bundles and be ever so slightly faster.

Checklist

  • only relevant code is changed (make a diff before you submit the PR)
  • run tests npm run test
  • tests are included
  • commit message and code follows the Developer's Certification of Origin

Checklist (for documentation change)

  • only relevant documentation part is changed (make a diff before you submit the PR)
  • motivation/reason is provided
  • commit message and code follows the Developer's Certification of Origin

}

return found;
return undefined;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is not strictly needed but would cause errors in ESlint unless I change the rules.

@adrai adrai merged commit 9a3b014 into i18next:master May 12, 2024
2 checks passed
@adrai
Copy link
Member

adrai commented May 12, 2024

landed in v8.0.0

@VIKTORVAV99 VIKTORVAV99 deleted the optimize_code branch May 12, 2024 11:57
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