From ff82514eca5d50932c31a1e65afc4190b79553a9 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 3 Mar 2015 08:36:11 +0100 Subject: [PATCH] Added the findIndex function to underscore.d.ts --- underscore/underscore.d.ts | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/underscore/underscore.d.ts b/underscore/underscore.d.ts index aeaf253ca..9f49bc47a 100644 --- a/underscore/underscore.d.ts +++ b/underscore/underscore.d.ts @@ -264,7 +264,22 @@ interface UnderscoreStatic { detect( object: _.Dictionary, iterator: _.ObjectIterator, - context?: any): T; + context?: any): T; + + /** + * Looks through each value in the list, returning the index of the first one that passes a truth + * test (iterator). The function returns as soon as it finds an acceptable element, + * and doesn't traverse the entire list. + * @param list Searches for a value in this list. + * @param iterator Search iterator function for each element in `list`. + * @param context `this` object in `iterator`, optional. + * @return The index of the first acceptable found element in `list`, if nothing is found -1 is returned. + **/ + findIndex( + list: _.List, + iterator: _.ListIterator, + context?: any): T; + /** * Looks through each value in the list, returning an array of all the values that pass a truth