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

Function getDefaultedTabularConfigMap

src/persisters/common/database/config.ts:101–129  ·  view source on GitHub ↗
(
  configsObj: IdObj<any>,
  defaultObj: IdObj<any>,
  tableField: 'tableId' | 'tableName',
  exclude: (id: string, firstValue: string) => any,
  then: (id: string, firstValue: string) => void,
)

Source from the content-addressed store, hash-verified

99 );
100
101const getDefaultedTabularConfigMap = (
102 configsObj: IdObj<any>,
103 defaultObj: IdObj<any>,
104 tableField: 'tableId' | 'tableName',
105 exclude: (id: string, firstValue: string) => any,
106 then: (id: string, firstValue: string) => void,
107): IdMap<any[]> => {
108 const configMap = mapNew<Id, any[]>();
109 objMap(configsObj, (configObj, id) => {
110 const defaultedConfig = slice(
111 objValues(
112 objMerge(
113 defaultObj,
114 isString(configObj) ? {[tableField]: configObj} : configObj,
115 ),
116 ),
117 0,
118 objSize(defaultObj),
119 );
120 if (
121 !isNull(defaultedConfig[0]) &&
122 !exclude(id, defaultedConfig[0] as string)
123 ) {
124 then(id, defaultedConfig[0] as string);
125 mapSet(configMap, id, defaultedConfig);
126 }
127 });
128 return configMap;
129};
130
131export const getConfigStructures = (
132 configOrStoreTableName: DatabasePersisterConfig | string | undefined,

Callers 1

getConfigStructuresFunction · 0.85

Calls 9

mapNewFunction · 0.90
objMapFunction · 0.90
sliceFunction · 0.90
objValuesFunction · 0.90
objMergeFunction · 0.90
isStringFunction · 0.90
objSizeFunction · 0.90
isNullFunction · 0.90
mapSetFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…