collect-your-stuff
    Preparing search index...

    Interface IsScopedCollection<Scope, Key, Value>

    Define a keyed collection partitioned by scope: every scope has its own independent key space, and a scope that is no longer referenced anywhere else takes its whole key space with it.

    interface IsScopedCollection<
        Scope extends object = object,
        Key = any,
        Value = any,
    > {
        delete: (scope: Scope, key: Key) => boolean;
        get: (scope: Scope, key: Key) => Value;
        has: (scope: Scope, key: Key) => boolean;
        set: (scope: Scope, key: Key, value: Value) => void;
    }

    Type Parameters

    • Scope extends object = object
    • Key = any
    • Value = any

    Implemented by

    Index
    delete: (scope: Scope, key: Key) => boolean

    Remove a key from a scope's key space.

    Type Declaration

      • (scope: Scope, key: Key): boolean
      • Parameters

        Returns boolean

        Whether a value was actually removed

    get: (scope: Scope, key: Key) => Value

    Look up a value by key within a scope.

    Type Declaration

      • (scope: Scope, key: Key): Value
      • Parameters

        Returns Value

        The value, or undefined when the scope or key is not present

    has: (scope: Scope, key: Key) => boolean

    Check whether a key exists within a scope.

    set: (scope: Scope, key: Key, value: Value) => void

    Store a value under a key within a scope.