mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-09-09 11:13:57 +08:00
_.min definitions
This commit is contained in:
@@ -304,6 +304,10 @@ result = <number>_.max([4, 2, 8, 6]);
|
||||
result = <IStoogesAge>_.max(stoogesAges, function(stooge) { return stooge.age; });
|
||||
result = <IStoogesAge>_.max(stooges, 'age');
|
||||
|
||||
result = <number>_.min([4, 2, 8, 6]);
|
||||
result = <IStoogesAge>_.min(stoogesAges, function(stooge) { return stooge.age; });
|
||||
result = <IStoogesAge>_.min(stooges, 'age');
|
||||
|
||||
result = <any>_.reduce([1, 2, 3], function(sum, num) {
|
||||
return sum + num;
|
||||
});
|
||||
|
||||
Vendored
+37
-20
@@ -1379,6 +1379,43 @@ declare module _ {
|
||||
collection: Collection<T>,
|
||||
whereValue: Dictionary<any>): T;
|
||||
|
||||
/**
|
||||
* Retrieves the minimum value of a collection. If the collection is empty or falsey
|
||||
* Infinity is returned. If a callback is provided it will be executed for each value
|
||||
* in the collection to generate the criterion by which the value is ranked. The callback
|
||||
* is bound to thisArg and invoked with three arguments; (value, index, collection).
|
||||
*
|
||||
* 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 collection The collection to iterate over.
|
||||
* @param callback The function called per iteration.
|
||||
* @param thisArg The this binding of callback.
|
||||
* @return Returns the maximum value.
|
||||
**/
|
||||
export function min<T>(
|
||||
collection: Collection<T>,
|
||||
callback?: ListIterator<T, any>,
|
||||
thisArg?: any): T;
|
||||
|
||||
/**
|
||||
* @see _.min
|
||||
* @param pluckValue _.pluck style callback
|
||||
**/
|
||||
export function min<T>(
|
||||
collection: Collection<T>,
|
||||
pluckValue: string): T;
|
||||
|
||||
/**
|
||||
* @see _.min
|
||||
* @param whereValue _.where style callback
|
||||
**/
|
||||
export function min<T>(
|
||||
collection: Collection<T>,
|
||||
whereValue: Dictionary<any>): T;
|
||||
|
||||
/**
|
||||
* Reduces a collection to a value which is the accumulated result of running each
|
||||
* element in the collection through the callback, where each successive callback execution
|
||||
@@ -1571,26 +1608,6 @@ declare module _ {
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Returns the minimum value in list.
|
||||
* @param list Finds the minimum value in this list.
|
||||
* @return Minimum value in `list`.
|
||||
**/
|
||||
export function min(list: List<number>): number;
|
||||
|
||||
/**
|
||||
* Returns the minimum value in list. If iterator is passed, it will be used on each value to generate
|
||||
* the criterion by which the value is ranked.
|
||||
* @param list Finds the minimum value in this list.
|
||||
* @param iterator Compares each element in `list` to find the minimum value.
|
||||
* @param context `this` object in `iterator`, optional.
|
||||
* @return The minimum element within `list`.
|
||||
**/
|
||||
export function min<T>(
|
||||
list: Collection<T>,
|
||||
iterator?: ListIterator<T, any>,
|
||||
context?: any): T;
|
||||
|
||||
/**
|
||||
* Returns a sorted copy of list, ranked in ascending order by the results of running each value
|
||||
* through iterator. Iterator may also be the string name of the property to sort by (eg. length).
|
||||
|
||||
Reference in New Issue
Block a user