js-util

Home > rc-js-util > arrayCollect

arrayCollect() function

Like Array.reduce but without the requirement to return the value in the callback.

Signature:

export declare function arrayCollect<TRet, TItem>(items: ArrayLike<TItem>, collected: TRet, collect: (collected: TRet, item: TItem, index: number) => void): TRet;

Parameters

Parameter Type Description
items ArrayLike<TItem>  
collected TRet  
collect (collected: TRet, item: TItem, index: number) => void  

Returns:

TRet

Remarks

See arrayCollect().