BUPKIS
    Preparing search index...

    Variable SyncIteratorSchemaConst

    SyncIteratorSchema: ZodCustom<
        Iterator<unknown, any, any>,
        Iterator<unknown, any, any>,
    > = ...

    Schema matching any synchronous iterator (has next() method).

    This schema validates values that implement the iterator protocol, meaning they have a next() method that returns { value, done } objects. This includes iterator objects returned from calling Symbol.iterator on iterables, generator objects, and custom iterator implementations.

    Note that most iterators are also iterable (they have Symbol.iterator returning this), but this schema specifically checks for the next() method which is the core iterator requirement.

    const arr = [1, 2, 3];
    SyncIteratorSchema.parse(arr[Symbol.iterator]()); // ✓ Valid
    SyncIteratorSchema.parse(
    (function* () {
    yield 1;
    })(),
    ); // ✓ Valid (generators are iterators)
    SyncIteratorSchema.parse({
    next: () => ({ done: true, value: undefined }),
    }); // ✓ Valid
    SyncIteratorSchema.parse([1, 2, 3]); // ✗ Throws (array is iterable, not iterator)
    SyncIteratorSchema.parse({}); // ✗ Throws validation error
    import { createAssertion, use } from 'bupkis';
    import { SyncIteratorSchema } from 'bupkis/schema';

    const iteratorAssertion = createAssertion(
    [SyncIteratorSchema, 'to be an iterator'],
    SyncIteratorSchema,
    );

    const { expect } = use([iteratorAssertion]);
    expect([1, 2, 3][Symbol.iterator](), 'to be an iterator');