Skip to content

ReadOnlyObservableCollection.flatMap

Andrei Fangli edited this page Sep 3, 2023 · 2 revisions

Returns a new JavaScript Array by mapping all items in the collection and the flattening the result by one level.

This is a public method.

public flatMap<TResult>(callback: (item: TItem, index: number, collection: IReadOnlyObservableCollection<TItem>) => TResult | readonly TResult[]): TResult[]

Template Parameters

  • TResult: the type to map each item to.

Parameters

  • callback: Function, the callback mapping each item.

    Parameters:

    Returns: TResult or readonly TResult[]

    Returns the mapped item(s).

Returns: TResult[]

Returns a mapped and one level flattened Array.

See


Returns a new JavaScript Array by mapping all items in the collection and the flattening the result by one level.

This is a public method.

public flatMap<TResult, TContext>(callback: (item: TItem, index: number, collection: IReadOnlyObservableCollection<TItem>) => TResult | readonly TResult[], thisArg: TContext): TResult[]

Template Parameters

  • TResult: the type to map each item to.
  • TContext: the context type in which the callback is executed.

Parameters

  • callback: Function, the callback mapping each item.

    Parameters:

    Returns: TResult or readonly TResult[]

    Returns the mapped item(s).
  • thisArg: TContext, a value to use as context when evaluating items.

Returns: TResult[]

Returns a mapped and one level flattened Array.

See

Clone this wiki locally