UNPKG

1.39 kBSource Map (JSON)View Raw
1{"version":3,"sources":["iterable/maxby.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEpD;;;;;;;;;GASG;AACH,MAAM,UAAU,KAAK,CACnB,MAAyB,EACzB,OAAuC;IAEvC,MAAM,EAAE,CAAC,UAAU,CAAC,EAAE,QAAQ,GAAG,gBAAgB,EAAE,CAAC,UAAU,CAAC,EAAE,QAAQ,EAAE,GAAG,OAAO,IAAI,EAAE,CAAC;IAC5F,OAAO,SAAS,CAAC,MAAM,EAAE,QAAS,EAAE,QAAQ,CAAC,CAAC;AAChD,CAAC","file":"maxby.js","sourcesContent":["import { extremaBy } from './_extremaby';\nimport { ExtremaOptions } from './extremaoptions';\nimport { equalityComparer } from '../util/comparer';\n\n/**\n * Returns the elements in an iterable sequence with the maximum key value.\n *\n * @export\n * @template TSource The type of the elements in the source sequence.\n * @template TKey The type of the key computed for each element in the source sequence.\n * @param {Iterable<TSource>} source The source to get the maximum by.\n * @param {ExtremaOptions<TSource, TKey>} [options] The options which include an optional comparer.\n * @returns {TSource[]} A list of zero or more elements that have a maximum key value.\n */\nexport function maxBy<TSource, TKey>(\n source: Iterable<TSource>,\n options?: ExtremaOptions<TSource, TKey>\n): TSource[] {\n const { ['comparer']: comparer = equalityComparer, ['selector']: selector } = options || {};\n return extremaBy(source, selector!, comparer);\n}\n"]}
\No newline at end of file