formats.ts 422 B

12345678910111213141516171819
  1. import { upperFirst } from 'lodash';
  2. import { ReportFormat } from '../../types';
  3. export const getFormatsDisplay = (formats: ReportFormat[]) => {
  4. return upperFirst(
  5. formats
  6. .map((format) => {
  7. switch (format) {
  8. case 'csv':
  9. case 'pdf':
  10. return format.toUpperCase();
  11. case 'image':
  12. return 'embedded image';
  13. }
  14. })
  15. .join(', ')
  16. );
  17. };