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

Function create

examples/react/offline-transactions/src/utils/todos.ts:39–50  ·  view source on GitHub ↗
(input: TodoInput)

Source from the content-addressed store, hash-verified

37 },
38
39 create(input: TodoInput): Todo {
40 const now = new Date()
41 const todo: Todo = {
42 id: generateId(),
43 text: input.text,
44 completed: input.completed ?? false,
45 createdAt: now,
46 updatedAt: now,
47 }
48 todosStore.set(todo.id, todo)
49 return todo
50 },
51
52 update(id: string, updates: TodoUpdate): Todo | null {
53 const existing = todosStore.get(id)

Callers

nothing calls this directly

Calls 2

generateIdFunction · 0.70
setMethod · 0.45

Tested by

no test coverage detected