Skip to content

ReadOnlyObservableCollection.find

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

Returns the first item for which the provided predicate evaluated to true, if no item can be found then undefined is returned.

This is a public method.

public find(predicate: (item: TItem, index: number, collection: IReadOnlyObservableCollection<TItem>) => boolean): TItem | undefined

Parameters

  • predicate: Function, the callback performing the item check.

    Parameters:

    Returns: Boolean

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

Returns: TItem

Returns the first item for which the provided predicate evaluates to true; otherwise undefined.

See


Returns the first item for which the provided predicate evaluated to true, if no item can be found then undefined is returned.

This is a public method.

public find<TContext>(predicate: (this: TContext, item: TItem, index: number, collection: IReadOnlyObservableCollection<TItem>) => boolean, thisArg: TContext): TItem | undefined

Template Parameters

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

Parameters

  • predicate: Function, the callback performing the item check.

    Parameters:

    Returns: Boolean

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

Returns: TItem

Returns the first item for which the provided predicate evaluates to true; otherwise undefined.

See


Returns the first item for which the provided predicate evaluated to true, if no item can be found then undefined is returned.

This is a public method.

public find<TResult extends TItem>(predicate: (item: TItem, index: number, collection: IReadOnlyObservableCollection<TItem>) => item is TResult): TResult | undefined

Template Parameters

  • TResult: the type of item to find.
    Must extend TItem.

Parameters

  • predicate: Function, the callback performing the item check.

    Parameters:

    Returns: Boolean

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

Returns: TResult

Returns the first item for which the provided predicate evaluates to true; otherwise undefined.

See


Returns the first item for which the provided predicate evaluated to true, if no item can be found then undefined is returned.

This is a public method.

public find<TResult extends TItem, TContext>(predicate: (this: TContext, item: TItem, index: number, collection: IReadOnlyObservableCollection<TItem>) => item is TResult, thisArg: TContext): TResult | undefined

Template Parameters

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

Parameters

  • predicate: Function, the callback performing the item check.

    Parameters:

    Returns: Boolean

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

Returns: TResult

Returns the first item for which the provided predicate evaluates to true; otherwise undefined.

See

Clone this wiki locally