2023-02-03 08:30:24 +03:00

15 lines
348 B
TypeScript

/* eslint-disable import/prefer-default-export */
import { isEmpty } from 'radash';
import type { BaseOption } from 'ui/elements/types';
export function normalizeOptions(options: any[] | null | undefined) {
if (isEmpty(options)) {
return [];
}
return options?.map(({ label, value }) => ({
label,
value,
})) as BaseOption[];
}