( conditional: ConditionalSelect, )
| 915 | } |
| 916 | |
| 917 | function compileGroupedConditionalSelect( |
| 918 | conditional: ConditionalSelect, |
| 919 | ): (row: NamespacedRow) => any { |
| 920 | const branches = conditional.branches.map((branch) => ({ |
| 921 | condition: compileExpression(branch.condition), |
| 922 | value: compileGroupedSelectValue(branch.value), |
| 923 | })) |
| 924 | const defaultValue = |
| 925 | conditional.defaultValue === undefined |
| 926 | ? undefined |
| 927 | : compileGroupedSelectValue(conditional.defaultValue) |
| 928 | |
| 929 | return (row) => { |
| 930 | for (const branch of branches) { |
| 931 | if (isCaseWhenConditionTrue(branch.condition(row))) { |
| 932 | return branch.value(row) |
| 933 | } |
| 934 | } |
| 935 | |
| 936 | return defaultValue !== undefined ? defaultValue(row) : null |
| 937 | } |
| 938 | } |
| 939 | |
| 940 | function isNestedSelectObject(value: unknown): value is Select { |
| 941 | return ( |
no test coverage detected