js-util

Home > rc-js-util > arrayCompactMap

arrayCompactMap() function

Like _Array.map but where the callback returns null it will be omitted from the result.

Signature:

export declare function arrayCompactMap<TItem, TTransformed>(items: ArrayLike<TItem>, map: (item: TItem, index: number) => TTransformed | null): TTransformed[];

Parameters

Parameter Type Description
items ArrayLike<TItem>  
map (item: TItem, index: number) => TTransformed | null  

Returns:

TTransformed[]

Remarks

See arrayCompactMap().