I like the style of array method chaining with map, filter, etc, but often find myself having to "break" that style in order to use Object.keys()
, Object.values()
, Object.entries()
and Object.fromEntries()
. I discovered the Object instance method getOwnPropertyNames
which seems comparable to Object.keys
, if less elegantly named, but I'm wondering about instance versions of the other static Object methods.
For example, instead of writing:
const foo = Object.fromEntries(Object.keys(bar).map(myCoolFunction))
I'd like to be able to write something like:
const foo = bar.keys()
.map(myCoolFunction)
.toObjectFromEntries()