MCPcopy Index your code
hub / github.com/tinyplex/tinybase / objEnsure

Function objEnsure

docs/pseudo.esm.sh/tinybase@9.0.0/index.js:145–150  ·  view source on GitHub ↗
(obj, id2, getDefaultValue)

Source from the content-addressed store, hash-verified

143 );
144};
145var objEnsure = (obj, id2, getDefaultValue) => {
146 if (!objHas(obj, id2)) {
147 obj[id2] = getDefaultValue();
148 }
149 return obj[id2];
150};
151var objValidate = (obj, validateChild, onInvalidObj, emptyIsValid = 0) => {
152 if (isNullish(obj) || !isObject(obj) || !emptyIsValid && objIsEmpty(obj) || objFrozen(obj)) {
153 onInvalidObj?.();

Callers 5

mergeContentOrChangesFunction · 0.70
getMergeableRowHashesFunction · 0.70
getMergeableRowDiffFunction · 0.70
getMergeableCellHashesFunction · 0.70
getMergeableCellDiffFunction · 0.70

Calls 1

objHasFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…