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

.entries method #25

Closed
silverwind opened this issue Oct 9, 2020 · 2 comments
Closed

.entries method #25

silverwind opened this issue Oct 9, 2020 · 2 comments

Comments

@silverwind
Copy link
Contributor

silverwind commented Oct 9, 2020

There are .keys and .values methods mimicking the same-named Object methods, but not there seems to be no equivalent of Object.entries which I think might be handy sometimes. It should return a iterable of [key, value].

@silverwind silverwind changed the title lru.entriesmethod .entriesmethod Oct 9, 2020
@silverwind silverwind changed the title .entriesmethod .entries method Oct 9, 2020
@sindresorhus
Copy link
Owner

From the docs:

The instance is iterable so you can use it directly in a for…of loop.

for (const [key, value] of lru) {
 // ...
}

@silverwind
Copy link
Contributor Author

Ah missed that part, sorry.

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

No branches or pull requests

2 participants