I am attempting to return a promise with Promise.all but for some reason my .then values are evaluating to undefined. This seems to work when it's all inline but it was my understanding I should be able to return the top promise.all and then treat it like any other promise.
function createStreamerArray() {
const regularStreamers = ["ESL_SC2", "OgamingSC2", "cretetion", "freecodecamp", "storbeck", "habathcx", "RobotCaleb", "noobs2ninjas"]
const baseURL = 'https://wind-bow.gomix.me/twitch-api'
return Promise.all(
regularStreamers.map(streamer => {
Promise.all([
Promise.resolve($.getJSON(baseURL + '/users/' + streamer + '?callback=?', null)),
Promise.resolve($.getJSON(baseURL + '/streams/' + streamer + '?callback=?', null))
]).then(values => {
return values
})
})
)
}
createStreamerArray().then(values => console.log(values))