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: trim keys once #2194

Merged
merged 1 commit into from
May 20, 2024
Merged

perf: trim keys once #2194

merged 1 commit into from
May 20, 2024

Conversation

VIKTORVAV99
Copy link
Contributor

Trims the key once and reuse it rather than calling trim multiple times. Also moves the logic inside the if condition instead of using an early return since it's the only logic in there.

This should improve both the performance and bundle size a tiny bit.

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.317% (+0.004%) from 96.313%
when pulling bea33b4 on VIKTORVAV99:trim_keys_once
into 20011af on i18next:master.

@adrai adrai merged commit c5c6291 into i18next:master May 20, 2024
9 checks passed
@adrai
Copy link
Member

adrai commented May 20, 2024

included in v23.11.5

@VIKTORVAV99 VIKTORVAV99 deleted the trim_keys_once branch May 20, 2024 17:40
DAcodedBEAT added a commit to ChurchCRM/CRM that referenced this pull request Aug 5, 2024
![snyk-top-banner](https://github.com/andygongea/OWASP-Benchmark/assets/818805/c518c423-16fe-447e-b67f-ad5a49b5d123)


<h3>Snyk has created this PR to upgrade i18next from 23.11.5 to
23.12.1.</h3>

:information_source: Keep your dependencies up-to-date. This makes it
easier to fix existing vulnerabilities and to more quickly identify and
fix newly disclosed vulnerabilities when they affect your project.

<hr/>


- The recommended version is **2 versions** ahead of your current
version.

- The recommended version was released on **22 days ago**.



<details>
<summary><b>Release notes</b></summary>
<br/>
  <details>
    <summary>Package name: <b>i18next</b></summary>
    <ul>
      <li>
<b>23.12.1</b> - <a
href="https://github.com/i18next/i18next/releases/tag/v23.12.1">2024-07-14</a></br><ul>
<li>Use explicit imports for utils <a
href="i18next/i18next#2212"
data-hovercard-type="pull_request"
data-hovercard-url="/i18next/i18next/pull/2212/hovercard">2212</a></li>
</ul>
      </li>
      <li>
<b>23.12.0</b> - <a
href="https://github.com/i18next/i18next/releases/tag/v23.12.0">2024-07-14</a></br><ul>
<li>feat: Add posibility to override keyPrefix for certain translation.
<a href="i18next/i18next#2211"
data-hovercard-type="issue"
data-hovercard-url="/i18next/i18next/issues/2211/hovercard">2211</a></li>
</ul>
      </li>
      <li>
<b>23.11.5</b> - <a
href="https://github.com/i18next/i18next/releases/tag/v23.11.5">2024-05-20</a></br><ul>
<li>perf: use Array.isArray() <a
href="i18next/i18next#2193"
data-hovercard-type="pull_request"
data-hovercard-url="/i18next/i18next/pull/2193/hovercard">2193</a></li>
<li>perf: trim keys once <a
href="i18next/i18next#2194"
data-hovercard-type="pull_request"
data-hovercard-url="/i18next/i18next/pull/2194/hovercard">2194</a></li>
</ul>
      </li>
    </ul>
from <a href="https://github.com/i18next/i18next/releases">i18next
GitHub release notes</a>
  </details>
</details>

---

> [!IMPORTANT]
>
> - Check the changes in this PR to ensure they won't cause issues with
your project.
> - This PR was automatically created by Snyk using the credentials of a
real user.

---

**Note:** _You are seeing this because you or someone else with access
to this repository has authorized Snyk to open upgrade PRs._

**For more information:** <img
src="https://api.segment.io/v1/pixel/track?data=eyJ3cml0ZUtleSI6InJyWmxZcEdHY2RyTHZsb0lYd0dUcVg4WkFRTnNCOUEwIiwiYW5vbnltb3VzSWQiOiJiOTY5ZWNhOS00MDVhLTQzN2UtOTYwMy1hMjIzNDc3ZWZhNmYiLCJldmVudCI6IlBSIHZpZXdlZCIsInByb3BlcnRpZXMiOnsicHJJZCI6ImI5NjllY2E5LTQwNWEtNDM3ZS05NjAzLWEyMjM0NzdlZmE2ZiJ9fQ=="
width="0" height="0"/>

> - 🧐 [View latest project
report](https://app.snyk.io/org/dawoudio/project/e27b08aa-e5d2-4b10-8303-630a69d0b669?utm_source&#x3D;github&amp;utm_medium&#x3D;referral&amp;page&#x3D;upgrade-pr)
> - 📜 [Customise PR
templates](https://docs.snyk.io/scan-using-snyk/pull-requests/snyk-fix-pull-or-merge-requests/customize-pr-templates)
> - 🛠 [Adjust upgrade PR
settings](https://app.snyk.io/org/dawoudio/project/e27b08aa-e5d2-4b10-8303-630a69d0b669/settings/integration?utm_source&#x3D;github&amp;utm_medium&#x3D;referral&amp;page&#x3D;upgrade-pr)
> - 🔕 [Ignore this dependency or unsubscribe from future upgrade
PRs](https://app.snyk.io/org/dawoudio/project/e27b08aa-e5d2-4b10-8303-630a69d0b669/settings/integration?pkg&#x3D;i18next&amp;utm_source&#x3D;github&amp;utm_medium&#x3D;referral&amp;page&#x3D;upgrade-pr#auto-dep-upgrades)

<!---
(snyk:metadata:{"customTemplate":{"variablesUsed":[],"fieldsUsed":[]},"dependencies":[{"name":"i18next","from":"23.11.5","to":"23.12.1"}],"env":"prod","hasFixes":false,"isBreakingChange":false,"isMajorUpgrade":false,"issuesToFix":[],"prId":"b969eca9-405a-437e-9603-a223477efa6f","prPublicId":"b969eca9-405a-437e-9603-a223477efa6f","packageManager":"npm","priorityScoreList":[],"projectPublicId":"e27b08aa-e5d2-4b10-8303-630a69d0b669","projectUrl":"https://app.snyk.io/org/dawoudio/project/e27b08aa-e5d2-4b10-8303-630a69d0b669?utm_source=github&utm_medium=referral&page=upgrade-pr","prType":"upgrade","templateFieldSources":{"branchName":"default","commitMessage":"default","description":"default","title":"default"},"templateVariants":[],"type":"auto","upgrade":[],"upgradeInfo":{"versionsDiff":2,"publishedDate":"2024-07-14T12:13:03.147Z"},"vulns":[]})
--->
heharm pushed a commit to wanderlog/i18next that referenced this pull request Aug 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