|
|
|
|
|
by djfm
3260 days ago
|
|
Shouldn't it be ".map(([prop, value]) => ...)" ? I like to write it this way, using as much syntax sugar as possible: const mapObject = fn => obj => Object.assign(
...Object.entries(obj).map(
([key, value]) => ({ [key]: fn(value) })
)
); |
|
It's not possible to say this on the internet without being rude so, apologies, but, why code like that? It genuinely was a struggle to parse (in my brain) your oneliner of code there. If I found this in our code base it would be a huge waste of time and energy.