1 | import { wrapWithAbort } from './operators/withabort';
|
2 | import { throwIfAborted } from '../aborterror';
|
3 | /**
|
4 | * Determines whether the given async-iterable is empty.
|
5 | *
|
6 | * @export
|
7 | * @template T The type of elements in the source sequence.
|
8 | * @param {AsyncIterable<T>} source The source async-iterable to determine whether it is empty.
|
9 | * @param {AbortSignal} [signal] An optional abort signal to cancel the operation.
|
10 | * @returns {Promise<boolean>} Returns a promise containing true if the sequence is empty, otherwise false.
|
11 | */
|
12 | export async function isEmpty(source, signal) {
|
13 | throwIfAborted(signal);
|
14 | for await (const _ of wrapWithAbort(source, signal)) {
|
15 | return false;
|
16 | }
|
17 | return true;
|
18 | }
|
19 |
|
20 | //# sourceMappingURL=isempty.mjs.map
|