mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-07-04 09:10:09 +00:00
Merge pull request #5914 from chrootsu/lodash-takeRight
lodash: added _.takeRight() method
This commit is contained in:
@@ -428,6 +428,21 @@ result = <number>_.sortedIndex(['twenty', 'thirty', 'fifty'], 'fourty', function
|
||||
return this.wordToNumber[word];
|
||||
}, sortedIndexDict);
|
||||
|
||||
// _.takeRight
|
||||
{
|
||||
let testTakeRightArray: TResult[];
|
||||
let testTakeRightList: _.List<TResult>;
|
||||
let result: TResult[];
|
||||
result = _.takeRight<TResult>(testTakeRightArray);
|
||||
result = _.takeRight<TResult>(testTakeRightArray, 42);
|
||||
result = _.takeRight<TResult>(testTakeRightList);
|
||||
result = _.takeRight<TResult>(testTakeRightList, 42);
|
||||
result = _(testTakeRightArray).takeRight().value();
|
||||
result = _(testTakeRightArray).takeRight(42).value();
|
||||
result = _(testTakeRightList).takeRight<TResult>().value();
|
||||
result = _(testTakeRightList).takeRight<TResult>(42).value();
|
||||
}
|
||||
|
||||
result = <number[]>_.union([1, 2, 3], [101, 2, 1, 10], [2, 1]);
|
||||
|
||||
result = <number[]>_([1, 2, 3]).union([101, 2, 1, 10], [2, 1]).value();
|
||||
|
||||
29
lodash/lodash.d.ts
vendored
29
lodash/lodash.d.ts
vendored
@@ -1442,6 +1442,35 @@ declare module _ {
|
||||
whereValue: W): number;
|
||||
}
|
||||
|
||||
//_.takeRight
|
||||
interface LoDashStatic {
|
||||
/**
|
||||
* Creates a slice of array with n elements taken from the end.
|
||||
*
|
||||
* @param array The array to query.
|
||||
* @param n The number of elements to take.
|
||||
* @return Returns the slice of array.
|
||||
*/
|
||||
takeRight<T>(
|
||||
array: T[]|List<T>,
|
||||
n?: number
|
||||
): T[];
|
||||
}
|
||||
|
||||
interface LoDashArrayWrapper<T> {
|
||||
/**
|
||||
* @see _.takeRight
|
||||
*/
|
||||
takeRight(n?: number): LoDashArrayWrapper<T>;
|
||||
}
|
||||
|
||||
interface LoDashObjectWrapper<T> {
|
||||
/**
|
||||
* @see _.takeRight
|
||||
*/
|
||||
takeRight<TResult>(n?: number): LoDashArrayWrapper<TResult>;
|
||||
}
|
||||
|
||||
//_.union
|
||||
interface LoDashStatic {
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user