I want to be able to quickly get the entry set from a map. But the entries
function returns an iterator. That's not what I want. Sure, I could write a function to iterate through the entries and build it up into an entry set, but it would be much nicer to have my function say:
return map.entries();
instead of
return buildEntriesArray(map);
It doesn't seem like there's a clean way to code around the iterator problem other than wrap it in a bunch of decorated calls for the various inconsistent Iterator/entry set API cruft.
let a = [["foo.com", 32], ["bar.foo.com", 12]];
let m = new Map(a);
// add to map, etc.
let entries = Object.entries(Object.fromEntries(m.entries()));
How can I make it cleaner?