15 lines
348 B
TypeScript
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[];
|
|
}
|