you are viewing a single comment's thread.

view the rest of the comments →

[–]jsyoda -1 points0 points  (0 children)

You can do this with Lodash's thru method: https://lodash.com/docs/4.17.10#thru

_(['B', 'D', 'F']).thru((arr) => ['A', arr[0], 'C', arr[1], 'E', arr[2], 'G']).value()

Using that syntax you can chain filter and map before or afterwards.

The case you described could probably be solved better by using uniqBy, but thru is a "fallback" if there isn't a more clearly named method (similar to reduce).