mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 19:07:08 +00:00
Merge pull request #5929 from chrootsu/lodash-dropRight
lodash: added _.dropRight() method
This commit is contained in:
commit
50d2fb552a
@ -208,6 +208,21 @@ result = <_.LoDashArrayWrapper<any>>_([0, 1, false, 2, '', 3]).compact();
|
||||
result = _(testDropList).drop<TResult>(42).value();
|
||||
}
|
||||
|
||||
// _.dropRight
|
||||
module TestDropRight {
|
||||
let array: TResult[];
|
||||
let list: _.List<TResult>;
|
||||
let result: TResult[];
|
||||
result = _.dropRight<TResult>(array);
|
||||
result = _.dropRight<TResult>(array, 42);
|
||||
result = _.dropRight<TResult>(list);
|
||||
result = _.dropRight<TResult>(list, 42);
|
||||
result = _(array).dropRight().value();
|
||||
result = _(array).dropRight(42).value();
|
||||
result = _(list).dropRight<TResult>().value();
|
||||
result = _(list).dropRight<TResult>(42).value();
|
||||
}
|
||||
|
||||
result = <number[]>_.rest([1, 2, 3]);
|
||||
result = <number[]>_.rest([1, 2, 3], 2);
|
||||
result = <number[]>_.rest([1, 2, 3], (num) => num < 3)
|
||||
|
||||
29
lodash/lodash.d.ts
vendored
29
lodash/lodash.d.ts
vendored
@ -419,6 +419,35 @@ declare module _ {
|
||||
drop<TResult>(n?: number): LoDashArrayWrapper<TResult>;
|
||||
}
|
||||
|
||||
//_.dropRight
|
||||
interface LoDashStatic {
|
||||
/**
|
||||
* Creates a slice of array with n elements dropped from the end.
|
||||
*
|
||||
* @param array The array to query.
|
||||
* @param n The number of elements to drop.
|
||||
* @return Returns the slice of array.
|
||||
*/
|
||||
dropRight<T>(
|
||||
array: List<T>,
|
||||
n?: number
|
||||
): T[];
|
||||
}
|
||||
|
||||
interface LoDashArrayWrapper<T> {
|
||||
/**
|
||||
* @see _.dropRight
|
||||
*/
|
||||
dropRight(n?: number): LoDashArrayWrapper<T>;
|
||||
}
|
||||
|
||||
interface LoDashObjectWrapper<T> {
|
||||
/**
|
||||
* @see _.dropRight
|
||||
*/
|
||||
dropRight<TResult>(n?: number): LoDashArrayWrapper<TResult>;
|
||||
}
|
||||
|
||||
//_.findIndex
|
||||
interface LoDashStatic {
|
||||
/**
|
||||
|
||||
Loading…
Reference in New Issue
Block a user