mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-11 20:40:20 +00:00
Merge pull request #6260 from chrootsu/lodash-max
lodash: signatures of the method _.max have been changed
This commit is contained in:
+48
-7
@@ -1633,13 +1633,6 @@ result = <number>_(0.046).floor(2);
|
||||
result = <number>_(4060).floor(-2);
|
||||
// → 4000
|
||||
|
||||
result = <number>_.max([4, 2, 8, 6]);
|
||||
result = <IStoogesAge>_.max(stoogesAges, function (stooge) { return stooge.age; });
|
||||
result = <IStoogesAge>_.max(stoogesAges, 'age');
|
||||
result = <_.LoDashWrapper<number>>_([4, 2, 8, 6]).max();
|
||||
result = <_.LoDashWrapper<IStoogesAge>>_(stoogesAges).max(function (stooge) { return stooge.age; });
|
||||
result = <_.LoDashWrapper<IStoogesAge>>_(stoogesAges).max('age');
|
||||
|
||||
result = <number>_.min([4, 2, 8, 6]);
|
||||
result = <IStoogesAge>_.min(stoogesAges, function (stooge) { return stooge.age; });
|
||||
result = <IStoogesAge>_.min(stoogesAges, 'age');
|
||||
@@ -2424,6 +2417,54 @@ result = <Object>_({}).toPlainObject();
|
||||
result = <number>_.add(1, 1);
|
||||
result = <number>_(1).add(1);
|
||||
|
||||
// _.max
|
||||
module TestMax {
|
||||
let array: number[];
|
||||
let list: _.List<number>;
|
||||
let dictionary: _.Dictionary<number>;
|
||||
|
||||
let listIterator: (value: number, index: number, collection: _.List<number>) => number;
|
||||
let dictionaryIterator: (value: number, key: string, collection: _.Dictionary<number>) => number;
|
||||
|
||||
let result: number;
|
||||
|
||||
result = _.max<number>(array);
|
||||
result = _.max<number>(array, listIterator);
|
||||
result = _.max<number>(array, listIterator, any);
|
||||
result = _.max<number>(array, '');
|
||||
result = _.max<{a: number}, number>(array, {a: 42});
|
||||
|
||||
result = _.max<number>(list);
|
||||
result = _.max<number>(list, listIterator);
|
||||
result = _.max<number>(list, listIterator, any);
|
||||
result = _.max<number>(list, '');
|
||||
result = _.max<{a: number}, number>(list, {a: 42});
|
||||
|
||||
result = _.max<number>(dictionary);
|
||||
result = _.max<number>(dictionary, dictionaryIterator);
|
||||
result = _.max<number>(dictionary, dictionaryIterator, any);
|
||||
result = _.max<number>(dictionary, '');
|
||||
result = _.max<{a: number}, number>(dictionary, {a: 42});
|
||||
|
||||
result = _(array).max();
|
||||
result = _(array).max(listIterator);
|
||||
result = _(array).max(listIterator, any);
|
||||
result = _(array).max('');
|
||||
result = _(array).max<{a: number}>({a: 42});
|
||||
|
||||
result = _(list).max<number>();
|
||||
result = _(list).max<number>(listIterator);
|
||||
result = _(list).max<number>(listIterator, any);
|
||||
result = _(list).max<number>('');
|
||||
result = _(list).max<{a: number}, number>({a: 42});
|
||||
|
||||
result = _(dictionary).max<number>();
|
||||
result = _(dictionary).max<number>(dictionaryIterator);
|
||||
result = _(dictionary).max<number>(dictionaryIterator, any);
|
||||
result = _(dictionary).max<number>('');
|
||||
result = _(dictionary).max<{a: number}, number>({a: 42});
|
||||
}
|
||||
|
||||
/**********
|
||||
* Number *
|
||||
**********/
|
||||
|
||||
Vendored
+104
-111
@@ -4375,117 +4375,6 @@ declare module _ {
|
||||
floor(precision?: number): number;
|
||||
}
|
||||
|
||||
//_.max
|
||||
interface LoDashStatic {
|
||||
/**
|
||||
* Retrieves the maximum 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.
|
||||
**/
|
||||
max<T>(
|
||||
collection: Array<T>,
|
||||
callback?: ListIterator<T, any>,
|
||||
thisArg?: any): T;
|
||||
|
||||
/**
|
||||
* @see _.max
|
||||
**/
|
||||
max<T>(
|
||||
collection: List<T>,
|
||||
callback?: ListIterator<T, any>,
|
||||
thisArg?: any): T;
|
||||
|
||||
/**
|
||||
* @see _.max
|
||||
**/
|
||||
max<T>(
|
||||
collection: Dictionary<T>,
|
||||
callback?: DictionaryIterator<T, any>,
|
||||
thisArg?: any): T;
|
||||
|
||||
/**
|
||||
* @see _.max
|
||||
* @param pluckValue _.pluck style callback
|
||||
**/
|
||||
max<T>(
|
||||
collection: Array<T>,
|
||||
pluckValue: string): T;
|
||||
|
||||
/**
|
||||
* @see _.max
|
||||
* @param pluckValue _.pluck style callback
|
||||
**/
|
||||
max<T>(
|
||||
collection: List<T>,
|
||||
pluckValue: string): T;
|
||||
|
||||
/**
|
||||
* @see _.max
|
||||
* @param pluckValue _.pluck style callback
|
||||
**/
|
||||
max<T>(
|
||||
collection: Dictionary<T>,
|
||||
pluckValue: string): T;
|
||||
|
||||
/**
|
||||
* @see _.max
|
||||
* @param whereValue _.where style callback
|
||||
**/
|
||||
max<W, T>(
|
||||
collection: Array<T>,
|
||||
whereValue: W): T;
|
||||
|
||||
/**
|
||||
* @see _.max
|
||||
* @param whereValue _.where style callback
|
||||
**/
|
||||
max<W, T>(
|
||||
collection: List<T>,
|
||||
whereValue: W): T;
|
||||
|
||||
/**
|
||||
* @see _.max
|
||||
* @param whereValue _.where style callback
|
||||
**/
|
||||
max<W, T>(
|
||||
collection: Dictionary<T>,
|
||||
whereValue: W): T;
|
||||
}
|
||||
|
||||
interface LoDashArrayWrapper<T> {
|
||||
/**
|
||||
* @see _.max
|
||||
**/
|
||||
max(
|
||||
callback?: ListIterator<T, any>,
|
||||
thisArg?: any): LoDashWrapper<T>;
|
||||
|
||||
/**
|
||||
* @see _.max
|
||||
* @param pluckValue _.pluck style callback
|
||||
**/
|
||||
max(
|
||||
pluckValue: string): LoDashWrapper<T>;
|
||||
|
||||
/**
|
||||
* @see _.max
|
||||
* @param whereValue _.where style callback
|
||||
**/
|
||||
max<W>(
|
||||
whereValue: W): LoDashWrapper<T>;
|
||||
}
|
||||
|
||||
//_.min
|
||||
interface LoDashStatic {
|
||||
/**
|
||||
@@ -7208,6 +7097,110 @@ declare module _ {
|
||||
add(addend: number): number;
|
||||
}
|
||||
|
||||
//_.max
|
||||
interface LoDashStatic {
|
||||
/**
|
||||
* Gets the maximum value of collection. If collection is empty or falsey -Infinity is returned. If an iteratee
|
||||
* function is provided it’s invoked for each value in collection to generate the criterion by which the value
|
||||
* is ranked. The iteratee is bound to thisArg and invoked with three arguments: (value, index, collection).
|
||||
*
|
||||
* If a property name is provided for iteratee the created _.property style callback returns the property value
|
||||
* of the given element.
|
||||
*
|
||||
* If a value is also provided for thisArg the created _.matchesProperty style callback returns true for
|
||||
* elements that have a matching property value, else false.
|
||||
*
|
||||
* If an object is provided for iteratee the created _.matches style callback returns true for elements that
|
||||
* have the properties of the given object, else false.
|
||||
*
|
||||
* @param collection The collection to iterate over.
|
||||
* @param iteratee The function invoked per iteration.
|
||||
* @param thisArg The this binding of iteratee.
|
||||
* @return Returns the maximum value.
|
||||
*/
|
||||
max<T>(
|
||||
collection: List<T>,
|
||||
iteratee?: ListIterator<T, any>,
|
||||
thisArg?: any
|
||||
): T;
|
||||
|
||||
/**
|
||||
* @see _.max
|
||||
*/
|
||||
max<T>(
|
||||
collection: Dictionary<T>,
|
||||
iteratee?: DictionaryIterator<T, any>,
|
||||
thisArg?: any
|
||||
): T;
|
||||
|
||||
/**
|
||||
* @see _.max
|
||||
*/
|
||||
max<T>(
|
||||
collection: List<T>|Dictionary<T>,
|
||||
iteratee?: string,
|
||||
thisArg?: any
|
||||
): T;
|
||||
|
||||
/**
|
||||
* @see _.max
|
||||
*/
|
||||
max<TObject extends {}, T>(
|
||||
collection: List<T>|Dictionary<T>,
|
||||
whereValue?: TObject
|
||||
): T;
|
||||
}
|
||||
|
||||
interface LoDashArrayWrapper<T> {
|
||||
/**
|
||||
* @see _.max
|
||||
*/
|
||||
max(
|
||||
iteratee?: ListIterator<T, any>,
|
||||
thisArg?: any
|
||||
): T;
|
||||
|
||||
/**
|
||||
* @see _.max
|
||||
*/
|
||||
max(
|
||||
iteratee?: string,
|
||||
thisArg?: any
|
||||
): T;
|
||||
|
||||
/**
|
||||
* @see _.max
|
||||
*/
|
||||
max<TObject extends {}>(
|
||||
whereValue?: TObject
|
||||
): T;
|
||||
}
|
||||
|
||||
interface LoDashObjectWrapper<T> {
|
||||
/**
|
||||
* @see _.max
|
||||
*/
|
||||
max<T>(
|
||||
iteratee?: ListIterator<T, any>|DictionaryIterator<T, any>,
|
||||
thisArg?: any
|
||||
): T;
|
||||
|
||||
/**
|
||||
* @see _.max
|
||||
*/
|
||||
max<T>(
|
||||
iteratee?: string,
|
||||
thisArg?: any
|
||||
): T;
|
||||
|
||||
/**
|
||||
* @see _.max
|
||||
*/
|
||||
max<TObject extends {}, T>(
|
||||
whereValue?: TObject
|
||||
): T;
|
||||
}
|
||||
|
||||
/**********
|
||||
* Number *
|
||||
**********/
|
||||
|
||||
Reference in New Issue
Block a user