1 | import { extremaBy } from './_extremaby';
|
2 | import { equalityComparer } from '../util/comparer';
|
3 | /**
|
4 | * Returns the elements in an iterable sequence with the maximum key value.
|
5 | *
|
6 | * @export
|
7 | * @template TSource The type of the elements in the source sequence.
|
8 | * @template TKey The type of the key computed for each element in the source sequence.
|
9 | * @param {Iterable<TSource>} source The source to get the maximum by.
|
10 | * @param {ExtremaOptions<TSource, TKey>} [options] The options which include an optional comparer.
|
11 | * @returns {TSource[]} A list of zero or more elements that have a maximum key value.
|
12 | */
|
13 | export function maxBy(source, options) {
|
14 | const { ['comparer']: comparer = equalityComparer, ['selector']: selector } = options || {};
|
15 | return extremaBy(source, selector, comparer);
|
16 | }
|
17 |
|
18 | //# sourceMappingURL=maxby.mjs.map
|