mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-09-09 11:13:57 +08:00
_.findWhere definitions
This commit is contained in:
@@ -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;
|
||||
});
|
||||
|
||||
Vendored
+24
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user