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

use arrow functions where possible #1762

Merged

Conversation

VIKTORVAV99
Copy link
Contributor

@VIKTORVAV99 VIKTORVAV99 commented Jul 15, 2024

By converting all functions to arrow functions we optimize two things. First we can directly remove some return statements by using implicit return and secondly it allows bundlers to compress mupltiple const declarations into a single const declaration with multiple constants.
Example:

const test1 = "test1"
const test2 = "test2"
const test3 = "test3"

Becomes

const test1 = "test1", test2 = "test2", test3 = "test3"

Which saves some bytes that would otherwise be used for the function keyword in the pervious version.

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

@coveralls
Copy link

Coverage Status

coverage: 97.143% (+0.03%) from 97.11%
when pulling fd41f98 on VIKTORVAV99:use_arrow_functions_where_possible
into 5c3c3eb on i18next:master.

@adrai adrai merged commit 46e8ea5 into i18next:master Jul 15, 2024
9 checks passed
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