MCPcopy
hub / github.com/coder/mux / MemoryStorage

Class MemoryStorage

src/common/preferences/userPreferencesStorage.test.ts:29–47  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

27import type { UserPreferences } from "@/common/config/schemas/userPreferences";
28
29class MemoryStorage {
30 private values = new Map<string, string>();
31
32 get length() {
33 return this.values.size;
34 }
35
36 key(index: number): string | null {
37 return Array.from(this.values.keys())[index] ?? null;
38 }
39
40 getItem(key: string): string | null {
41 return this.values.get(key) ?? null;
42 }
43
44 setJSON(key: string, value: unknown) {
45 this.values.set(key, JSON.stringify(value));
46 }
47}
48
49function collectForTest(storage: MemoryStorage) {
50 return getStoredUserPreferenceEntries(storage).reduce(

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected