diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index c14a8b5db..a5d8dab4a 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -247,6 +247,12 @@ result = _.find(foodsCombined, 'organic'); result = _.detect(foodsCombined, { 'type': 'vegetable' }); result = _.detect(foodsCombined, 'organic'); + result = _.findWhere([1, 2, 3, 4], function(num) { + return num % 2 == 0; + }); + result = _.findWhere(foodsCombined, { 'type': 'vegetable' }); + result = _.findWhere(foodsCombined, 'organic'); + result = _.findLast([1, 2, 3, 4], function(num) { return num % 2 == 0; }); diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 783b3d7ae..a14519604 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -1052,6 +1052,30 @@ declare module _ { collection: Collection, pluckValue: string): T; + /** + * @see _.find + **/ + export function findWhere( + collection: Collection, + callback: ListIterator, + thisArg?: any): T; + + /** + * @see _.find + * @param _.pluck style callback + **/ + export function findWhere( + collection: Collection, + whereValue: Dictionary): T; + + /** + * @see _.find + * @param _.where style callback + **/ + export function findWhere( + collection: Collection, + pluckValue: string): T; + /** * This method is like _.find except that it iterates over elements of a collection from * right to left.