_(...).findLast

This commit is contained in:
motemen
2014-10-18 18:07:43 +09:00
parent 4dd796bb15
commit a59dd92bf7
2 changed files with 28 additions and 0 deletions
+6
View File
@@ -400,6 +400,12 @@ result = <number>_.findLast([1, 2, 3, 4], function (num) {
result = <IFoodCombined>_.findLast(foodsCombined, { 'type': 'vegetable' });
result = <IFoodCombined>_.findLast(foodsCombined, 'organic');
result = <number>_([1, 2, 3, 4]).findLast(function (num) {
return num % 2 == 0;
});
result = <IFoodCombined>_(foodsCombined).findLast({ 'type': 'vegetable' });
result = <IFoodCombined>_(foodsCombined).findLast('organic');
result = <number[]>_.forEach([1, 2, 3], function (num) { console.log(num); });
result = <_.Dictionary<number>>_.forEach({ 'one': 1, 'two': 2, 'three': 3 }, function (num) { console.log(num); });
result = <IFoodType>_.forEach<IFoodType, string>({ name: 'apple', type: 'fruit' }, function (value, key) { console.log(value, key) });
+22
View File
@@ -2940,6 +2940,28 @@ declare module _ {
pluckValue: string): T;
}
interface LoDashArrayWrapper<T> {
/**
* @see _.findLast
*/
findLast(
callback: ListIterator<T, boolean>,
thisArg?: any): T;
/**
* @see _.findLast
* @param _.where style callback
*/
findLast<W>(
whereValue: W): T;
/**
* @see _.findLast
* @param _.where style callback
*/
findLast(
pluckValue: string): T;
}
//_.forEach
interface LoDashStatic {
/**