mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-09-09 11:13:57 +08:00
Aliases for _.first: head and take
This commit is contained in:
@@ -72,6 +72,22 @@ result = <number[]>_.first([1, 2, 3], function(num) {
|
||||
result = <IFoodOrganic[]>_.first(foodsOrganic, 'organic');
|
||||
result = <IFoodType[]>_.first(foodsType, { 'type': 'fruit' });
|
||||
|
||||
result = <number>_.head([1, 2, 3]);
|
||||
result = <number[]>_.head([1, 2, 3], 2);
|
||||
result = <number[]>_.head([1, 2, 3], function(num) {
|
||||
return num < 3;
|
||||
});
|
||||
result = <IFoodOrganic[]>_.head(foodsOrganic, 'organic');
|
||||
result = <IFoodType[]>_.head(foodsType, { 'type': 'fruit' });
|
||||
|
||||
result = <number>_.take([1, 2, 3]);
|
||||
result = <number[]>_.take([1, 2, 3], 2);
|
||||
result = <number[]>_.take([1, 2, 3], function(num) {
|
||||
return num < 3;
|
||||
});
|
||||
result = <IFoodOrganic[]>_.take(foodsOrganic, 'organic');
|
||||
result = <IFoodType[]>_.take(foodsType, { 'type': 'fruit' });
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
//WHAT'S LEFT
|
||||
|
||||
Vendored
+44
@@ -653,6 +653,28 @@ declare module _ {
|
||||
array: List<T>,
|
||||
n: number): T[];
|
||||
|
||||
/**
|
||||
* @see _.first
|
||||
**/
|
||||
export function head<T>(
|
||||
array: List<T>,
|
||||
callback: ListIterator<T, boolean>,
|
||||
thisArg?: any): T[];
|
||||
|
||||
/**
|
||||
* @see _.first
|
||||
**/
|
||||
export function head<T>(
|
||||
array: List<T>,
|
||||
pluckValue: string): T[];
|
||||
|
||||
/**
|
||||
* @see _.first
|
||||
**/
|
||||
export function head<T>(
|
||||
array: List<T>,
|
||||
whereValue: Dictionary<string>): T[];
|
||||
|
||||
/**
|
||||
* @see _.first
|
||||
**/
|
||||
@@ -665,6 +687,28 @@ declare module _ {
|
||||
array: List<T>,
|
||||
n: number): T[];
|
||||
|
||||
/**
|
||||
* @see _.first
|
||||
**/
|
||||
export function take<T>(
|
||||
array: List<T>,
|
||||
callback: ListIterator<T, boolean>,
|
||||
thisArg?: any): T[];
|
||||
|
||||
/**
|
||||
* @see _.first
|
||||
**/
|
||||
export function take<T>(
|
||||
array: List<T>,
|
||||
pluckValue: string): T[];
|
||||
|
||||
/**
|
||||
* @see _.first
|
||||
**/
|
||||
export function take<T>(
|
||||
array: List<T>,
|
||||
whereValue: Dictionary<string>): T[];
|
||||
|
||||
/**
|
||||
* Returns everything but the last entry of the array. Especially useful on the arguments object.
|
||||
* Pass n to exclude the last n elements from the result.
|
||||
|
||||
Reference in New Issue
Block a user