( configsObj: IdObj<any>, defaultObj: IdObj<any>, tableField: 'tableId' | 'tableName', exclude: (id: string, firstValue: string) => any, then: (id: string, firstValue: string) => void, )
| 99 | ); |
| 100 | |
| 101 | const 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 | |
| 131 | export const getConfigStructures = ( |
| 132 | configOrStoreTableName: DatabasePersisterConfig | string | undefined, |
no test coverage detected
searching dependent graphs…