mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
feat(observable-array): findIndex now supported
This commit is contained in:
@@ -288,6 +288,15 @@ export class ObservableArray<T> extends Observable {
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the index of the first element in the array where predicate is true, and -1 otherwise.
|
||||
* @param predicate
|
||||
* @param thisArg If provided, it will be used as the this value for each invocation of predicate. If it is not provided, undefined is used instead.
|
||||
*/
|
||||
findIndex(predicate: (value: any, index: number, obj: any[]) => unknown, thisArg?: any): number {
|
||||
return this._array.findIndex(predicate, thisArg);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the index of the first occurrence of a value in an array.
|
||||
* @param searchElement The value to locate in the array.
|
||||
|
||||
Reference in New Issue
Block a user