MCPcopy Create free account
hub / github.com/tinyplex/tinybase / objEnsure

Function objEnsure

test/unit/persisters/common/mocks.ts:91–100  ·  view source on GitHub ↗
(
  obj: {[id: Id]: Value},
  id: Id,
  getDefaultValue: () => Value,
)

Source from the content-addressed store, hash-verified

89};
90
91const objEnsure = <Value>(
92 obj: {[id: Id]: Value},
93 id: Id,
94 getDefaultValue: () => Value,
95): Value => {
96 if (obj[id] == undefined) {
97 obj[id] = getDefaultValue();
98 }
99 return obj[id] as Value;
100};
101
102const docObjMatch = (
103 docObjOrParent: {[id: Id]: any},

Callers 1

docObjMatchFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…