_.findWhere definitions

This commit is contained in:
Brian Zengel
2013-10-18 19:10:15 -04:00
parent f82d724389
commit 4060e36cb3
2 changed files with 30 additions and 0 deletions
+6
View File
@@ -247,6 +247,12 @@ result = <IFoodCombined>_.find(foodsCombined, 'organic');
result = <IFoodCombined>_.detect(foodsCombined, { 'type': 'vegetable' });
result = <IFoodCombined>_.detect(foodsCombined, 'organic');
result = <number>_.findWhere([1, 2, 3, 4], function(num) {
return num % 2 == 0;
});
result = <IFoodCombined>_.findWhere(foodsCombined, { 'type': 'vegetable' });
result = <IFoodCombined>_.findWhere(foodsCombined, 'organic');
result = <number>_.findLast([1, 2, 3, 4], function(num) {
return num % 2 == 0;
});
+24
View File
@@ -1052,6 +1052,30 @@ declare module _ {
collection: Collection<T>,
pluckValue: string): T;
/**
* @see _.find
**/
export function findWhere<T>(
collection: Collection<T>,
callback: ListIterator<T, boolean>,
thisArg?: any): T;
/**
* @see _.find
* @param _.pluck style callback
**/
export function findWhere<T>(
collection: Collection<T>,
whereValue: Dictionary<any>): T;
/**
* @see _.find
* @param _.where style callback
**/
export function findWhere<T>(
collection: Collection<T>,
pluckValue: string): T;
/**
* This method is like _.find except that it iterates over elements of a collection from
* right to left.