(examples: string[])
| 122 | } |
| 123 | |
| 124 | function trimExamplesByCharacterLimit(examples: string[]) { |
| 125 | const trimmedExamples = [...examples]; |
| 126 | let totalCharacters = trimmedExamples.reduce( |
| 127 | (acc, curr) => acc + curr.length, |
| 128 | 0 |
| 129 | ); |
| 130 | |
| 131 | while ( |
| 132 | totalCharacters > MAX_CHARACTERS_IN_MAPPING_EXAMPLES && |
| 133 | trimmedExamples.length > 1 |
| 134 | ) { |
| 135 | trimmedExamples.pop(); |
| 136 | totalCharacters = trimmedExamples.reduce( |
| 137 | (acc, curr) => acc + curr.length, |
| 138 | 0 |
| 139 | ); |
| 140 | } |
| 141 | |
| 142 | return trimmedExamples; |
| 143 | } |
| 144 | |
| 145 | export function useMappingAvailableSelectOptions( |
| 146 | sheetDefinitions: SheetDefinition[], |
no outgoing calls
no test coverage detected