As per the docs, Promise.all(iterable) should work with all kinds of Iterables and not only Arrays. This simple test shows the problem.
var util = require("util")
function inspect() {
console.log(util.inspect(arguments));
}
console.log("With a Set: (fails)")
var set = new Set([true, true]);
Promise.all(set).then(inspect, inspect);
console.log("With an Array: (works)")
var arr = [true, true];
Promise.all(arr).then(inspect, inspect);
To make Promise.all(iterable) work with a Set, the Set would firstly need to be converted into a regular Array.
console.log("With conversion: (works)")
var set = new Set([true, true]);
var arr = [];
for (let item of set)
arr.push(item);
Promise.all(arr).then(inspect, inspect);
As per the docs,
Promise.all(iterable)should work with all kinds ofIterables and not onlyArrays. This simple test shows the problem.To make
Promise.all(iterable)work with aSet, theSetwould firstly need to be converted into a regularArray.