mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-08-25 11:11:46 +08:00
lodash: changed _.rest() method (alias _.tail())
This commit is contained in:
+24
-12
@@ -276,18 +276,6 @@ module TestDropWhile {
|
||||
result = _(list).dropWhile<{a: number;}, TResult>({a: 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[]>_.tail([1, 2, 3])
|
||||
result = <number[]>_.tail([1, 2, 3], 2)
|
||||
result = <number[]>_.tail([1, 2, 3], (num) => num < 3)
|
||||
result = <IFoodOrganic[]>_.tail(foodsOrganic, 'test')
|
||||
result = <IFoodType[]> _.tail(foodsType, { 'type': 'value' })
|
||||
|
||||
// _.fill
|
||||
var testFillArray = [1, 2, 3];
|
||||
var testFillList: _.List<number> = {0: 1, 1: 2, 2: 3, length: 3};
|
||||
@@ -584,6 +572,18 @@ module TestRemove {
|
||||
result = _(list).remove<{a: number}, TResult>({a: 42}).value();
|
||||
}
|
||||
|
||||
// _.rest
|
||||
module TestRest {
|
||||
let array: TResult[];
|
||||
let list: _.List<TResult>;
|
||||
let result: TResult[];
|
||||
|
||||
result = _.rest<TResult>(array);
|
||||
result = _.rest<TResult>(list);
|
||||
result = _(array).rest().value();
|
||||
result = _(list).rest<TResult>().value();
|
||||
}
|
||||
|
||||
// _.slice
|
||||
{
|
||||
let testSliceArray: TResult[];
|
||||
@@ -608,6 +608,18 @@ result = <number>_.sortedIndex(['twenty', 'thirty', 'fifty'], 'fourty', function
|
||||
return this.wordToNumber[word];
|
||||
}, sortedIndexDict);
|
||||
|
||||
// _.tail
|
||||
module TestTail {
|
||||
let array: TResult[];
|
||||
let list: _.List<TResult>;
|
||||
let result: TResult[];
|
||||
|
||||
result = _.tail<TResult>(array);
|
||||
result = _.tail<TResult>(list);
|
||||
result = _(array).tail().value();
|
||||
result = _(list).tail<TResult>().value();
|
||||
}
|
||||
|
||||
// _.take
|
||||
module TestTake {
|
||||
let array: TResult[];
|
||||
|
||||
Vendored
+39
-144
@@ -1165,155 +1165,28 @@ declare module _ {
|
||||
//_.rest
|
||||
interface LoDashStatic {
|
||||
/**
|
||||
* The opposite of _.initial this method gets all but the first element or first n elements of
|
||||
* an array. If a callback function is provided elements at the beginning of the array are excluded
|
||||
* from the result as long as the callback returns truey. The callback is bound to thisArg and
|
||||
* invoked with three arguments; (value, index, array).
|
||||
*
|
||||
* If a property name is provided for callback the created "_.pluck" style callback will return
|
||||
* the property value of the given element.
|
||||
*
|
||||
* If an object is provided for callback the created "_.where" style callback will return true
|
||||
* for elements that have the properties of the given object, else false.
|
||||
* @param array The array to query.
|
||||
* @param {(Function|Object|number|string)} [callback=1] The function called per element or the number
|
||||
* of elements to exclude. If a property name or object is provided it will be used to create a
|
||||
* ".pluck" or ".where" style callback, respectively.
|
||||
* @param {*} [thisArg] The this binding of callback.
|
||||
* @return Returns a slice of array.
|
||||
**/
|
||||
rest<T>(array: Array<T>): T[];
|
||||
|
||||
/**
|
||||
* @see _.rest
|
||||
**/
|
||||
* Gets all but the first element of array.
|
||||
*
|
||||
* @alias _.tail
|
||||
*
|
||||
* @param array The array to query.
|
||||
* @return Returns the slice of array.
|
||||
*/
|
||||
rest<T>(array: List<T>): T[];
|
||||
}
|
||||
|
||||
interface LoDashArrayWrapper<T> {
|
||||
/**
|
||||
* @see _.rest
|
||||
**/
|
||||
rest<T>(
|
||||
array: Array<T>,
|
||||
callback: ListIterator<T, boolean>,
|
||||
thisArg?: any): T[];
|
||||
* @see _.rest
|
||||
*/
|
||||
rest(): LoDashArrayWrapper<T>;
|
||||
}
|
||||
|
||||
interface LoDashObjectWrapper<T> {
|
||||
/**
|
||||
* @see _.rest
|
||||
**/
|
||||
rest<T>(
|
||||
array: List<T>,
|
||||
callback: ListIterator<T, boolean>,
|
||||
thisArg?: any): T[];
|
||||
|
||||
/**
|
||||
* @see _.rest
|
||||
**/
|
||||
rest<T>(
|
||||
array: Array<T>,
|
||||
n: number): T[];
|
||||
|
||||
/**
|
||||
* @see _.rest
|
||||
**/
|
||||
rest<T>(
|
||||
array: List<T>,
|
||||
n: number): T[];
|
||||
|
||||
/**
|
||||
* @see _.rest
|
||||
**/
|
||||
rest<T>(
|
||||
array: Array<T>,
|
||||
pluckValue: string): T[];
|
||||
|
||||
/**
|
||||
* @see _.rest
|
||||
**/
|
||||
rest<T>(
|
||||
array: List<T>,
|
||||
pluckValue: string): T[];
|
||||
|
||||
/**
|
||||
* @see _.rest
|
||||
**/
|
||||
rest<W, T>(
|
||||
array: Array<T>,
|
||||
whereValue: W): T[];
|
||||
|
||||
/**
|
||||
* @see _.rest
|
||||
**/
|
||||
rest<W, T>(
|
||||
array: List<T>,
|
||||
whereValue: W): T[];
|
||||
|
||||
/**
|
||||
* @see _.rest
|
||||
**/
|
||||
tail<T>(array: Array<T>): T[];
|
||||
|
||||
/**
|
||||
* @see _.rest
|
||||
**/
|
||||
tail<T>(array: List<T>): T[];
|
||||
|
||||
/**
|
||||
* @see _.rest
|
||||
**/
|
||||
tail<T>(
|
||||
array: Array<T>,
|
||||
callback: ListIterator<T, boolean>,
|
||||
thisArg?: any): T[];
|
||||
|
||||
/**
|
||||
* @see _.rest
|
||||
**/
|
||||
tail<T>(
|
||||
array: List<T>,
|
||||
callback: ListIterator<T, boolean>,
|
||||
thisArg?: any): T[];
|
||||
|
||||
/**
|
||||
* @see _.rest
|
||||
**/
|
||||
tail<T>(
|
||||
array: Array<T>,
|
||||
n: number): T[];
|
||||
|
||||
/**
|
||||
* @see _.rest
|
||||
**/
|
||||
tail<T>(
|
||||
array: List<T>,
|
||||
n: number): T[];
|
||||
|
||||
/**
|
||||
* @see _.rest
|
||||
**/
|
||||
tail<T>(
|
||||
array: Array<T>,
|
||||
pluckValue: string): T[];
|
||||
|
||||
/**
|
||||
* @see _.rest
|
||||
**/
|
||||
tail<T>(
|
||||
array: List<T>,
|
||||
pluckValue: string): T[];
|
||||
|
||||
/**
|
||||
* @see _.rest
|
||||
**/
|
||||
tail<W, T>(
|
||||
array: Array<T>,
|
||||
whereValue: W): T[];
|
||||
|
||||
/**
|
||||
* @see _.rest
|
||||
**/
|
||||
tail<W, T>(
|
||||
array: List<T>,
|
||||
whereValue: W): T[];
|
||||
* @see _.rest
|
||||
*/
|
||||
rest<TResult>(): LoDashArrayWrapper<TResult>;
|
||||
}
|
||||
|
||||
//_.slice
|
||||
@@ -1413,6 +1286,28 @@ declare module _ {
|
||||
whereValue: W): number;
|
||||
}
|
||||
|
||||
//_.tail
|
||||
interface LoDashStatic {
|
||||
/**
|
||||
* @see _.rest
|
||||
*/
|
||||
tail<T>(array: List<T>): T[];
|
||||
}
|
||||
|
||||
interface LoDashArrayWrapper<T> {
|
||||
/**
|
||||
* @see _.rest
|
||||
*/
|
||||
tail(): LoDashArrayWrapper<T>;
|
||||
}
|
||||
|
||||
interface LoDashObjectWrapper<T> {
|
||||
/**
|
||||
* @see _.rest
|
||||
*/
|
||||
tail<TResult>(): LoDashArrayWrapper<TResult>;
|
||||
}
|
||||
|
||||
//_.take
|
||||
interface LoDashStatic {
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user