MCPcopy Create free account
hub / github.com/clientdb/clientdb / fillDataDefaults

Function fillDataDefaults

core/entity.ts:67–82  ·  view source on GitHub ↗
(data: Partial<D>, store: EntityStore<D, any>)

Source from the content-addressed store, hash-verified

65}
66
67function fillDataDefaults<D>(data: Partial<D>, store: EntityStore<D, any>): D {
68 const { definition, db } = store;
69
70 const { config } = definition;
71
72 if (!definition.config.getDefaultValues) {
73 return data as D;
74 }
75
76 const dataWithDefaults = {
77 ...config.getDefaultValues?.(db),
78 ...data,
79 } as D;
80
81 return dataWithDefaults;
82}
83
84export function createEntity<D, V>({
85 data,

Callers 1

createEntityFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected