Say I have an object:
var obj = { a:{}, b:1, c: new Set() };
Objects are not iterable without work and Object.keys/values/entries are not quite what I want. Object.entries() is close, but I would prefer it returns an array of objects instead of a 2D array, ideally with references intact (where appropriate).
So something like:
Object.items( obj ) = [ { a: {} }, { b: 1 }, { c: new Set() } ];
I understand I could create a function to do this using Object.entries(), I just want to confirm that there isn't already something similar.
{}value ofashould be the same object in the result. Which is hard to avoid unless you go to extra lengths to make a copy.1ofbin the original will propagate to the result (or vice versa) that can't be done.{get [key]() { return orig[key]; }, set [key](v) { orig[key] = v; }}could do even that :-)