Library API
    Preparing search index...

    Class ScopedSet<T>

    A lightweight Set-compatible container that delegates has() lookups to a parent Set/ScopedSet, but confines add() writes to its own-local storage.

    This mirrors JavaScript prototype-chain semantics:

    • Values added to the parent are visible to the child via has().
    • Values added to the child are isolated from the parent; the parent Set is never modified by child add() calls.
    const global = new Set(['a']);
    const sandbox = new ScopedSet(global);
    sandbox.has('a'); // true (inherited from parent)
    sandbox.add('b');
    sandbox.has('b'); // true (own-local)
    global.has('b'); // false (never written to parent)

    Type Parameters

    • T
    Index
    • get size(): number

      Number of own-local entries (does not include parent entries).

      Returns number

    • Returns IterableIterator<T>

    • Adds to own-local storage only — never propagates to the parent.

      Parameters

      • value: T

      Returns this

    • Clears own-local storage only.

      Returns void

    • Removes from own-local storage only.

      Parameters

      • value: T

      Returns boolean

    • Returns IterableIterator<[T, T]>

    • Parameters

      • cb: (value: T, value2: T, set: ScopedSet<T>) => void
      • OptionalthisArg: any

      Returns void

    • true if value is in own-local storage OR anywhere in the parent chain.

      Parameters

      • value: T

      Returns boolean

    • Returns IterableIterator<T>

    • Returns IterableIterator<T>