Reversing an Object.entries conversion
Sure, just use .reduce to assign to a new object: const input = { key:’val’, key2:’val2′, key3:’val3′ }; const output = Object.entries(input) .filter(([k, v]) => { return true; // some irrelevant conditions here }) .reduce((accum, [k, v]) => { accum[k] = v; return accum; }, {}); console.log(output); In modern browsers, you can also use Object.fromEntries … Read more