Skip to content

use arrow functions where possible#1762

Merged
adrai merged 1 commit into
i18next:masterfrom
VIKTORVAV99:use_arrow_functions_where_possible
Jul 15, 2024
Merged

use arrow functions where possible#1762
adrai merged 1 commit into
i18next:masterfrom
VIKTORVAV99:use_arrow_functions_where_possible

Conversation

@VIKTORVAV99

@VIKTORVAV99 VIKTORVAV99 commented Jul 15, 2024

Copy link
Copy Markdown
Contributor

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
Copy Markdown

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
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