mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-08-25 11:11:46 +08:00
lodash: changed _.drop() method
This commit is contained in:
+15
-6
@@ -175,18 +175,27 @@ result = <_.LoDashArrayWrapper<any>>_([0, 1, false, 2, '', 3]).compact();
|
||||
result = <number[]>_.difference([1, 2, 3, 4, 5], [5, 2, 10]);
|
||||
result = <_.LoDashArrayWrapper<number>>_([1, 2, 3, 4, 5]).difference([5, 2, 10]);
|
||||
|
||||
// _.drop
|
||||
{
|
||||
let testDropArray: TResult[];
|
||||
let testDropList: _.List<TResult>;
|
||||
let result: TResult[];
|
||||
result = _.drop<TResult>(testDropArray);
|
||||
result = _.drop<TResult>(testDropArray, 42);
|
||||
result = _.drop<TResult>(testDropList);
|
||||
result = _.drop<TResult>(testDropList, 42);
|
||||
result = _(testDropArray).drop().value();
|
||||
result = _(testDropArray).drop(42).value();
|
||||
result = _(testDropList).drop<TResult>().value();
|
||||
result = _(testDropList).drop<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)
|
||||
result = <IFoodOrganic[]>_.rest(foodsOrganic, 'test');
|
||||
result = <IFoodType[]>_.rest(foodsType, { 'type': 'value' });
|
||||
|
||||
result = <number[]>_.drop([1, 2, 3]);
|
||||
result = <number[]>_.drop([1, 2, 3], 2);
|
||||
result = <number[]>_.drop([1, 2, 3], (num) => num < 3)
|
||||
result = <IFoodOrganic[]>_.drop(foodsOrganic, 'test');
|
||||
result = <IFoodType[]>_.drop(foodsType, { 'type': 'value' });
|
||||
|
||||
result = <number[]>_.tail([1, 2, 3])
|
||||
result = <number[]>_.tail([1, 2, 3], 2)
|
||||
result = <number[]>_.tail([1, 2, 3], (num) => num < 3)
|
||||
|
||||
Vendored
+26
-68
@@ -397,6 +397,32 @@ declare module _ {
|
||||
...others: List<T>[]): LoDashArrayWrapper<T>;
|
||||
}
|
||||
|
||||
//_.drop
|
||||
interface LoDashStatic {
|
||||
/**
|
||||
* Creates a slice of array with n elements dropped from the beginning.
|
||||
*
|
||||
* @param array The array to query.
|
||||
* @param n The number of elements to drop.
|
||||
* @return Returns the slice of array.
|
||||
*/
|
||||
drop<T>(array: T[]|List<T>, n?: number): T[];
|
||||
}
|
||||
|
||||
interface LoDashArrayWrapper<T> {
|
||||
/**
|
||||
* @see _.drop
|
||||
*/
|
||||
drop(n?: number): LoDashArrayWrapper<T>;
|
||||
}
|
||||
|
||||
interface LoDashObjectWrapper<T> {
|
||||
/**
|
||||
* @see _.drop
|
||||
*/
|
||||
drop<TResult>(n?: number): LoDashArrayWrapper<TResult>;
|
||||
}
|
||||
|
||||
//_.findIndex
|
||||
interface LoDashStatic {
|
||||
/**
|
||||
@@ -1280,74 +1306,6 @@ declare module _ {
|
||||
array: List<T>,
|
||||
whereValue: W): T[];
|
||||
|
||||
/**
|
||||
* @see _.rest
|
||||
**/
|
||||
drop<T>(array: Array<T>): T[];
|
||||
|
||||
/**
|
||||
* @see _.rest
|
||||
**/
|
||||
drop<T>(array: List<T>): T[];
|
||||
|
||||
/**
|
||||
* @see _.rest
|
||||
**/
|
||||
drop<T>(
|
||||
array: Array<T>,
|
||||
callback: ListIterator<T, boolean>,
|
||||
thisArg?: any): T[];
|
||||
|
||||
/**
|
||||
* @see _.rest
|
||||
**/
|
||||
drop<T>(
|
||||
array: List<T>,
|
||||
callback: ListIterator<T, boolean>,
|
||||
thisArg?: any): T[];
|
||||
|
||||
/**
|
||||
* @see _.rest
|
||||
**/
|
||||
drop<T>(
|
||||
array: Array<T>,
|
||||
n: number): T[];
|
||||
|
||||
/**
|
||||
* @see _.rest
|
||||
**/
|
||||
drop<T>(
|
||||
array: List<T>,
|
||||
n: number): T[];
|
||||
|
||||
/**
|
||||
* @see _.rest
|
||||
**/
|
||||
drop<T>(
|
||||
array: Array<T>,
|
||||
pluckValue: string): T[];
|
||||
|
||||
/**
|
||||
* @see _.rest
|
||||
**/
|
||||
drop<T>(
|
||||
array: List<T>,
|
||||
pluckValue: string): T[];
|
||||
|
||||
/**
|
||||
* @see _.rest
|
||||
**/
|
||||
drop<W, T>(
|
||||
array: Array<T>,
|
||||
whereValue: W): T[];
|
||||
|
||||
/**
|
||||
* @see _.rest
|
||||
**/
|
||||
drop<W, T>(
|
||||
array: List<T>,
|
||||
whereValue: W): T[];
|
||||
|
||||
/**
|
||||
* @see _.rest
|
||||
**/
|
||||
|
||||
Reference in New Issue
Block a user