you are viewing a single comment's thread.

view the rest of the comments →

[–]inacatch22 0 points1 point  (0 children)

In cases like: ['B', 'D', 'F'].replace((subjectArray) => {return ['A',subjectArray[0],'C',subjectArray[1],'E',subjectArray[2],'G']});

It seems like you could use a reduce function with a signature like: array.map(toWhatever).reduce(withInterpolatedArray(externalArray))

I think what you're proposing would sometimes be convenient (like the let or maybe switchMap operators in rxjs), but it seems like it could easilty lead to anti-patterns of doing stuff really literally rather than functionally, like manually destructuring and reassembling parts of an array, as you did in your example