Skip to content

ReadOnlyObservableCollection.filter

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

Creates a new JavaScript Array containing only the items for which the provided predicate evaluates to true.

This is a public method.

public filter(predicate: (item: TItem, index: number, collection: IReadOnlyObservableCollection<TItem>) => boolean): TItem[]

Parameters

  • predicate: Function, the callback indicating which items to add in the result Array.

    Parameters:

    Returns: Boolean

    Returns true if the provided item satisfies the condition; false otherwise.

Returns: TItem[]

A new Array containing the items for which the provided predicate evaluated to true.

See


Creates a new JavaScript Array containing only the items for which the provided predicate evaluates to true.

This is a public method.

public filter<TContext>(predicate: (this: TContext, item: TItem, index: number, collection: IReadOnlyObservableCollection<TItem>) => boolean, thisArg: TContext): TItem[]

Template Parameters

  • TContext: the context type in which the callback is executed.

Parameters

  • predicate: Function, the callback indicating which items to add in the result Array.

    Parameters:

    Returns: Boolean

    Returns true if the provided item satisfies the condition; false otherwise.
  • thisArg: TContext, a value to use as the callback context when mapping items.

Returns: TItem[]

A new Array containing the items for which the provided predicate evaluated to true.

See


Creates a new JavaScript Array containing only the items for which the provided predicate evaluates to true.

This is a public method.

public filter<TResult extends TItem>(predicate: (item: TItem, index: number, collection: IReadOnlyObservableCollection<TItem>) => item is TResult): TResult[]

Template Parameters

  • TResult: the type to convert each item to.
    Must extend TItem.

Parameters

  • predicate: Function, the callback indicating which items to add in the result Array.

    Parameters:

    Returns: Boolean

    Returns true if the provided item satisfies the condition; false otherwise.

Returns: TResult[]

A new Array containing the items for which the provided predicate evaluated to true.

See


Creates a new JavaScript Array containing only the items for which the provided predicate evaluates to true.

This is a public method.

public filter<TResult extends TItem, TContext>(predicate: (this: TContext, item: TItem, index: number, collection: IReadOnlyObservableCollection<TItem>) => item is TResult, thisArg: TContext): TResult[]

Template Parameters

  • TResult: the type to convert each item to.
    Must extend TItem.
  • TContext: the context type in which the callback is executed.

Parameters

  • predicate: Function, the callback indicating which items to add in the result Array.

    Parameters:

    Returns: Boolean

    Returns true if the provided item satisfies the condition; false otherwise.
  • thisArg: TContext, a value to use as the callback context when mapping items.

Returns: TResult[]

A new Array containing the items for which the provided predicate evaluated to true.

See

Clone this wiki locally