Mreduce
Bun

method

url.URLSearchParamsIterator.reduce

callbackfn: (previousValue: T, currentValue: T, currentIndex: number) => T
): T;

Calls the specified callback function for all the elements in this iterator. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.

@param callbackfn

A function that accepts up to three arguments. The reduce method calls the callbackfn function one time for each element in the iterator.

callbackfn: (previousValue: T, currentValue: T, currentIndex: number) => T,
initialValue: T
): T;
reduce<U>(
callbackfn: (previousValue: U, currentValue: T, currentIndex: number) => U,
initialValue: U
): U;

Calls the specified callback function for all the elements in this iterator. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.

@param callbackfn

A function that accepts up to three arguments. The reduce method calls the callbackfn function one time for each element in the iterator.

@param initialValue

If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of a value from the iterator.