Interface representing a key-value store with various utility methods. Store

interface Store {
    delete: (key: string) => void;
    exists: (key: string) => boolean;
    get: (key: string) => null | Uint8Array;
    getJson: (key: string) => any;
    getKeys: () => string[];
    set: (key: string, value: string | object | Uint8Array) => void;
    setJson: (key: string, value: any) => void;
}

Properties

delete: (key: string) => void

Deletes the value associated with the given key.

Type declaration

    • (key: string): void
    • Parameters

      • key: string

        The key to delete the value for.

      Returns void

exists: (key: string) => boolean

Checks if a key exists in the store.

Type declaration

    • (key: string): boolean
    • Parameters

      • key: string

        The key to check.

      Returns boolean

      True if the key exists, false otherwise.

get: (key: string) => null | Uint8Array

Retrieves the value associated with the given key.

Type declaration

    • (key: string): null | Uint8Array
    • Parameters

      • key: string

        The key to retrieve the value for.

      Returns null | Uint8Array

      The value associated with the key, or null if the key does not exist.

getJson: (key: string) => any

Retrieves the JSON value associated with the given key.

Type declaration

    • (key: string): any
    • Parameters

      • key: string

        The key to retrieve the JSON value for.

      Returns any

      The JSON value associated with the key.

getKeys: () => string[]

Retrieves all the keys in the store.

Type declaration

    • (): string[]
    • Returns string[]

      An array of all the keys in the store.

set: (key: string, value: string | object | Uint8Array) => void

Sets the value for the given key.

Type declaration

    • (key: string, value: string | object | Uint8Array): void
    • Parameters

      • key: string

        The key to set the value for.

      • value: string | object | Uint8Array

        The value to set. Can be a Uint8Array, string, or object.

      Returns void

setJson: (key: string, value: any) => void

Sets the JSON value for the given key.

Type declaration

    • (key: string, value: any): void
    • Parameters

      • key: string

        The key to set the JSON value for.

      • value: any

        The JSON value to set.

      Returns void