I need to generate a couple of objects from lists in Javascript. In Python, I\'d write this:
{key_maker(x): val_maker(x) for x in a_list}
A
Here's a version that doesn't use reduce:
Object.fromEntries( a_list.map( x => [key_maker(x), value_maker(x)]) );
Object.fromEntries is basically the same as _.fromPairs in Lodash. This feels the most like the Python dict comprehension to me.