{"version":3,"sources":["asynciterable/tomap.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAWjD,MAAM,CAAC,KAAK,UAAU,KAAK,CACzB,MAA8B,EAC9B,WAAoD,EACpD,kBAAmE,aAAa;IAEhF,MAAM,GAAG,GAAG,IAAI,GAAG,EAA4B,CAAC;IAChD,IAAI,KAAK,EAAE,MAAM,IAAI,IAAI,MAAM,EAAE;QAC/B,MAAM,KAAK,GAAG,MAAM,eAAe,CAAC,IAAI,CAAC,CAAC;QAC1C,MAAM,GAAG,GAAG,MAAM,WAAW,CAAC,IAAI,CAAC,CAAC;QACpC,GAAG,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;KACrB;IACD,OAAO,GAAG,CAAC;AACb,CAAC","file":"tomap.js","sourcesContent":["import { identityAsync } from '../util/identity';\n\nexport async function toMap<TSource, TKey>(\n  source: AsyncIterable<TSource>,\n  keySelector: (item: TSource) => TKey | Promise<TKey>\n): Promise<Map<TKey, TSource>>;\nexport async function toMap<TSource, TKey, TElement = TSource>(\n  source: AsyncIterable<TSource>,\n  keySelector: (item: TSource) => TKey | Promise<TKey>,\n  elementSelector?: (item: TSource) => TElement | Promise<TElement>\n): Promise<Map<TKey, TElement>>;\nexport async function toMap<TSource, TKey, TElement = TSource>(\n  source: AsyncIterable<TSource>,\n  keySelector: (item: TSource) => TKey | Promise<TKey>,\n  elementSelector: (item: TSource) => TElement | Promise<TElement> = identityAsync\n): Promise<Map<TKey, TElement | TSource>> {\n  const map = new Map<TKey, TElement | TSource>();\n  for await (const item of source) {\n    const value = await elementSelector(item);\n    const key = await keySelector(item);\n    map.set(key, value);\n  }\n  return map;\n}\n"]}