Skip to content

Commit

Permalink
chore(lru): use map.delete() directly
Browse files Browse the repository at this point in the history
The default implementation already returns boolean if the object has been deleted.

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/delete#return_value
  • Loading branch information
negezor authored May 8, 2024
1 parent d777418 commit 12efe82
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions internal/lrucache.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,7 @@ class LRUCache {
}

delete (key) {
if (this.map.has(key)) {
this.map.delete(key)
return true
} else {
return false
}
return this.map.delete(key);

Check failure on line 20 in internal/lrucache.js

View workflow job for this annotation

GitHub Actions / Lint

Extra semicolon
}

set (key, value) {
Expand Down

0 comments on commit 12efe82

Please sign in to comment.