Skip to content
This repository was archived by the owner on Jan 25, 2022. It is now read-only.
This repository was archived by the owner on Jan 25, 2022. It is now read-only.

Q: Why not to add getKeys() : array instead?  #217

@c-smile

Description

@c-smile

Referring to this use case:
https://github.com/tc39/proposal-weakrefs#iterable-weakmaps

If we would have WeakMap.prototype.getEntries() method that will return current set of valid entries {key,value} then enumeration will be trivial:

for(let entry of weakMap.getEntries())
   ...

getEntries will return current WeakMap snapshot - not an iterator.

That is a) dead simple and b) will be sufficient for most cases.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions