docs
evals
scenario-1
scenario-10
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
Build a utility module that processes collections of asynchronous operations and returns comprehensive settlement results. The module must handle multiple promises simultaneously and provide detailed information about each operation's outcome, regardless of success or failure.
Your utility should accept a collection of promises and return a promise that resolves when all input promises have settled. The result should contain information about each promise's outcome.
Each result element should be an object containing:
/**
* Waits for all promises to settle and returns their results.
*
* @param {Iterable} iterable - An iterable of promises and/or values
* @returns {Promise<Array>} A promise that resolves to an array of result objects
*/
function settleAll(iterable) {
// Implementation here
}
module.exports = { settleAll };Given an array with one fulfilled promise resolving to 'success' and one rejected promise with reason 'error', returns an array with two result objects: first with status 'fulfilled' and value 'success', second with status 'rejected' and reason 'error' @test
Given an empty array, returns an empty array @test
Given an array containing the number 42 (non-promise value), returns an array with one result object having status 'fulfilled' and value 42 @test
Given an array with three rejected promises, returns an array with three result objects all having status 'rejected' with their respective reasons @test
Provides promise settlement functionality with robust method binding and environment protection.