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

fix(lru): use map.delete() directly #713

Merged
merged 2 commits into from
May 9, 2024
Merged

fix(lru): use map.delete() directly #713

merged 2 commits into from
May 9, 2024

Conversation

negezor
Copy link
Contributor

@negezor negezor commented May 8, 2024

The default implementation already returns boolean if the value has been deleted.

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/delete#return_value

It's also faster since we don't double check the hashmap for a value.

@negezor negezor requested a review from a team as a code owner May 8, 2024 17:49
@lukekarrys lukekarrys changed the title chore(lru): use map.delete() directly fix(lru): use map.delete() directly May 8, 2024
internal/lrucache.js Outdated Show resolved Hide resolved
Copy link
Contributor

@lukekarrys lukekarrys left a comment

Choose a reason for hiding this comment

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

Thank you!

@wraithgar wraithgar merged commit 6466ba9 into npm:main May 9, 2024
29 checks passed
@github-actions github-actions bot mentioned this pull request May 9, 2024
wraithgar pushed a commit that referenced this pull request May 9, 2024
🤖 I have created a release *beep* *boop*
---


## [7.6.2](v7.6.1...v7.6.2)
(2024-05-09)

### Bug Fixes

*
[`6466ba9`](6466ba9)
[#713](#713) lru: use
map.delete() directly (#713) (@negezor, @lukekarrys)

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@mbtools
Copy link
Contributor

mbtools commented May 9, 2024

Thanks for the optimization 😊

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.

4 participants