diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 119dc44c56..6733f77d4f 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -438,8 +438,29 @@ module TestLast { result = _(list).last(); } -result = _.lastIndexOf([1, 2, 3, 1, 2, 3], 2); -result = _.lastIndexOf([1, 2, 3, 1, 2, 3], 2, 3); +// _.lastIndexOf +module TestLastIndexOf { + let array: TResult[]; + let list: _.List; + let value: TResult; + let result: number; + + result = _.lastIndexOf(array, value); + result = _.lastIndexOf(array, value, true); + result = _.lastIndexOf(array, value, 42); + + result = _.lastIndexOf(list, value); + result = _.lastIndexOf(list, value, true); + result = _.lastIndexOf(list, value, 42); + + result = _(array).lastIndexOf(value); + result = _(array).lastIndexOf(value, true); + result = _(array).lastIndexOf(value, 42); + + result = _(list).lastIndexOf(value); + result = _(list).lastIndexOf(value, true); + result = _(list).lastIndexOf(value, 42); +} // _.pull { diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index d0f51c11f3..e7411f3a9f 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -927,26 +927,38 @@ declare module _ { //_.lastIndexOf interface LoDashStatic { /** - * 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. - **/ - lastIndexOf( - array: Array, - value: T, - fromIndex?: number): number; - - /** - * @see _.lastIndexOf - **/ + * This method is like _.indexOf except that it iterates over elements of array from right to left. + * + * @param array The array to search. + * @param value The value to search for. + * @param fromIndex The index to search from or true to perform a binary search on a sorted array. + * @return Returns the index of the matched value, else -1. + */ lastIndexOf( array: List, value: T, - fromIndex?: number): number; + fromIndex?: boolean|number + ): number; + } + + interface LoDashArrayWrapper { + /** + * @see _.lastIndexOf + */ + lastIndexOf( + value: T, + fromIndex?: boolean|number + ): number; + } + + interface LoDashObjectWrapper { + /** + * @see _.lastIndexOf + */ + lastIndexOf( + value: TResult, + fromIndex?: boolean|number + ): number; } //_.pull