MCPcopy Create free account
hub / github.com/MoonshotAI/kimi-code / memoryStorage

Function memoryStorage

apps/kimi-web/test/composer-draft.test.ts:6–24  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

4import { draftStorageKey } from '../src/lib/storage';
5
6function memoryStorage(): Storage {
7 const map = new Map<string, string>();
8 return {
9 get length() {
10 return map.size;
11 },
12 clear: () => {
13 map.clear();
14 },
15 getItem: (key: string) => map.get(key) ?? null,
16 key: (index: number) => Array.from(map.keys())[index] ?? null,
17 removeItem: (key: string) => {
18 map.delete(key);
19 },
20 setItem: (key: string, value: string) => {
21 map.set(key, value);
22 },
23 };
24}
25
26function setup(initialSid: string | undefined) {
27 const sid = ref(initialSid);

Callers 1

Calls 5

keysMethod · 0.80
clearMethod · 0.65
getMethod · 0.65
deleteMethod · 0.65
setMethod · 0.65

Tested by

no test coverage detected