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 function that processes batches of asynchronous operations with detailed status reporting for each operation, regardless of success or failure.
Your task is to implement a function that takes a collection of data items and an async processor function, and returns a comprehensive status report showing which items succeeded and which failed, along with their results or error messages.
The function should:
Given an iterable of items and a processor function:
status: 'fulfilled' and a value propertystatus: 'rejected' and a reason property[1, 2, 3] and a processor that succeeds for odd numbers but rejects for even numbers, returns an array of three result objects with alternating 'fulfilled' and 'rejected' statuses in the original order @test[], returns an empty array [] @testnew Set([10, 20, 30]) and a processor function, returns an array of result objects in the Set's iteration order @teststatus: 'fulfilled' @test/**
* Processes a batch of items asynchronously and returns status for each
* @param {Iterable} items - Collection of items to process
* @param {Function} processorFn - Async function to process each item
* @returns {Promise<Array<{status: string, value?: any, reason?: any}>>}
*/
async function processBatch(items, processorFn);Provides promise settlement tracking functionality.