Given the following arrays:
const array1 = ["a1", "b1", "c1", "d1"],
array2 = ["a2", "b2"],
array3 = ["a3", "b3", "c3"]
Is there any ramda function to simplify the following scenario on which I could give one or more arrays?
const nestedMap = map => {
const result = []
for(let item1 of array1)
for(let item2 of array2)
for(let item3 of array3)
result.push(map(item1, item2, item3))
return result
}
Whole function would look as follows:
// Sample usage
nestedMap((item1, item2, item3) => `${item1} ${item2} ${item3}`, array1, array2, array3)
I'm looking to avoid reinventing the wheel.
Note: Vanilla javascript or any other library can be acceptable. I initially talked about ramda as it has a lot of functions and maybe I've missed which could assist on solving this problem