diff --git a/underscore/underscore.d.ts b/underscore/underscore.d.ts index 23646f044..feca73688 100644 --- a/underscore/underscore.d.ts +++ b/underscore/underscore.d.ts @@ -961,6 +961,30 @@ interface UnderscoreStatic { array: _.List, value: T, from?: number): number; + + /** + * Returns the first index of an element in `array` where the predicate truth test passes + * @param array The array to search for the index of the first element where the predicate truth test passes. + * @param predicate Predicate function. + * @param context `this` object in `predicate`, optional. + * @return Returns the index of an element in `array` where the predicate truth test passes or -1.` + **/ + findIndex( + array: _.List, + predicate: _.ListIterator, + context?: any): number; + + /** + * Returns the last index of an element in `array` where the predicate truth test passes + * @param array The array to search for the index of the last element where the predicate truth test passes. + * @param predicate Predicate function. + * @param context `this` object in `predicate`, optional. + * @return Returns the index of an element in `array` where the predicate truth test passes or -1.` + **/ + findLastIndex( + array: _.List, + predicate: _.ListIterator, + context?: any): number; /** * Uses a binary search to determine the index at which the value should be inserted into the list in order @@ -2115,6 +2139,16 @@ interface Underscore { **/ lastIndexOf(value: T, from?: number): number; + /** + * @see _.findIndex + **/ + findIndex(array: _.List, predicate: _.ListIterator, context?: any): number; + + /** + * @see _.findLastIndex + **/ + findLastIndex(array: _.List, predicate: _.ListIterator, context?: any): number; + /** * Wrapped type `any[]`. * @see _.sortedIndex @@ -2999,6 +3033,16 @@ interface _Chain { **/ lastIndexOf(value: T, from?: number): _ChainSingle; + /** + * @see _.findIndex + **/ + findIndex(predicate: _.ListIterator, context?: any): _Chain; + + /** + * @see _.findLastIndex + **/ + findLastIndex(predicate: _.ListIterator, context?: any): _Chain; + /** * Wrapped type `any[]`. * @see _.sortedIndex