kibertoad / toad-cache

In-memory cache for Node.js and browser
MIT License
17 stars 5 forks source link

nit: use already created reference instead of property access #30

Closed gurgunday closed 11 months ago

gurgunday commented 1 year ago

I was reading the source code when this hit me...

Why create a const object reference and not use it afterward... 🤣

Jokes aside, just wanted to point out that you can either remove that declaration or use it instead of accessing this again 🙏

gurgunday commented 11 months ago

Hey, I know this was a joke PR, but before you release a new version, I still feel like there's an unnecessary this property access here:

https://github.com/kibertoad/toad-cache/blob/c5f49253bd2c8bf1e88c79bb612cd1a5abb0dc15/src/LruMap.js#L27-L37

On line 36, we can just use last as the assignment value, no?

So would like to either close this one or merge to get it out of the way

kibertoad commented 11 months ago

@gurgunday Let's do the same for item.next as well then. gotta save them nanoseconds :D

gurgunday commented 11 months ago

Haha, sure!

After all a machine only does what we command 🤣