(value: any, defaultValue = '')
| 2 | * Format the result value of an expression for display as a string. |
| 3 | */ |
| 4 | export function formatExpressionResult(value: any, defaultValue = ''): string { |
| 5 | if (value === undefined || value === null) { |
| 6 | return defaultValue; |
| 7 | } |
| 8 | |
| 9 | if (typeof value === 'string') { |
| 10 | return value; |
| 11 | } |
| 12 | |
| 13 | if (typeof value === 'number' || typeof value === 'boolean') { |
| 14 | return value.toString(); |
| 15 | } |
| 16 | |
| 17 | return defaultValue; |
| 18 | } |
| 19 | |
| 20 | /** |
| 21 | * Filter function to exclude `null` values |
no test coverage detected