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 Array.isArray() #2193

Merged
merged 1 commit into from
May 20, 2024
Merged

Conversation

VIKTORVAV99
Copy link
Contributor

Uses Array.isArray(obj) instead of Object.prototype.toString.apply(object) === '[object Array]' for a small performance and bundle size gain.

By utilising the new native builtin supported by all target browsers we can reduce the previous 3 step operation to 1 step.

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

@coveralls
Copy link

Coverage Status

coverage: 96.338% (+0.03%) from 96.313%
when pulling c4b4d50 on VIKTORVAV99:use_Array.isArray
into 20011af on i18next:master.

@adrai adrai merged commit 5c63849 into i18next:master May 20, 2024
8 of 9 checks passed
@adrai
Copy link
Member

adrai commented May 20, 2024

included in v23.11.5

@VIKTORVAV99 VIKTORVAV99 deleted the use_Array.isArray branch May 20, 2024 17:41
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.

None yet

3 participants