Implement Promise.all
Resolve mixed inputs in source order and reject promptly without delegating to Promise.all.Description
Requirements
The solution exports the required promiseAll API from the editable module.
Preserves order works deterministically for the documented normal, boundary, and repeated-use scenarios.
Empty input works deterministically for the documented normal, boundary, and repeated-use scenarios.
Mixed values works deterministically for the documented normal, boundary, and repeated-use scenarios.
Thenables works deterministically for the documented normal, boundary, and repeated-use scenarios.
Rejects first works deterministically for the documented normal, boundary, and repeated-use scenarios.
Asynchronous settlement works deterministically for the documented normal, boundary, and repeated-use scenarios.
Out-of-order settlement
[slowPromise, 2, fastPromise]
A promise resolving to [slowValue, 2, fastValue]
Result positions follow iteration order rather than completion order.
Constraints
Do not call Promise.all or Promise.allSettledAccept any synchronous iterableAlways settle asynchronously
Hints
Hint 1
Materialize the iterable once so the target result length is known.
Hint 2
Resolve each entry through Promise.resolve to assimilate thenables.
Hint 3
Track remaining entries and resolve the outer promise only when the counter reaches zero.