MCPcopy Create free account
hub / github.com/TanStack/db / loadTodos

Function loadTodos

examples/electron/offline-first/server/index.ts:27–34  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

25const TODOS_FILE = path.join(__dirname, 'todos.json')
26
27function loadTodos(): Map<string, Todo> {
28 try {
29 const data = JSON.parse(fs.readFileSync(TODOS_FILE, 'utf-8')) as Array<Todo>
30 return new Map(data.map((t) => [t.id, t]))
31 } catch {
32 return new Map()
33 }
34}
35
36function saveTodos() {
37 fs.writeFileSync(

Callers 1

index.tsFile · 0.85

Calls 1

mapMethod · 0.45

Tested by

no test coverage detected