refactor: Bring back _.flatMap
usage
#10004
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Reverts #9948 (it covered a bit more originally but other methods were refactored in a meantime)
There was no intention (yet) to get rid of
_.flatMap
in scope of #7747, as reliable alternative in form of[].flatMap
doesn't work with Node.js v10PR proposed to refactor it into less readable
[].reduce
logic, which I think reduced readability of logic.We should keep
_.flatMap
and refactor it into native[].flatMap
on the grounds of v3 (which will come with dropped support for Node.js v10)/cc @JonasMatos0 @pgrzesik