I have the following data structure:
[
{
"id": 1,
"houses": [
{
"id": 1,
"name": "house 1"
},
{
"id": 2,
"name": "house 2"
}
]
},
{
"id": 2,
"houses": [
{
"id": 3,
"name": "house 3"
}
]
}
]
And I want to be able to, for each house in each user do something async, so I have a function with this signature and which returns a promise:
sendWelcomeEmail(user, house)
Now, I know how to use Bluebird's Promise.map when I have an array of promises, but in this case, I have an array of objects with arrays. What is the proper way to call Promise.map so I end up calling sendWelcomeEmail for each user and house?