SQL-style join on arrays using ECMA6
Build an index and use it to map the second array:

const index = new Map(source.map(el =&gt; [el.id, el]));
const result = picks.map(el =&gt; (index.get(el.id) || el));


The larger the arrays, the more effective the index becomes.
If this code is a bottleneck, it can be rewritten to build the index on-the-go (memoization).

P.S. source stands for preprocessed_array and picks for new_array in the original code.