vchikalkin 079446181a graphql: share common queries
packages: add @graphql-codegen/typed-document-node
2023-02-01 15:18:55 +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[];
}