What I am looking to do is to use an array of strings to use those values to map a new array of promise functions for a Promise.all argument.
I think explains my thought process so far, as well as the issue I am running into.
const strings = ['A', 'B', 'C'] // Varies in size
const stringFunctions = strings.map(item => {
const func = () => {
promised(item) // Returns Promised Boolean
}
return func
})
const PromiseAll = new Promise(function(resolve, reject) {
Promise.all(stringFunctions)
.then(items => {
const obj = {};
items.forEach((item, index) => {
obj[strings[index]] = item;
});
resolve(obj);
// returns { A: func(), B: func(), C: func() }
// expected { A: bool, B: bool, C: bool }
})
.catch(error => {
reject(error);
});
}