Hacker News new | ask | show | jobs
by masklinn 2521 days ago
Functional transformation of objects. There are lots of HOFs working on arrays / iterators but none working on object. fromEntries allows easily converting from object to entries, manipulating the entries sequence and converting back to an object.

The last step is pretty annoying without it.

The entire thing is very common in Python, where Object.entries() is spelled `.items()` and `Object.fromEntries(…)` is spelled `dict(…)`

1 comments

It's a lot more verbose than _.mapValues() is, but it's nice to have a relatively simple solution without using a library.