UNPKG

1.59 kBSource Map (JSON)View Raw
1{"version":3,"sources":["asynciterable/maxby.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAEzD;;;;;;;;;GASG;AACH,MAAM,UAAU,KAAK,CACnB,MAA8B,EAC9B,OAAuC;IAEvC,MAAM,EACJ,CAAC,UAAU,CAAC,EAAE,QAAQ,GAAG,qBAAqB,EAC9C,CAAC,UAAU,CAAC,EAAE,QAAQ,EACtB,CAAC,QAAQ,CAAC,EAAE,MAAM,GACnB,GAAG,OAAO,IAAI,EAAE,CAAC;IAClB,OAAO,SAAS,CAAC,MAAM,EAAE,QAAS,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;AACxD,CAAC","file":"maxby.js","sourcesContent":["import { extremaBy } from './_extremaby';\nimport { ExtremaOptions } from './extremaoptions';\nimport { equalityComparerAsync } from '../util/comparer';\n\n/**\n * Returns the elements in an async-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 {AsyncIterable<TSource>} source An async-iterable sequence to get the maximum elements for.\n * @param {ExtremaOptions<TSource, TKey>} [options] The options which include an optional comparer and abort signal.\n * @returns {Promise<TSource[]>} A promise containing a list of zero or more elements that have a maximum key value.\n */\nexport function maxBy<TSource, TKey>(\n source: AsyncIterable<TSource>,\n options?: ExtremaOptions<TSource, TKey>\n): Promise<TSource[]> {\n const {\n ['comparer']: comparer = equalityComparerAsync,\n ['selector']: selector,\n ['signal']: signal,\n } = options || {};\n return extremaBy(source, selector!, comparer, signal);\n}\n"]}
\No newline at end of file