UNPKG

shelving

Version:

Toolkit for using data in JavaScript.

23 lines (22 loc) 1.2 kB
import type { DictionaryItem, ImmutableDictionary, PossibleDictionary } from "../util/dictionary.js"; import type { Updates } from "../util/update.js"; import { BusyStore } from "./BusyStore.js"; /** Store a dictionary object. */ export declare class DictionaryStore<T> extends BusyStore<ImmutableDictionary<T>, PossibleDictionary<T>> implements Iterable<DictionaryItem<T>> { constructor(value?: PossibleDictionary<T>); protected _convert(possible: PossibleDictionary<T>): ImmutableDictionary<T>; /** Get the length of the current value of this store. */ get count(): number; /** Set a named entry in this object with a different value. */ update(updates: Updates<ImmutableDictionary<T>>): void; /** Remove a named entry from this object. */ deleteItems(...keys: string[]): void; /** Get an item in this dictionary. */ get(name: string): T | undefined; /** Set an item in this dictionary. */ set(name: string, value: T): void; /** Delete an item (or several items) in this dictionary. */ delete(name: string, ...names: string[]): void; /** Iterate over the entries of the object. */ [Symbol.iterator](): Iterator<DictionaryItem<T>>; }