UNPKG

1.86 kBSource Map (JSON)View Raw
1{"version":3,"sources":["asynciterable/every.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAG/C;;;;;;;;;GASG;AACH,MAAM,CAAC,KAAK,UAAU,KAAK,CACzB,MAAwB,EACxB,OAAuB;IAEvB,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC,SAAS,CAAC,EAAE,OAAO,EAAE,CAAC,WAAW,CAAC,EAAE,SAAS,EAAE,GAAG,OAAO,CAAC;IACvF,cAAc,CAAC,MAAM,CAAC,CAAC;IACvB,IAAI,CAAC,GAAG,CAAC,CAAC;IACV,IAAI,KAAK,EAAE,MAAM,IAAI,IAAI,aAAa,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE;QACtD,IAAI,CAAC,CAAC,MAAM,SAAS,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,EAAE,CAAC,EAAE,EAAE,MAAM,CAAC,CAAC,EAAE;YACvD,OAAO,KAAK,CAAC;SACd;KACF;IACD,OAAO,IAAI,CAAC;AACd,CAAC","file":"every.js","sourcesContent":["import { wrapWithAbort } from './operators/withabort';\nimport { throwIfAborted } from '../aborterror';\nimport { FindOptions } from './findoptions';\n\n/**\n * Determines whether all elements of an async-iterable sequence satisfy a condition.\n *\n * @export\n * @template T The type of the elements in the source sequence.\n * @param {AsyncIterable<T>} source An async-iterable sequence whose elements to apply the predicate to.\n * @param {FindOptions<T>} options The options for a predicate for filtering, thisArg for binding and AbortSignal for cancellation.\n * @returns {Promise<boolean>} An async-iterable sequence containing a single element determining whether all elements in the\n * source sequence pass the test in the specified predicate.\n */\nexport async function every<T>(\n source: AsyncIterable<T>,\n options: FindOptions<T>\n): Promise<boolean> {\n const { ['signal']: signal, ['thisArg']: thisArg, ['predicate']: predicate } = options;\n throwIfAborted(signal);\n let i = 0;\n for await (const item of wrapWithAbort(source, signal)) {\n if (!(await predicate.call(thisArg, item, i++, signal))) {\n return false;\n }\n }\n return true;\n}\n"]}
\No newline at end of file