A lightweight Set-compatible container that delegates has() lookups to a parent Set/ScopedSet, but confines add() writes to its own-local storage.
Set
has()
add()
This mirrors JavaScript prototype-chain semantics:
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) Copy
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)
Optional
Number of own-local entries (does not include parent entries).
Adds to own-local storage only — never propagates to the parent.
Clears own-local storage only.
Removes from own-local storage only.
true if value is in own-local storage OR anywhere in the parent chain.
true
A lightweight
Set-compatible container that delegateshas()lookups to a parent Set/ScopedSet, but confinesadd()writes to its own-local storage.This mirrors JavaScript prototype-chain semantics:
has().add()calls.Example