function artistsCorrect(artistsList, photosList, camerasList) { return, index) => { const extraValues = { photo: photosList[index], camera: camerasList[index] } return Object.assign({}, artist, extraValues) }) }
From imperative to functional JavaScript
Diogo Spínola

I feel like you haven’t really rid yourself of the imperative thinking mindset here. The map here is essentially a for-loop without the explicit index management. That’s good, but I think you can easily go further and make this even nicer to read. A common task in the functional programming paradigm (like you’re doing here) is to merge some lists together. It’s so common that there are helpers for it widely available, in this case there’s one in lodash You can use it to make this a one-liner: `_.zipWith([artists, photos, cameras], (artist, photo, camera) => ({ …artist, photo, camera }))`.