diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 03b7af277..53e7a22b8 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -304,6 +304,10 @@ result = _.max([4, 2, 8, 6]); result = _.max(stoogesAges, function(stooge) { return stooge.age; }); result = _.max(stooges, 'age'); +result = _.min([4, 2, 8, 6]); +result = _.min(stoogesAges, function(stooge) { return stooge.age; }); +result = _.min(stooges, 'age'); + result = _.reduce([1, 2, 3], function(sum, num) { return sum + num; }); diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 11e8cb37f..33f33e416 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -1379,6 +1379,43 @@ declare module _ { collection: Collection, whereValue: Dictionary): 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( + collection: Collection, + callback?: ListIterator, + thisArg?: any): T; + + /** + * @see _.min + * @param pluckValue _.pluck style callback + **/ + export function min( + collection: Collection, + pluckValue: string): T; + + /** + * @see _.min + * @param whereValue _.where style callback + **/ + export function min( + collection: Collection, + whereValue: Dictionary): 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; - - /** - * 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( - list: Collection, - iterator?: ListIterator, - 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).