diff --git a/src/async/impl.ts b/src/async/impl.ts index f9f0f44..9d7e421 100644 --- a/src/async/impl.ts +++ b/src/async/impl.ts @@ -1072,7 +1072,7 @@ abstract class BaseOrderedAsyncSequence extends BaseAsyncSequence extends BaseAsyncSequence { +class EmptyAsyncSequence extends BaseAsyncSequence { override async nonEnumeratedCount() { return 0; } @@ -1080,6 +1080,8 @@ export class EmptyAsyncSequence extends BaseAsyncSequence { override async *iterator() { } } +export const EMPTY = new EmptyAsyncSequence(); + export class RangeAsyncSequence extends BaseAsyncSequence { readonly #min: number; readonly #max: number; diff --git a/src/async/index.ts b/src/async/index.ts index 3306d26..1d71875 100644 --- a/src/async/index.ts +++ b/src/async/index.ts @@ -1,8 +1,8 @@ import { wrap as wrapSync } from "../sync/index.js"; import { Sequence } from "../sync/types.js"; -import { MaybeAsyncGenerator, MaybeAsyncIterable, MaybeAsyncSequence, MaybePromiseLike } from "../types.js"; +import { MaybeAsyncGenerator, MaybeAsyncIterable, MaybePromiseLike } from "../types.js"; import { isAsyncIterable } from "../utils.js"; -import { WrappedSequence, WrappedAsyncIterable, EmptyAsyncSequence, WrappedObjectAsync, WrappedArrayAsync, WrappedArrayLikeAsync, FunctionAsyncSequence, GeneratorAsyncSequence, RangeAsyncSequence, RepeatForeverAsyncSequence, RepeatAsyncSequence, AsyncSequenceMarker } from "./impl.js"; +import { WrappedSequence, WrappedAsyncIterable, WrappedObjectAsync, WrappedArrayAsync, WrappedArrayLikeAsync, FunctionAsyncSequence, GeneratorAsyncSequence, RangeAsyncSequence, RepeatForeverAsyncSequence, RepeatAsyncSequence, AsyncSequenceMarker, EMPTY } from "./impl.js"; import { AsyncSequence } from "./types.js"; export function asAsync(sequence: Sequence>): AsyncSequence { @@ -25,8 +25,6 @@ export function sequence(iterable: AsyncIterable>): Async return new WrappedAsyncIterable(iterable); } -export const EMPTY = new EmptyAsyncSequence(); - export function empty(): AsyncSequence { return EMPTY; } diff --git a/src/sync/impl.ts b/src/sync/impl.ts index 7dc7905..db76bdd 100644 --- a/src/sync/impl.ts +++ b/src/sync/impl.ts @@ -1065,7 +1065,7 @@ export abstract class BaseOrderedSequence extends BaseSequence extends BaseSequence { +class EmptySequence extends BaseSequence { override nonEnumeratedCount() { return 0; } @@ -1073,6 +1073,8 @@ export class EmptySequence extends BaseSequence { override *iterator() { } } +export const EMPTY = new EmptySequence(); + export class RangeSequence extends BaseSequence { readonly #min: number; readonly #max: number; diff --git a/src/sync/index.ts b/src/sync/index.ts index a5844fa..1102dd8 100644 --- a/src/sync/index.ts +++ b/src/sync/index.ts @@ -1,6 +1,6 @@ import { mathRandom } from "../random/index.js"; import { RandomGenerator } from "../random/types.js"; -import { BigIntRangeSequence, ConcatSequence, EmptySequence, SequenceMarker, FunctionSequence, GeneratorSequence, RangeSequence, RepeatSequence, RepeatForeverSequence, WrappedArray, WrappedArrayLike, WrappedIterable, WrappedMap, WrappedObject, WrappedSet } from "./impl.js"; +import { BigIntRangeSequence, ConcatSequence, SequenceMarker, FunctionSequence, GeneratorSequence, RangeSequence, RepeatSequence, RepeatForeverSequence, WrappedArray, WrappedArrayLike, WrappedIterable, WrappedMap, WrappedObject, WrappedSet, EMPTY } from "./impl.js"; import { Sequence } from "./types.js"; export function wrap(iterable: Iterable): Sequence { @@ -27,8 +27,6 @@ export function sequence(iterable: Iterable): Sequence { return new WrappedIterable(iterable); } -export const EMPTY = new EmptySequence(); - export function empty(): Sequence { return EMPTY; }