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

Function addDefaultsToRow

docs/pseudo.esm.sh/tinybase@9.0.0/index.js:1170–1198  ·  view source on GitHub ↗
(row, tableId, rowId)

Source from the content-addressed store, hash-verified

1168 () => valueInvalid(valueId, value)
1169 ) : isUndefined(getCellOrValueType(value)) ? valueInvalid(valueId, value) : encodeIfJson(value);
1170 const addDefaultsToRow = (row, tableId, rowId) => {
1171 ifNotUndefined(
1172 mapGet(tablesSchemaRowCache, tableId),
1173 ([rowDefaulted, rowNonDefaulted]) => {
1174 collForEach(rowDefaulted, (cell, cellId) => {
1175 if (!objHas(row, cellId)) {
1176 row[cellId] = cell;
1177 ifNotUndefined(
1178 rowId,
1179 (rowId2) => setAdd(
1180 mapEnsure(
1181 mapEnsure(defaultedCells, tableId, mapNew),
1182 rowId2,
1183 setNew
1184 ),
1185 cellId
1186 )
1187 );
1188 }
1189 });
1190 collForEach(rowNonDefaulted, (cellId) => {
1191 if (!objHas(row, cellId)) {
1192 cellInvalid(tableId, rowId, cellId);
1193 }
1194 });
1195 }
1196 );
1197 return row;
1198 };
1199 const addDefaultsToValues = (values) => {
1200 if (hasValuesSchema) {
1201 collForEach(valuesDefaulted, (value, valueId) => {

Callers 2

validateRowFunction · 0.70
setCellIntoNewRowFunction · 0.70

Calls 6

mapGetFunction · 0.70
collForEachFunction · 0.70
objHasFunction · 0.70
setAddFunction · 0.70
mapEnsureFunction · 0.70
cellInvalidFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…