From bec8643ba48b9ed7760d4bb5955b7386b0d25a5e Mon Sep 17 00:00:00 2001 From: Brian Zengel Date: Sun, 13 Oct 2013 19:41:58 -0400 Subject: [PATCH] definition for _.lastIndexOf --- lodash/lodash-tests.ts | 2 ++ lodash/lodash.d.ts | 15 ++++++++------- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 1dd39e5e2..4f459ba9c 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -123,6 +123,8 @@ result = _.last([1, 2, 3], function(num) { result = _.last(foodsOrganic, 'organic'); result = _.last(foodsType, { 'type': 'vegetable' }); +result = _.lastIndexOf([1, 2, 3, 1, 2, 3], 2); +result = _.lastIndexOf([1, 2, 3, 1, 2, 3], 2, 3); //////////////////////////////////////////////////////////////////////////////////////// //WHAT'S LEFT diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 3985b9832..875966822 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -1062,17 +1062,18 @@ declare module _ { isSorted: boolean): number; /** - * Returns the index of the last occurrence of value in the array, or -1 if value is not present. Uses the - * native lastIndexOf function if possible. Pass fromIndex to start your search at a given index. - * @param array The array to search for the last index of `value`. - * @param value The value to search for within `array`. - * @param from The starting index for the search, optional. - * @return The index of the last occurance of `value` within `array`. + * Gets the index at which the last occurrence of value is found using strict equality + * for comparisons, i.e. ===. If fromIndex is negative, it is used as the offset from the + * end of the collection. + * @param array The array to search. + * @param value The value to search for. + * @param fromIndex The index to search from. + * @return The index of the matched value or -1. **/ export function lastIndexOf( array: List, value: T, - from?: number): number; + fromIndex?: number): number; /** * Uses a binary search to determine the index at which the value should be inserted into the list in order