* Helper function to normalize control values - extracts values from object formats * and parses JSON strings for jsonTextArea controls * @param control - The control object * @param value - The value to normalize * @returns The normalized value
(control: any, value: any)
| 391 | * @returns The normalized value |
| 392 | */ |
| 393 | function normalizeControlValue(control: any, value: any) { |
| 394 | // @ts-ignore |
| 395 | if (control.searchMethod && control.type === 'select') { |
| 396 | return extractValueFromObject(value) |
| 397 | } |
| 398 | // @ts-ignore |
| 399 | else if (control.searchMethod && control.type === 'multiSelect') { |
| 400 | if (Array.isArray(value)) { |
| 401 | return value.map(extractValueFromObject) |
| 402 | } |
| 403 | } |
| 404 | // Parse JSON string to object for jsonTextArea |
| 405 | else if (control.type === 'jsonTextArea') { |
| 406 | const { parsed } = parseJSON(value) |
| 407 | return parsed |
| 408 | } |
| 409 | return value |
| 410 | } |
| 411 | |
| 412 | const parseBoolean = (value:any) => { |
| 413 | if (typeof value === 'string') { |
no test coverage detected