Skip to content

IReadOnlyObservableCollection.filter

github-actions[bot] edited this page Dec 3, 2024 · 3 revisions

This method has multiple overloads.


Creates a new JavaScript Array containing only the items the satisfy the given collection.

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

Source reference: src/collections/observableCollections/IReadOnlyObservableCollection.ts:194.

Generic Parameters

  • TContext - The context type in which the callback is executed.

Parameters

  • predicate: (this:TContext, item:TItem, index:number, collection:this) => boolean
    The callback indicating which items to add in the result Array.

  • thisArg: TContext
    A value to use as context when evaluating items.

Returns: TItem[]

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

See also


Creates a new JavaScript Array containing only the items the satisfy the given collection.

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

Source reference: src/collections/observableCollections/IReadOnlyObservableCollection.ts:204.

Generic Parameters

  • TResult - The type to convert each item to.

  • TContext - The context type in which the callback is executed.

Parameters

  • predicate: (this:TContext, item:TItem, index:number, collection:this) => item is TResult
    The callback indicating which items to add in the result Array.

  • thisArg: TContext
    A value to use as context when evaluating items.

Returns: TResult[]

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

See also

Clone this wiki locally