MCPcopy Create free account
hub / github.com/massCodeIO/massCode / set

Method set

src/main/import/notes/__tests__/persist.test.ts:35–51  ·  view source on GitHub ↗
(key: string, value: unknown)

Source from the content-addressed store, hash-verified

33 }
34
35 set(key: string, value: unknown): void {
36 const segments = key.split('.')
37 let cursor: Record<string, unknown> = this.state
38
39 for (let index = 0; index < segments.length - 1; index += 1) {
40 const segment = segments[index]
41 const next = cursor[segment]
42
43 if (!next || typeof next !== 'object') {
44 cursor[segment] = {}
45 }
46
47 cursor = cursor[segment] as Record<string, unknown>
48 }
49
50 cursor[segments[segments.length - 1]] = value
51 }
52 }
53
54 return { default: MockStore }

Callers 5

previewObsidianImportFunction · 0.45
reportThemeIssueFunction · 0.45
registerSystemHandlersFunction · 0.45
spaces.test.tsFile · 0.45
system.test.tsFile · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected