mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 19:07:08 +00:00
Merge pull request #6132 from chrootsu/lodash-lastIndexOf
lodash: changed _.lastIndexOf() method
This commit is contained in:
commit
06e62de975
@ -438,8 +438,29 @@ module TestLast {
|
||||
result = _(list).last<TResult>();
|
||||
}
|
||||
|
||||
result = <number>_.lastIndexOf([1, 2, 3, 1, 2, 3], 2);
|
||||
result = <number>_.lastIndexOf([1, 2, 3, 1, 2, 3], 2, 3);
|
||||
// _.lastIndexOf
|
||||
module TestLastIndexOf {
|
||||
let array: TResult[];
|
||||
let list: _.List<TResult>;
|
||||
let value: TResult;
|
||||
let result: number;
|
||||
|
||||
result = _.lastIndexOf<TResult>(array, value);
|
||||
result = _.lastIndexOf<TResult>(array, value, true);
|
||||
result = _.lastIndexOf<TResult>(array, value, 42);
|
||||
|
||||
result = _.lastIndexOf<TResult>(list, value);
|
||||
result = _.lastIndexOf<TResult>(list, value, true);
|
||||
result = _.lastIndexOf<TResult>(list, value, 42);
|
||||
|
||||
result = _(array).lastIndexOf(value);
|
||||
result = _(array).lastIndexOf(value, true);
|
||||
result = _(array).lastIndexOf(value, 42);
|
||||
|
||||
result = _(list).lastIndexOf<TResult>(value);
|
||||
result = _(list).lastIndexOf<TResult>(value, true);
|
||||
result = _(list).lastIndexOf<TResult>(value, 42);
|
||||
}
|
||||
|
||||
// _.pull
|
||||
{
|
||||
|
||||
46
lodash/lodash.d.ts
vendored
46
lodash/lodash.d.ts
vendored
@ -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<T>(
|
||||
array: Array<T>,
|
||||
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<T>(
|
||||
array: List<T>,
|
||||
value: T,
|
||||
fromIndex?: number): number;
|
||||
fromIndex?: boolean|number
|
||||
): number;
|
||||
}
|
||||
|
||||
interface LoDashArrayWrapper<T> {
|
||||
/**
|
||||
* @see _.lastIndexOf
|
||||
*/
|
||||
lastIndexOf(
|
||||
value: T,
|
||||
fromIndex?: boolean|number
|
||||
): number;
|
||||
}
|
||||
|
||||
interface LoDashObjectWrapper<T> {
|
||||
/**
|
||||
* @see _.lastIndexOf
|
||||
*/
|
||||
lastIndexOf<TResult>(
|
||||
value: TResult,
|
||||
fromIndex?: boolean|number
|
||||
): number;
|
||||
}
|
||||
|
||||
//_.pull
|
||||
|
||||
Loading…
Reference in New Issue
Block a user