UNPKG

616 BSource Map (JSON)View Raw
1{"version":3,"sources":["asynciterable/elementat.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,KAAK,UAAU,SAAS,CAC7B,MAAwB,EACxB,KAAa;IAEb,IAAI,CAAC,GAAG,KAAK,CAAC;IACd,IAAI,KAAK,EAAE,MAAM,IAAI,IAAI,MAAM,EAAE;QAC/B,IAAI,CAAC,KAAK,CAAC,EAAE;YACX,OAAO,IAAI,CAAC;SACb;QACD,CAAC,EAAE,CAAC;KACL;IACD,OAAO,SAAS,CAAC;AACnB,CAAC","file":"elementat.js","sourcesContent":["export async function elementAt<T>(\n source: AsyncIterable<T>,\n index: number\n): Promise<T | undefined> {\n let i = index;\n for await (const item of source) {\n if (i === 0) {\n return item;\n }\n i--;\n }\n return undefined;\n}\n"]}
\No newline at end of file