( group: CanonicalGroup, values: Record<string, unknown> )
| 222 | * Resolve basic and advanced values for a canonical group. |
| 223 | */ |
| 224 | export function getCanonicalValues( |
| 225 | group: CanonicalGroup, |
| 226 | values: Record<string, unknown> |
| 227 | ): CanonicalValueSelection { |
| 228 | const basicValue = group.basicId ? values[group.basicId] : undefined |
| 229 | let advancedValue: unknown |
| 230 | let advancedSourceId: string | undefined |
| 231 | |
| 232 | group.advancedIds.forEach((advancedId) => { |
| 233 | if (advancedValue !== undefined) return |
| 234 | const candidate = values[advancedId] |
| 235 | if (isNonEmptyValue(candidate)) { |
| 236 | advancedValue = candidate |
| 237 | advancedSourceId = advancedId |
| 238 | } |
| 239 | }) |
| 240 | |
| 241 | return { basicValue, advancedValue, advancedSourceId } |
| 242 | } |
| 243 | |
| 244 | /** |
| 245 | * Resolve the ACTIVE canonical member's value for a group: the basic value in basic mode, the |
no test coverage detected